Update README.md
Browse files
README.md
CHANGED
@@ -9,4 +9,62 @@ pipeline_tag: text-generation
|
|
9 |
|
10 |
# Shotor (Llama 3 8B Instruction Tuned on Farsi)
|
11 |
|
12 |
-
<a href="https://ibb.co/PwCN3VF"><img src="https://i.ibb.co/0hJc8zm/shotor.png" alt="shotor" border="0"></a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
# Shotor (Llama 3 8B Instruction Tuned on Farsi)
|
11 |
|
12 |
+
<a href="https://ibb.co/PwCN3VF"><img src="https://i.ibb.co/0hJc8zm/shotor.png" alt="shotor" border="0"></a>
|
13 |
+
|
14 |
+
|
15 |
+
Shotor is a Persian language model built upon the llama 3 8B architecture, a multilingual Large Language Model (LLM). It has been fine-tuned using supervised learning techniques and the Dora method for efficient fine-tuning. The model has been specifically tailored and trained on Persian datasets, particularly leveraging the dataset provided by [persian-alpaca-deep-clean](https://huggingface.co/datasets/myrkur/persian-alpaca-deep-clean).
|
16 |
+
|
17 |
+
## Usage
|
18 |
+
|
19 |
+
Here's a sample Python code snippet demonstrating how to use Shotor for text generation:
|
20 |
+
|
21 |
+
```python
|
22 |
+
import transformers
|
23 |
+
import torch
|
24 |
+
|
25 |
+
# Load the Shotor model
|
26 |
+
model_id = "myrkur/shotor"
|
27 |
+
pipeline = transformers.pipeline(
|
28 |
+
"text-generation",
|
29 |
+
model=model_id,
|
30 |
+
model_kwargs={"torch_dtype": torch.bfloat16},
|
31 |
+
device_map="auto",
|
32 |
+
)
|
33 |
+
|
34 |
+
# Define user messages
|
35 |
+
messages = [
|
36 |
+
{"role": "user", "content": "پول بهتر است یا ثروت؟"},
|
37 |
+
]
|
38 |
+
|
39 |
+
# Apply chat template and generate text
|
40 |
+
prompt = pipeline.tokenizer.apply_chat_template(
|
41 |
+
messages,
|
42 |
+
tokenize=False,
|
43 |
+
add_generation_prompt=True
|
44 |
+
)
|
45 |
+
|
46 |
+
terminators = [
|
47 |
+
pipeline.tokenizer.eos_token_id,
|
48 |
+
pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
|
49 |
+
]
|
50 |
+
|
51 |
+
outputs = pipeline(
|
52 |
+
prompt,
|
53 |
+
max_new_tokens=512,
|
54 |
+
eos_token_id=terminators,
|
55 |
+
do_sample=True,
|
56 |
+
temperature=0.5,
|
57 |
+
top_p=0.9,
|
58 |
+
repetition_penalty=1.1
|
59 |
+
)
|
60 |
+
print(outputs[0]["generated_text"][len(prompt):])
|
61 |
+
```
|
62 |
+
|
63 |
+
## Contributions
|
64 |
+
|
65 |
+
Contributions to Shotor are welcome! Whether it's enhancing the model's capabilities, improving its performance on specific tasks, or evaluating its performance, your contributions can help advance Persian natural language processing.
|
66 |
+
|
67 |
+
## Contact
|
68 |
+
For questions or further information, please contact:
|
69 |
+
|
70 |
+
- Amir Masoud Ahmadi: [[email protected]](mailto:[email protected])
|