Views
No views yet
0.4.11base_model: meta-llama/Meta-Llama-3-8B
2model_type: LlamaForCausalLM
3tokenizer_type: AutoTokenizer
4
5load_in_8bit: true
6load_in_4bit: false
7strict: false
8
9datasets:
10 - path: translation-dataset-v3-train.hf
11 type: alpaca
12 train_on_split: train
13
14test_datasets:
15 - path: translation-dataset-v3-test.hf
16 type: alpaca
17 split: train
18
19dataset_prepared_path: ./last_run_prepared
20output_dir: ./llama_3_translator
21hub_model_id: ahmedsamirio/llama_3_translator_v3
22
23
24sequence_len: 2048
25sample_packing: true
26pad_to_sequence_len: true
27eval_sample_packing: false
28
29adapter: lora
30lora_r: 32
31lora_alpha: 16
32lora_dropout: 0.05
33lora_target_linear: true
34lora_fan_in_fan_out:
35lora_target_modules:
36 - gate_proj
37 - down_proj
38 - up_proj
39 - q_proj
40 - v_proj
41 - k_proj
42 - o_proj
43
44wandb_project: en_eg_translator
45wandb_entity: ahmedsamirio
46wandb_name: llama_3_en_eg_translator_v3
47
48gradient_accumulation_steps: 4
49micro_batch_size: 2
50num_epochs: 2
51optimizer: paged_adamw_32bit
52lr_scheduler: cosine
53learning_rate: 2e-5
54
55train_on_inputs: false
56group_by_length: false
57bf16: auto
58fp16:
59tf32: false
60
61gradient_checkpointing: true
62early_stopping_patience:
63resume_from_checkpoint:
64local_rank:
65logging_steps: 1
66xformers_attention:
67flash_attention: true
68
69warmup_steps: 10
70evals_per_epoch: 10
71eval_table_size:
72eval_max_new_tokens: 128
73saves_per_epoch: 1
74debug:
75deepspeed:
76weight_decay: 0.0
77fsdp:
78fsdp_config:
79special_tokens:
80 pad_token: <|end_of_text|>1from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
2
3tokenizer = AutoTokenizer.from_pretrained("ahmedsamirio/Egyptian-Arabic-Translator-Llama-3-8B")
4model = AutoModelForCausalLM.from_pretrained("ahmedsamirio/Egyptian-Arabic-Translator-Llama-3-8B")
5pipe = pipeline(task='text-generation', model=model, tokenizer=tokenizer)
6
7
8en_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.
9
10### Instruction:
11Translate the following text to English.
12
13### Input:
14{text}
15
16### Response:
17"""
18
19ar_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.
20
21### Instruction:
22Translate the following text to Arabic.
23
24### Input:
25{text}
26
27### Response:
28"""
29
30eg_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.
31
32### Instruction:
33Translate the following text to Egyptian Arabic.
34
35### Input:
36{text}
37
38### Response:
39"""
40
41text = """Some habits are known as "keystone habits," and these influence the formation of other habits. \
42For example, identifying as the type of person who takes care of their body and is in the habit of exercising regularly, \
43can also influence eating better and using credit cards less. In business, \
44safety can be a keystone habit that influences other habits that result in greater productivity.[17]"""
45
46ar_text = pipe(ar_template.format(text=text),
47 max_new_tokens=256,
48 do_sample=True,
49 temperature=0.3,
50 top_p=0.5)
51
52
53eg_text = pipe(eg_template.format(text=ar_text),
54 max_new_tokens=256,
55 do_sample=True,
56 temperature=0.3,
57 top_p=0.5)
58
59print("Original Text:" text)
60print("\nArabic Translation:", ar_text)
61print("\nEgyptian Arabic Translation:", eg_text)| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 0.9661 | 0.0008 | 1 | 1.3816 |
| 0.5611 | 0.1002 | 123 | 0.9894 |
| 0.6739 | 0.2004 | 246 | 0.8820 |
| 0.5168 | 0.3006 | 369 | 0.8229 |
| 0.5582 | 0.4008 | 492 | 0.7931 |
| 0.552 | 0.5010 | 615 | 0.7814 |
| 0.5129 | 0.6012 | 738 | 0.7591 |
| 0.5887 | 0.7014 | 861 | 0.7444 |
| 0.6359 | 0.8016 | 984 | 0.7293 |
| 0.613 | 0.9018 | 1107 | 0.7179 |
| 0.5671 | 1.0020 | 1230 | 0.7126 |
| 0.4956 | 1.0847 | 1353 | 0.7034 |
| 0.5055 | 1.1849 | 1476 | 0.6980 |
| 0.4863 | 1.2851 | 1599 | 0.6877 |
| 0.4538 | 1.3853 | 1722 | 0.6845 |
| 0.4362 | 1.4855 | 1845 | 0.6803 |
| 0.4291 | 1.5857 | 1968 | 0.6834 |
| 0.6208 | 1.6859 | 2091 | 0.6830 |
| 0.582 | 1.7862 | 2214 | 0.6781 |
| 0.5001 | 1.8864 | 2337 | 0.6798 |