Update README.md
Browse files
README.md
CHANGED
|
@@ -22,5 +22,21 @@ This model is finetuned on a subset from [microsoft/orca-agentinstruct-1M-v1](ht
|
|
| 22 |
## Use
|
| 23 |
|
| 24 |
```python3
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
```
|
|
|
|
| 22 |
## Use
|
| 23 |
|
| 24 |
```python3
|
| 25 |
+
import torch
|
| 26 |
+
from transformers import pipeline
|
| 27 |
+
"
|
| 28 |
+
pipe = pipeline(
|
| 29 |
+
"text-generation",
|
| 30 |
+
model=model_id,
|
| 31 |
+
torch_dtype=torch.bfloat16,
|
| 32 |
+
device_map="auto",
|
| 33 |
+
)
|
| 34 |
+
messages = [
|
| 35 |
+
{"role": "user", "content": "\n\nYou are an expert text classifier. You need to classify the text below into one of the given classes. \n\nText:\n\nThe anticipation of the meteor shower has filled the astronomy club with an infectious excitement, as we prepare our telescopes for what could be a once-in-a-lifetime celestial event.\n\nClasses:\n\nAffirmative Sentiment;Mildly Affirmative Sentiment;Exuberant Endorsement;Objective Assessment;Critical Sentiment;Subdued Negative Sentiment;Intense Negative Sentiment;Ambivalent Sentiment;Sarcastic Sentiment;Ironical Sentiment;Apathetic Sentiment;Elation/Exhilaration Sentiment;Credibility Endorsement;Apprehension/Anxiety;Unexpected Positive Outcome;Melancholic Sentiment;Aversive Repulsion;Indignant Discontent;Expectant Enthusiasm;Affectionate Appreciation;Anticipatory Positivity;Expectation of Negative Outcome;Nuanced Sentiment Complexity\n\nThe output format must be:\n\nFinal class: {selected_class}\n\n"},
|
| 36 |
+
]
|
| 37 |
+
outputs = pipe(
|
| 38 |
+
messages,
|
| 39 |
+
max_new_tokens=256,
|
| 40 |
+
)
|
| 41 |
+
print(outputs[0]["generated_text"][-1])
|
| 42 |
```
|