Views
No views yet
0.4.01base_model: NousResearch/Meta-Llama-3-8B
2
3load_in_8bit: false
4load_in_4bit: false
5strict: false
6
7datasets:
8 - path: semeval2014_train.jsonl
9 ds_type: json
10 type:
11 # JSONL file contains instruction, input, output fields per line.
12 # This gets mapped to the equivalent axolotl tags.
13 field_instruction: instruction
14 field_input: input
15 field_output: output
16 # Format is used by axolotl to generate the prompt.
17 format: |-
18 [INST] {input} [/INST]
19
20tokens: # add new control tokens from the dataset to the model
21 - "[INST]"
22 - "[/INST]"
23
24dataset_prepared_path:
25val_set_size: 0.05
26output_dir: ./lora-out
27
28sequence_len: 4096
29sample_packing: false
30eval_sample_packing: false
31pad_to_sequence_len: false
32
33adapter: lora
34lora_model_dir:
35lora_r: 16
36lora_alpha: 32
37lora_dropout: 0.05
38lora_target_linear: true
39lora_fan_in_fan_out:
40lora_modules_to_save: # required when adding new tokens to LLaMA/Mistral
41 - embed_tokens
42 - lm_head
43
44wandb_project: absa-semeval2014
45wandb_entity: psimm
46wandb_log_model:
47wandb_name: llama-3-8B-semeval2014
48
49hub_model_id: psimm/llama-3-8B-semeval2014
50
51gradient_accumulation_steps: 1
52micro_batch_size: 32
53num_epochs: 4
54optimizer: adamw_torch
55lr_scheduler: cosine
56learning_rate: 0.0001
57
58train_on_inputs: false
59group_by_length: false
60bf16: true
61fp16: false
62tf32: false
63
64gradient_checkpointing: true
65early_stopping_patience:
66resume_from_checkpoint:
67local_rank:
68logging_steps: 1
69xformers_attention:
70flash_attention: true
71
72warmup_steps: 10
73eval_steps: 0.05
74eval_table_size:
75eval_table_max_new_tokens: 128
76save_steps:
77debug:
78deepspeed:
79weight_decay: 0.0
80fsdp:
81fsdp_config:
82special_tokens:
83 pad_token: <|end_of_text|>
841from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4extra_tokens = ["[INST]", "[/INST]"]
5base_model = "NousResearch/Meta-Llama-3-8B"
6
7base_model = AutoModelForCausalLM.from_pretrained("NousResearch/Meta-Llama-3-8B")
8base_model.resize_token_embeddings(base_model.config.vocab_size + len(extra_tokens))
9
10tokenizer = AutoTokenizer.from_pretrained("NousResearch/Meta-Llama-3-8B")
11
12tokenizer.add_special_tokens({"additional_special_tokens": extra_tokens})
13
14model = PeftModel.from_pretrained(base_model, "psimm/llama-3-8B-semeval2014")
15
16input_text = "[INST]The food was tasty[/INST]"
17input_ids = tokenizer(input_text, return_tensors="pt").input_ids
18
19gen_tokens = model.generate(
20 input_ids,
21 max_length=256,
22 temperature=0.01,
23)
24
25# Remove the input tokens
26output_tokens = gen_tokens[:, input_ids.shape[1] :]
27
28print(tokenizer.batch_decode(output_tokens, skip_special_tokens=True))| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 2.5408 | 0.0112 | 1 | 2.2742 |
| 0.1159 | 0.2022 | 18 | 0.1026 |
| 0.1028 | 0.4045 | 36 | 0.0762 |
| 0.0813 | 0.6067 | 54 | 0.0709 |
| 0.0908 | 0.8090 | 72 | 0.0665 |
| 0.0431 | 1.0112 | 90 | 0.0639 |
| 0.0275 | 1.2135 | 108 | 0.0663 |
| 0.0224 | 1.4157 | 126 | 0.0659 |
| 0.0349 | 1.6180 | 144 | 0.0637 |
| 0.0281 | 1.8202 | 162 | 0.0589 |
| 0.0125 | 2.0225 | 180 | 0.0592 |
| 0.0088 | 2.2247 | 198 | 0.0682 |
| 0.0076 | 2.4270 | 216 | 0.0666 |
| 0.01 | 2.6292 | 234 | 0.0654 |
| 0.0131 | 2.8315 | 252 | 0.0704 |
| 0.0075 | 3.0337 | 270 | 0.0679 |
| 0.002 | 3.2360 | 288 | 0.0688 |
| 0.0029 | 3.4382 | 306 | 0.0692 |
| 0.0009 | 3.6404 | 324 | 0.0694 |
| 0.0064 | 3.8427 | 342 | 0.0695 |