pascalrai commited on
Commit
cfaa34f
1 Parent(s): 571bcce

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +27 -1
README.md CHANGED
@@ -40,4 +40,30 @@ No Evaluation is done for data with only text and no emojis.
40
  The model was fine-tuned with dataset: mteb/tweet_sentiment_extraction from huggingface
41
  converted to hinglish text.
42
 
43
- The model has a test loss of 0.6 and an f1 score of 0.74 on the unseen data from the dataset.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  The model was fine-tuned with dataset: mteb/tweet_sentiment_extraction from huggingface
41
  converted to hinglish text.
42
 
43
+ The model has a test loss of 0.6 and an f1 score of 0.74 on the unseen data from the dataset.
44
+
45
+ ```
46
+ # Use a pipeline as a high-level helper
47
+ from transformers import pipeline
48
+
49
+ pipe = pipeline("text-classification", model="pascalrai/hinglish-twitter-roberta-base-sentiment")
50
+ pipe("tu mujhe pasandh heh")
51
+ ```
52
+
53
+ ```
54
+ # Load model directly
55
+ # Load model directly
56
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
57
+ import torch
58
+
59
+ tokenizer = AutoTokenizer.from_pretrained("pascalrai/hinglish-twitter-roberta-base-sentiment")
60
+ model = AutoModelForSequenceClassification.from_pretrained("pascalrai/hinglish-twitter-roberta-base-sentiment")
61
+
62
+ inputs = ["tum kon ho bhai","tu mujhe pasandh heh"]
63
+ outputs = model(**tokenizer(inputs, return_tensors='pt', padding=True))
64
+
65
+ p = torch.nn.Softmax(dim = 1)(outputs.logits)
66
+ for index, each in enumerate(p.detach().numpy()):
67
+ print(f"Text: {inputs[index]}")
68
+ print(f"Negative: {round(float(each[0]),2)}\nNeutral: {round(float(each[1]),2)}\nPositive: {round(float(each[2]),2)}\n")
69
+ ```