Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
| 1 |
-
---
|
| 2 |
-
license:
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: llama3.1
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
base_model:
|
| 6 |
+
- meta-llama/Llama-3.1-8B-Instruct
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# Description
|
| 10 |
+
|
| 11 |
+
This is a classification model fine-tuned from [meta-llama/Llama-3.1-8B-Instruct](https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct).
|
| 12 |
+
It classifies English input sentences into one of four categories: News, Social, Speech, and Literary.
|
| 13 |
+
|
| 14 |
+
Training data: [WMT2024 testset](https://huggingface.co/datasets/google/wmt24pp)
|
| 15 |
+
|
| 16 |
+
# Example
|
| 17 |
+
|
| 18 |
+
```python
|
| 19 |
+
import transformers
|
| 20 |
+
import torch
|
| 21 |
+
|
| 22 |
+
model_id = "Systran/Llama-3.1-8B-Instruct-ft-wmt25-classifier"
|
| 23 |
+
|
| 24 |
+
pipeline = transformers.pipeline(
|
| 25 |
+
"text-generation",
|
| 26 |
+
model=model_id,
|
| 27 |
+
model_kwargs={"torch_dtype": torch.bfloat16},
|
| 28 |
+
device_map="auto",
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
messages = [
|
| 32 |
+
{"role": "system", "content": "You are a language expert."},
|
| 33 |
+
{
|
| 34 |
+
"role": "user",
|
| 35 |
+
"content": "Classify the following English sentence into one of the following categories based on its content and style:\nNews: Factual reporting or informative text typically found in journalism.\nSocial: Informal, conversational, or casual text often used on social media or in personal messages.\nSpeech: Spoken or scripted verbal communication, such as political speeches, interviews, or lectures.\nLiterary: Creative or artistic writing, including fiction, poetry, or other literary works.\n\nSentence: What is hip hop?\n\nYour task: Identify the most appropriate category from the four above. Just respond with the category name: News, Social, Speech, or Literary.",
|
| 36 |
+
},
|
| 37 |
+
]
|
| 38 |
+
|
| 39 |
+
outputs = pipeline(
|
| 40 |
+
messages,
|
| 41 |
+
max_new_tokens=256,
|
| 42 |
+
)
|
| 43 |
+
print(outputs[0]["generated_text"][-1])
|
| 44 |
+
|
| 45 |
+
|