mostafaamiri
commited on
Commit
•
fd9ee33
1
Parent(s):
3314276
Update README.md
Browse files
README.md
CHANGED
@@ -7,4 +7,28 @@ language:
|
|
7 |
metrics:
|
8 |
- accuracy
|
9 |
pipeline_tag: text-generation
|
10 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
metrics:
|
8 |
- accuracy
|
9 |
pipeline_tag: text-generation
|
10 |
+
---
|
11 |
+
This model is Llama2-7B fine-tuned model which trained on farsi-wiki(approximately 180 milion token) and translated ALPACA dataset.
|
12 |
+
We extend tokenizer by 19954 new token with BPE algorithm running on persian dataset.
|
13 |
+
|
14 |
+
Use this code to run model on you input:
|
15 |
+
```
|
16 |
+
from transformers import AutoTokenizer, LlamaModelForCausalLM
|
17 |
+
|
18 |
+
model = LlamaModelForCausalLM.from_pretrained("mostafaamiri/persian_llama_7B_merged")
|
19 |
+
tokenizer = AutoTokenizer.from_pretrained(""mostafaamiri/persian_llama_7B_merged"")
|
20 |
+
|
21 |
+
instruction = "برای رفتن به کوهنوردی چه وسایلی را با خود ببرم؟"
|
22 |
+
prompt = [
|
23 |
+
"""Below is an instruction that describes a task.
|
24 |
+
Write a response that appropriately completes the request.\n\n
|
25 |
+
### Instruction:\n\n{instruction}\n\n\n### Response:\n\n\n"""
|
26 |
+
]
|
27 |
+
|
28 |
+
model.to("cuda")
|
29 |
+
generated_ids = model.generate(**tokenizer(prompt, return_tensors='pt').to("cuda"))
|
30 |
+
print(tokenizer.batch_decode(generated_ids)[0])
|
31 |
+
|
32 |
+
```
|
33 |
+
|
34 |
+
|