Update README.md
#1
by
Kdkewu
- opened
README.md
CHANGED
@@ -1,233 +1,242 @@
|
|
1 |
-
---
|
2 |
-
base_model: meta-llama/Meta-Llama-3-8B
|
3 |
-
license: llama3
|
4 |
-
tags:
|
5 |
-
- axolotl
|
6 |
-
- generated_from_trainer
|
7 |
-
model-index:
|
8 |
-
- name: Egyptian-Arabic-Translator-Llama-3-8B
|
9 |
-
results: []
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
from
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
"""
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
"""
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
"""
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
|
213 |
-
|
214 |
-
| 0.
|
215 |
-
| 0.
|
216 |
-
| 0.
|
217 |
-
| 0.
|
218 |
-
| 0.
|
219 |
-
| 0.
|
220 |
-
| 0.
|
221 |
-
| 0.
|
222 |
-
| 0.
|
223 |
-
| 0.
|
224 |
-
| 0.
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
- Tokenizers 0.19.1
|
|
|
1 |
+
---
|
2 |
+
base_model: meta-llama/Meta-Llama-3-8B
|
3 |
+
license: llama3
|
4 |
+
tags:
|
5 |
+
- axolotl
|
6 |
+
- generated_from_trainer
|
7 |
+
model-index:
|
8 |
+
- name: Egyptian-Arabic-Translator-Llama-3-8B
|
9 |
+
results: []
|
10 |
+
datasets:
|
11 |
+
- proj-persona/PersonaHub
|
12 |
+
language:
|
13 |
+
- ar
|
14 |
+
- en
|
15 |
+
metrics:
|
16 |
+
- accuracy
|
17 |
+
library_name: adapter-transformers
|
18 |
+
pipeline_tag: text-classification
|
19 |
+
---
|
20 |
+
|
21 |
+
[<img src="https://raw.githubusercontent.com/OpenAccess-AI-Collective/axolotl/main/image/axolotl-badge-web.png" alt="Built with Axolotl" width="200" height="32"/>](https://github.com/OpenAccess-AI-Collective/axolotl)
|
22 |
+
<details><summary>See axolotl config</summary>
|
23 |
+
|
24 |
+
axolotl version: `0.4.1`
|
25 |
+
```yaml
|
26 |
+
base_model: meta-llama/Meta-Llama-3-8B
|
27 |
+
model_type: LlamaForCausalLM
|
28 |
+
tokenizer_type: AutoTokenizer
|
29 |
+
|
30 |
+
load_in_8bit: true
|
31 |
+
load_in_4bit: false
|
32 |
+
strict: false
|
33 |
+
|
34 |
+
datasets:
|
35 |
+
- path: translation-dataset-v3-train.hf
|
36 |
+
type: alpaca
|
37 |
+
train_on_split: train
|
38 |
+
|
39 |
+
test_datasets:
|
40 |
+
- path: translation-dataset-v3-test.hf
|
41 |
+
type: alpaca
|
42 |
+
split: train
|
43 |
+
|
44 |
+
dataset_prepared_path: ./last_run_prepared
|
45 |
+
output_dir: ./llama_3_translator
|
46 |
+
hub_model_id: ahmedsamirio/llama_3_translator_v3
|
47 |
+
|
48 |
+
|
49 |
+
sequence_len: 2048
|
50 |
+
sample_packing: true
|
51 |
+
pad_to_sequence_len: true
|
52 |
+
eval_sample_packing: false
|
53 |
+
|
54 |
+
adapter: lora
|
55 |
+
lora_r: 32
|
56 |
+
lora_alpha: 16
|
57 |
+
lora_dropout: 0.05
|
58 |
+
lora_target_linear: true
|
59 |
+
lora_fan_in_fan_out:
|
60 |
+
lora_target_modules:
|
61 |
+
- gate_proj
|
62 |
+
- down_proj
|
63 |
+
- up_proj
|
64 |
+
- q_proj
|
65 |
+
- v_proj
|
66 |
+
- k_proj
|
67 |
+
- o_proj
|
68 |
+
|
69 |
+
wandb_project: en_eg_translator
|
70 |
+
wandb_entity: ahmedsamirio
|
71 |
+
wandb_name: llama_3_en_eg_translator_v3
|
72 |
+
|
73 |
+
gradient_accumulation_steps: 4
|
74 |
+
micro_batch_size: 2
|
75 |
+
num_epochs: 2
|
76 |
+
optimizer: paged_adamw_32bit
|
77 |
+
lr_scheduler: cosine
|
78 |
+
learning_rate: 2e-5
|
79 |
+
|
80 |
+
train_on_inputs: false
|
81 |
+
group_by_length: false
|
82 |
+
bf16: auto
|
83 |
+
fp16:
|
84 |
+
tf32: false
|
85 |
+
|
86 |
+
gradient_checkpointing: true
|
87 |
+
early_stopping_patience:
|
88 |
+
resume_from_checkpoint:
|
89 |
+
local_rank:
|
90 |
+
logging_steps: 1
|
91 |
+
xformers_attention:
|
92 |
+
flash_attention: true
|
93 |
+
|
94 |
+
warmup_steps: 10
|
95 |
+
evals_per_epoch: 10
|
96 |
+
eval_table_size:
|
97 |
+
eval_max_new_tokens: 128
|
98 |
+
saves_per_epoch: 1
|
99 |
+
debug:
|
100 |
+
deepspeed:
|
101 |
+
weight_decay: 0.0
|
102 |
+
fsdp:
|
103 |
+
fsdp_config:
|
104 |
+
special_tokens:
|
105 |
+
pad_token: <|end_of_text|>
|
106 |
+
```
|
107 |
+
|
108 |
+
</details><br>
|
109 |
+
|
110 |
+
[<img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in Weights & Biases" width="200" height="32"/>](https://wandb.ai/ahmedsamirio/en_eg_translator/runs/hwzxxt0r)
|
111 |
+
|
112 |
+
# Egyptian Arabic Translator Llama-3 8B
|
113 |
+
|
114 |
+
This model is a fine-tuned version of [meta-llama/Meta-Llama-3-8B](https://huggingface.co/meta-llama/Meta-Llama-3-8B) on the [ahmedsamirio/oasst2-9k-translation](https://huggingface.co/datasets/ahmedsamirio/oasst2-9k-translation) dataset.
|
115 |
+
|
116 |
+
## Model description
|
117 |
+
|
118 |
+
This model is an attempt to create a small translation model from English to Egyptian Arabic.
|
119 |
+
|
120 |
+
## Intended uses & limitations
|
121 |
+
|
122 |
+
- Translating instruction finetuning and text generation datasets
|
123 |
+
|
124 |
+
## Inference code
|
125 |
+
|
126 |
+
```python
|
127 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
|
128 |
+
|
129 |
+
tokenizer = AutoTokenizer.from_pretrained("ahmedsamirio/Egyptian-Arabic-Translator-Llama-3-8B")
|
130 |
+
model = AutoModelForCausalLM.from_pretrained("ahmedsamirio/Egyptian-Arabic-Translator-Llama-3-8B")
|
131 |
+
pipe = pipeline(task='text-generation', model=model, tokenizer=tokenizer)
|
132 |
+
|
133 |
+
|
134 |
+
en_template = """<|begin_of_text|>Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
135 |
+
|
136 |
+
### Instruction:
|
137 |
+
Translate the following text to English.
|
138 |
+
|
139 |
+
### Input:
|
140 |
+
{text}
|
141 |
+
|
142 |
+
### Response:
|
143 |
+
"""
|
144 |
+
|
145 |
+
ar_template = """<|begin_of_text|>Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
146 |
+
|
147 |
+
### Instruction:
|
148 |
+
Translate the following text to Arabic.
|
149 |
+
|
150 |
+
### Input:
|
151 |
+
{text}
|
152 |
+
|
153 |
+
### Response:
|
154 |
+
"""
|
155 |
+
|
156 |
+
eg_template = """<|begin_of_text|>Below is an instruction that describes a task, paired with an input that provides further context. Write a response that appropriately completes the request.
|
157 |
+
|
158 |
+
### Instruction:
|
159 |
+
Translate the following text to Egyptian Arabic.
|
160 |
+
|
161 |
+
### Input:
|
162 |
+
{text}
|
163 |
+
|
164 |
+
### Response:
|
165 |
+
"""
|
166 |
+
|
167 |
+
text = """Some habits are known as "keystone habits," and these influence the formation of other habits. \
|
168 |
+
For example, identifying as the type of person who takes care of their body and is in the habit of exercising regularly, \
|
169 |
+
can also influence eating better and using credit cards less. In business, \
|
170 |
+
safety can be a keystone habit that influences other habits that result in greater productivity.[17]"""
|
171 |
+
|
172 |
+
ar_text = pipe(ar_template.format(text=text),
|
173 |
+
max_new_tokens=256,
|
174 |
+
do_sample=True,
|
175 |
+
temperature=0.3,
|
176 |
+
top_p=0.5)
|
177 |
+
|
178 |
+
|
179 |
+
eg_text = pipe(eg_template.format(text=ar_text),
|
180 |
+
max_new_tokens=256,
|
181 |
+
do_sample=True,
|
182 |
+
temperature=0.3,
|
183 |
+
top_p=0.5)
|
184 |
+
|
185 |
+
print("Original Text:" text)
|
186 |
+
print("\nArabic Translation:", ar_text)
|
187 |
+
print("\nEgyptian Arabic Translation:", eg_text)
|
188 |
+
```
|
189 |
+
|
190 |
+
## Training and evaluation data
|
191 |
+
|
192 |
+
[ahmedsamirio/oasst2-9k-translation](https://huggingface.co/datasets/ahmedsamirio/oasst2-9k-translation)
|
193 |
+
|
194 |
+
## Training procedure
|
195 |
+
|
196 |
+
### Training hyperparameters
|
197 |
+
|
198 |
+
The following hyperparameters were used during training:
|
199 |
+
- learning_rate: 2e-05
|
200 |
+
- train_batch_size: 2
|
201 |
+
- eval_batch_size: 2
|
202 |
+
- seed: 42
|
203 |
+
- gradient_accumulation_steps: 4
|
204 |
+
- total_train_batch_size: 8
|
205 |
+
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
206 |
+
- lr_scheduler_type: cosine
|
207 |
+
- lr_scheduler_warmup_steps: 10
|
208 |
+
- num_epochs: 2
|
209 |
+
|
210 |
+
### Training results
|
211 |
+
|
212 |
+
| Training Loss | Epoch | Step | Validation Loss |
|
213 |
+
|:-------------:|:------:|:----:|:---------------:|
|
214 |
+
| 0.9661 | 0.0008 | 1 | 1.3816 |
|
215 |
+
| 0.5611 | 0.1002 | 123 | 0.9894 |
|
216 |
+
| 0.6739 | 0.2004 | 246 | 0.8820 |
|
217 |
+
| 0.5168 | 0.3006 | 369 | 0.8229 |
|
218 |
+
| 0.5582 | 0.4008 | 492 | 0.7931 |
|
219 |
+
| 0.552 | 0.5010 | 615 | 0.7814 |
|
220 |
+
| 0.5129 | 0.6012 | 738 | 0.7591 |
|
221 |
+
| 0.5887 | 0.7014 | 861 | 0.7444 |
|
222 |
+
| 0.6359 | 0.8016 | 984 | 0.7293 |
|
223 |
+
| 0.613 | 0.9018 | 1107 | 0.7179 |
|
224 |
+
| 0.5671 | 1.0020 | 1230 | 0.7126 |
|
225 |
+
| 0.4956 | 1.0847 | 1353 | 0.7034 |
|
226 |
+
| 0.5055 | 1.1849 | 1476 | 0.6980 |
|
227 |
+
| 0.4863 | 1.2851 | 1599 | 0.6877 |
|
228 |
+
| 0.4538 | 1.3853 | 1722 | 0.6845 |
|
229 |
+
| 0.4362 | 1.4855 | 1845 | 0.6803 |
|
230 |
+
| 0.4291 | 1.5857 | 1968 | 0.6834 |
|
231 |
+
| 0.6208 | 1.6859 | 2091 | 0.6830 |
|
232 |
+
| 0.582 | 1.7862 | 2214 | 0.6781 |
|
233 |
+
| 0.5001 | 1.8864 | 2337 | 0.6798 |
|
234 |
+
|
235 |
+
|
236 |
+
### Framework versions
|
237 |
+
|
238 |
+
- PEFT 0.11.1
|
239 |
+
- Transformers 4.42.3
|
240 |
+
- Pytorch 2.1.2+cu118
|
241 |
+
- Datasets 2.19.1
|
242 |
- Tokenizers 0.19.1
|