Views
No views yet
0.4.11base_model: mistralai/Mistral-7B-v0.1
2model_type: MistralForCausalLM
3tokenizer_type: LlamaTokenizer
4is_mistral_derived_model: true
5
6load_in_8bit: false
7load_in_4bit: true
8strict: false
9
10lora_fan_in_fan_out: false
11data_seed: 49
12seed: 49
13
14datasets:
15 - path: NimaZahedinameghi/source_injury
16 type: alpaca
17
18dataset_prepared_path: last_run_prepared
19val_set_size: 0.1
20output_dir: ./qlora-alpaca-out
21hub_model_id: NimaZahedinameghi/source_of_injury
22
23adapter: qlora
24lora_model_dir:
25
26sequence_len: 896
27sample_packing: false
28pad_to_sequence_len: true
29
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: source_of_injury
45wandb_entity: uqam
46
47gradient_accumulation_steps: 4
48micro_batch_size: 16
49eval_batch_size: 16
50num_epochs: 3
51optimizer: adamw_bnb_8bit
52lr_scheduler: cosine
53learning_rate: 0.0002
54max_grad_norm: 1.0
55adam_beta2: 0.95
56adam_epsilon: 0.00001
57save_total_limit: 12
58
59train_on_inputs: false
60group_by_length: false
61bf16: true
62fp16: false
63tf32: false
64
65gradient_checkpointing: true
66early_stopping_patience:
67resume_from_checkpoint:
68local_rank:
69logging_steps: 1
70xformers_attention:
71flash_attention: true
72
73loss_watchdog_threshold: 5.0
74loss_watchdog_patience: 3
75
76warmup_steps: 20
77evals_per_epoch: 4
78eval_table_size:
79eval_table_max_new_tokens: 128
80saves_per_epoch: 6
81debug:
82weight_decay: 0.0
83fsdp:
84fsdp_config:
85special_tokens:
86 bos_token: "<s>"
87 eos_token: "</s>"
88 unk_token: "<unk>"
89save_safetensors: true1transformers==4.36.2
2datasets==2.15.0
3peft==0.6.0
4accelerate==0.24.1
5bitsandbytes==0.41.3.post2
6safetensors==0.4.1
7scipy==1.11.4
8sentencepiece==0.1.99
9protobuf==4.23.4 --upgrade1from peft import AutoPeftModelForCausalLM
2from transformers import AutoTokenizer
3
4model_id = 'NimaZahedinameghi/source_of_injury'
5model = AutoPeftModelForCausalLM.from_pretrained(model_id).cuda()
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7tokenizer.pad_token = tokenizer.eos_token1def prompt(incident_description):
2 return f"""[INST] <<SYS>>
3 The claims are managed by reviewing incident descriptions submitted by workers. Claim coders review the incident description and populate a database with reasoning towards determining the source of injury (InjurySource).
4 <</SYS>>
5
6 IncidentDescription: {incident_description}
7 [/INST]
8 """
9
10def prompt_tok(incident_description):
11 _p = prompt(incident_description)
12 input_ids = tokenizer(_p, return_tensors="pt", truncation=True).input_ids.cuda()
13 out_ids = model.generate(input_ids=input_ids, max_new_tokens=500, do_sample=False)
14 return tokenizer.batch_decode(out_ids.detach().cpu().numpy(), skip_special_tokens=True)[0][len(_p):]1incident_description = "While working on a vehicle repair, I had to contort my body to access hard-to-reach areas. This position caused severe discomfort and pain in my neck and shoulders."
2output = prompt_tok(incident_description)
3print(output)| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 2.0189 | 0.1481 | 1 | 2.0511 |
| 2.0285 | 0.2963 | 2 | 2.0442 |
| 1.9559 | 0.5926 | 4 | 1.9259 |
| 1.802 | 0.8889 | 6 | 1.6212 |
| 1.4115 | 1.1852 | 8 | 1.2261 |
| 1.1171 | 1.4815 | 10 | 1.0004 |
| 0.9691 | 1.7778 | 12 | 0.8657 |
| 0.747 | 2.0741 | 14 | 0.7082 |
| 0.6407 | 2.3704 | 16 | 0.6205 |
| 0.6101 | 2.6667 | 18 | 0.5867 |