amirMohammadi
commited on
Commit
•
fd50dea
1
Parent(s):
7c4241b
Update README.md
Browse files
README.md
CHANGED
@@ -6,4 +6,204 @@ language:
|
|
6 |
pipeline_tag: text-generation
|
7 |
tags:
|
8 |
- PartAI
|
9 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
pipeline_tag: text-generation
|
7 |
tags:
|
8 |
- PartAI
|
9 |
+
---
|
10 |
+
|
11 |
+
---
|
12 |
+
library_name: transformers
|
13 |
+
license: llama3
|
14 |
+
language:
|
15 |
+
- en
|
16 |
+
- fa
|
17 |
+
tags:
|
18 |
+
- LLM
|
19 |
+
- llama-3
|
20 |
+
- PartAI
|
21 |
+
- conversational
|
22 |
+
---
|
23 |
+
|
24 |
+
# Model Details
|
25 |
+
|
26 |
+
The Dorna models are a family of decoder-only models, specifically trained/fine-tuned on Persian data, developed by [Part AI](https://partdp.ai/). As an initial release, an 8B instruct model from this family is being made available.
|
27 |
+
Dorna-Llama3-8B-Instruct is built using the [Meta Llama 3 Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct) model.
|
28 |
+
|
29 |
+
|
30 |
+
## How to use
|
31 |
+
|
32 |
+
To test and use model freely on Hugging Face Spaces click [here](https://huggingface.co/spaces/PartAI/Dorna-Llama3-8B-Instruct)!
|
33 |
+
|
34 |
+
You can also run conversational inference using the Transformers Auto classes with the `generate()` function. Let's look at an example.
|
35 |
+
|
36 |
+
```Python
|
37 |
+
import torch
|
38 |
+
import transformers
|
39 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
40 |
+
|
41 |
+
|
42 |
+
tokenizer = AutoTokenizer.from_pretrained(model_path)
|
43 |
+
model = AutoModelForCausalLM.from_pretrained(
|
44 |
+
model_path,
|
45 |
+
torch_dtype=torch.bfloat16,
|
46 |
+
device_map="auto",
|
47 |
+
)
|
48 |
+
|
49 |
+
messages = [
|
50 |
+
{"role": "system",
|
51 |
+
"content": "You are a helpful Persian assistant. Please answer questions in the asked language."},
|
52 |
+
{"role": "user", "content": "کاغذ A4 بزرگ تر است یا A5؟"},
|
53 |
+
]
|
54 |
+
|
55 |
+
input_ids = tokenizer.apply_chat_template(
|
56 |
+
messages,
|
57 |
+
add_generation_prompt=True,
|
58 |
+
return_tensors="pt"
|
59 |
+
).to(model.device)
|
60 |
+
|
61 |
+
terminators = [
|
62 |
+
tokenizer.eos_token_id,
|
63 |
+
tokenizer.convert_tokens_to_ids("<|eot_id|>")
|
64 |
+
]
|
65 |
+
|
66 |
+
outputs = model.generate(
|
67 |
+
input_ids,
|
68 |
+
max_new_tokens=256,
|
69 |
+
eos_token_id=terminators,
|
70 |
+
do_sample=True,
|
71 |
+
temperature=0.6,
|
72 |
+
top_p=0.9,
|
73 |
+
)
|
74 |
+
response = outputs[0][input_ids.shape[-1]:]
|
75 |
+
print(tokenizer.decode(response, skip_special_tokens=True))
|
76 |
+
```
|
77 |
+
|
78 |
+
You can also use the notebook below to test the model in Google Colab.
|
79 |
+
|
80 |
+
<a href="https://colab.research.google.com/drive/1TmeZsN4Byi1EgAEQeOt27sPrZOWn5gBH?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Colab Code" width="87" height="15"/></a>
|
81 |
+
|
82 |
+
|
83 |
+
## Evaluation
|
84 |
+
|
85 |
+
This model is evaluated on questions across various tasks, including Boolean Questions, Code Generation, Long Response, Math, News QA, Paraphrasing, General Knowledge, and Summarization. Most categories typically have two main difficulty levels: Hard and Easy.
|
86 |
+
|
87 |
+
Both human evaluation and automatic evaluation (with GPT-4 as the judge) are performed.
|
88 |
+
|
89 |
+
In both tables, **Dorna-8B-it** is used as an abbreviated form of **Dorna-Llama3-8B-Instruct**.
|
90 |
+
|
91 |
+
Overall human evaluation results are as follows:
|
92 |
+
|
93 |
+
|
94 |
+
|**Model Pairs** | **Parameters** |**Win %**|**Lose %**|**Tie %**|
|
95 |
+
|--------------------------|:---------:|:---------:|:---------:|:---------:|
|
96 |
+
| Dorna-8B-it **vs.** Meta-Llama-3-8B-Instruct | 8B |**36.94**| 17.39 | 45.67 |
|
97 |
+
| Dorna-8B-it **vs.** GPT 3.5 turbo-1106 | N.A. |**32.01**| 26.94 | 41.05 |
|
98 |
+
| Dorna-8B-it **vs.** Persian Mind | 7B |**55.77**| 10.49 | 33.74 |
|
99 |
+
|
100 |
+
|
101 |
+
Category-based human evaluation results are as follows:
|
102 |
+
|
103 |
+
Win/Lose/Tie % is reported for each category.
|
104 |
+
|
105 |
+
<!-- | **Model Pairs** | **Parameters** | **Bool Complex** | **Bool Easy** | **Code Gen** | **General Long Response** | **Historical Long Response** | **Math Complex** | **Math Easy** | **News QA Complex** | **News QA Easy** | **Paraphrasing** | **General Knowledge Easy** | **General Knowledge Hard** | **Summarization** |
|
106 |
+
|:----------------------------------------------|:------------:|:----------------:|:----------------:|:-------------:|:-----------------------:|:--------------------------:|:----------------:|:----------------:|:-----------------:|:----------------:|:---------------:|:------------------------:|:------------------------:|:---------------:|
|
107 |
+
| Dorna-8B-it **vs.** Meta-Llama-3-8B-Instruct | 8B | 0.25/0.25/0.5 | 0.28/0.35/0.38 | 0.6/0.1/0.3 | 0.8/0.08/0.12 | 0.4/0.3/0.3 | 0.28/0.08/0.65 | 0.47/0.00/0.53 | 0.55/0.07/0.38 | 0.43/0.15/0.42 | 0.1/0.05/0.85 | 0.31/0.2/0.49 | 0.59/0.13/0.28 | 0.28/0.2/0.53 |
|
108 |
+
| Dorna-8B-it **vs.** GPT 3.5 turbo-1106 | N.A. | 0.35/0.35/0.3 | 0.3/0.3/0.4 | 0.1/0.3/.06 | 0.2/0.45/0.35 | 0.46/0.27/0.27 | 0.25/0.1/0.65 | 0.05/0.1/0.85 | 0.12/0.35/0.53 | 0.15/0.1/0.75 | 0.25/0.15/0.6 | 0.3/0.32/0.38 | 0.22/0.53/0.25 | 0.35/0.55/0.1 |
|
109 |
+
| Dorna-8B-it **vs.** Persian Mind | 7B | 0.47/0.25/0.28 | 0.57/0.15/0.28 | 0.9/0.1/0.0 | 0.82/0.08/0.1 | 0.4/0.17/0.42 | 0.3/0.0/0.7 | 0.22/0.08/0.7 | 0.72/0.07/0.2 | 0.7/0.0/0.3 | 0.7/0.05/0.25 | 0.51/0.12/0.37 | 0.61/0.1/0.29 | 0.93/0.0/0.07 |
|
110 |
+
-->
|
111 |
+
|
112 |
+
<div style="overflow-x: auto;">
|
113 |
+
<table>
|
114 |
+
<thead>
|
115 |
+
<tr style="vertical-align: middle;">
|
116 |
+
<th style="white-space: nowrap; vertical-align: middle;"><strong>Model Pairs</strong></th>
|
117 |
+
<th style="white-space: nowrap; vertical-align: middle;"><strong>Parameters</strong></th>
|
118 |
+
<th style="white-space: nowrap; vertical-align: middle;"><strong>Bool Complex</strong></th>
|
119 |
+
<th style="white-space: nowrap; vertical-align: middle;"><strong>Bool Easy</strong></th>
|
120 |
+
<th style="white-space: nowrap; vertical-align: middle;"><strong>Code Gen</strong></th>
|
121 |
+
<th style="white-space: nowrap; vertical-align: middle;"><strong>General Long Response</strong></th>
|
122 |
+
<th style="white-space: nowrap; vertical-align: middle;"><strong>Historical Long Response</strong></th>
|
123 |
+
<th style="white-space: nowrap; vertical-align: middle;"><strong>Math Complex</strong></th>
|
124 |
+
<th style="white-space: nowrap; vertical-align: middle;"><strong>Math Easy</strong></th>
|
125 |
+
<th style="white-space: nowrap; vertical-align: middle;"><strong>News QA Complex</strong></th>
|
126 |
+
<th style="white-space: nowrap; vertical-align: middle;"><strong>News QA Easy</strong></th>
|
127 |
+
<th style="white-space: nowrap; vertical-align: middle;"><strong>Paraphrasing</strong></th>
|
128 |
+
<th style="white-space: nowrap; vertical-align: middle;"><strong>General Knowledge Easy</strong></th>
|
129 |
+
<th style="white-space: nowrap; vertical-align: middle;"><strong>General Knowledge Hard</strong></th>
|
130 |
+
<th style="white-space: nowrap; vertical-align: middle;"><strong>Summarization</strong></th>
|
131 |
+
</tr>
|
132 |
+
</thead>
|
133 |
+
<tbody>
|
134 |
+
<tr>
|
135 |
+
<td style="white-space: nowrap; vertical-align: middle;">Dorna-8B-it <strong>vs.</strong> Meta-Llama-3-8B-Instruct</td>
|
136 |
+
<td>8B</td>
|
137 |
+
<td>0.25/0.25/0.5</td>
|
138 |
+
<td>0.28/<strong>0.35</strong>/0.38</td>
|
139 |
+
<td><strong>0.6</strong>/0.1/0.3</td>
|
140 |
+
<td><strong>0.8</strong>/0.08/0.12</td>
|
141 |
+
<td><strong>0.4</strong>/0.3/0.3</td>
|
142 |
+
<td><strong>0.28</strong>/0.08/0.65</td>
|
143 |
+
<td><strong>0.47</strong>/0.00/0.53</td>
|
144 |
+
<td><strong>0.55</strong>/0.07/0.38</td>
|
145 |
+
<td><strong>0.43</strong>/0.15/0.42</td>
|
146 |
+
<td><strong>0.1</strong>/0.05/0.85</td>
|
147 |
+
<td><strong>0.31</strong>/0.2/0.49</td>
|
148 |
+
<td><strong>0.59</strong>/0.13/0.28</td>
|
149 |
+
<td><strong>0.28</strong>/0.2/0.53</td>
|
150 |
+
</tr>
|
151 |
+
<tr>
|
152 |
+
<td style="white-space: nowrap; vertical-align: middle;">Dorna-8B-it <strong>vs.</strong> GPT 3.5 turbo-1106</td>
|
153 |
+
<td>N.A.</td>
|
154 |
+
<td>0.35/0.35/0.3</td>
|
155 |
+
<td>0.3/0.3/0.4</td>
|
156 |
+
<td>0.1/<strong>0.3</strong>/.06</td>
|
157 |
+
<td>0.2/<strong>0.45</strong>/0.35</td>
|
158 |
+
<td><strong>0.46</strong>/0.27/0.27</td>
|
159 |
+
<td><strong>0.25</strong>/0.1/0.65</td>
|
160 |
+
<td>0.05/<strong>0.1</strong>/0.85</td>
|
161 |
+
<td>0.12/<strong>0.35</strong>/0.53</td>
|
162 |
+
<td><strong>0.15</strong>/0.1/0.75</td>
|
163 |
+
<td><strong>0.25</strong>/0.15/0.6</td>
|
164 |
+
<td>0.3/<strong>0.32</strong>/0.38</td>
|
165 |
+
<td>0.22/<strong>0.53</strong>/0.25</td>
|
166 |
+
<td>0.35/<strong>0.55</strong>/0.1</td>
|
167 |
+
</tr>
|
168 |
+
<tr>
|
169 |
+
<td style="white-space: nowrap; vertical-align: middle;">Dorna-8B-it <strong>vs.</strong> Persian Mind</td>
|
170 |
+
<td>7B</td>
|
171 |
+
<td><strong>0.47</strong>/0.25/0.28</td>
|
172 |
+
<td><strong>0.57</strong>/0.15/0.28</td>
|
173 |
+
<td><strong>0.9</strong>/0.1/0.0</td>
|
174 |
+
<td><strong>0.82</strong>/0.08/0.1</td>
|
175 |
+
<td><strong>0.4</strong>/0.17/0.42</td>
|
176 |
+
<td><strong>0.3</strong>/0.0/0.7</td>
|
177 |
+
<td><strong>0.22</strong>/0.08/0.7</td>
|
178 |
+
<td><strong>0.72</strong>/0.07/0.2</td>
|
179 |
+
<td><strong>0.7</strong>/0.0/0.3</td>
|
180 |
+
<td><strong>0.7</strong>/0.05/0.25</td>
|
181 |
+
<td><strong>0.51</strong>/0.12/0.37</td>
|
182 |
+
<td><strong>0.61</strong>/0.1/0.29</td>
|
183 |
+
<td><strong>0.93</strong>/0.0/0.07</td>
|
184 |
+
</tr>
|
185 |
+
</tbody>
|
186 |
+
</table>
|
187 |
+
</div>
|
188 |
+
|
189 |
+
|
190 |
+
|
191 |
+
Automatic evaluation results are as follows:
|
192 |
+
|
193 |
+
|
194 |
+
| **Model Pairs** | **Parameters** | **Overall Win Rate %** | **Easy Win Rate %** | **Hard Win Rate %** |
|
195 |
+
|----------------------------------------|:--------------:|:----------------------:|:-------------------:|:-------------------:|
|
196 |
+
| Dorna-8B-it **vs.** Llama 3 base | 8B | **58.96** | **56.00** | **64.49** |
|
197 |
+
| Dorna-8B-it **vs.** Part Mistral | 7B | **77.20** | **73.00** | **85.05** |
|
198 |
+
| Dorna-8B-it **vs.** Persian Mind | 7B | **90.88** | **87.50** | **97.20** |
|
199 |
+
| Dorna-8B-it **vs.** Neuraorca Gemma 7b | 7B | **86.32** | **86.50** | **85.98** |
|
200 |
+
| Dorna-8B-it **vs.** Maral 7b | 7B | **97.39** | **97.00** | **98.13** |
|
201 |
+
| Dorna-8B-it **vs.** PersianLlama 7b | 7B | **98.70** | **98.00** | **100.00** |
|
202 |
+
| Dorna-8B-it **vs.** Aya-23-8B | 8B | **52.77** | **56.50** | 45.79 |
|
203 |
+
| Dorna-8B-it **vs.** Aya-23-35B | 35B | 45.93 | **54.00** | 30.84 |
|
204 |
+
| Dorna-8B-it **vs.** Command R | 35B | **58.63** | **61.00** | **54.21** |
|
205 |
+
|
206 |
+
|
207 |
+
## Contact us
|
208 |
+
|
209 |
+
If you have any questions regarding this model, you can reach us via the [community](https://huggingface.co/PartAI/Dorna-Llama3-8B-Instruct/discussions) on Hugging Face.
|