teglad commited on
Commit
ca77bef
1 Parent(s): ff4896b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +20 -0
README.md CHANGED
@@ -17,3 +17,23 @@ This model was trained on the [Kaggle Emotions](https://www.kaggle.com/datasets/
17
  + Anger (3)
18
  + Fear (4)
19
  + Surprise (5)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  + Anger (3)
18
  + Fear (4)
19
  + Surprise (5)
20
+
21
+ ### Model Usage
22
+
23
+ ```
24
+ import torch
25
+ from transformers import AutoModelForSequenceClassification, AutoTokenizer
26
+
27
+ # Load the model and tokenizer
28
+ model = AutoModelForSequenceClassification.from_pretrained("teglad/DistilRoBERTaEmotionClassifier")
29
+ tokenizer = AutoTokenizer.from_pretrained("teglad/DistilRoBERTaEmotionClassifier")
30
+
31
+ # Tokenize the input text, returning PyTorch tensors.
32
+ input_ids = tokenizer("Deep Learning models can be so difficult to understand, how do they even work?", return_tensors="pt")
33
+
34
+ # Pass the input_ids and attention_masks into the model
35
+ output = model(**input_ids)
36
+
37
+ # Get the position of the largest logit, this is the predicted class
38
+ prediction = torch.argmax(output.logits, dim=1).tolist()
39
+ ```