Views
No views yet

1# QLoRA config
2bnb_config = BitsAndBytesConfig(
3 load_in_4bit=True,
4 bnb_4bit_quant_type="nf4",
5 bnb_4bit_compute_dtype=torch_dtype,
6 bnb_4bit_use_double_quant=True,
7)
8
9# LoRA config
10peft_config = LoraConfig(
11 r=64,
12 lora_alpha=64,
13 lora_dropout=0.05,
14 bias="none",
15 task_type="CAUSAL_LM",
16 target_modules=['up_proj', 'down_proj', 'gate_proj', 'k_proj', 'q_proj', 'v_proj', 'o_proj']
17)
18
19# Training config
20orpo_args = ORPOConfig(
21 run_name=new_model,
22 learning_rate=2e-5,
23 lr_scheduler_type="linear",
24 max_length=2048,
25 max_prompt_length=1024,
26 max_completion_length=1024,
27 beta=0.1,
28 per_device_train_batch_size=1,
29 per_device_eval_batch_size=1,
30 gradient_accumulation_steps=8,
31 optim="paged_adamw_8bit",
32 num_train_epochs=2,
33 evaluation_strategy="steps",
34 eval_steps=0.2,
35 logging_steps=1,
36 warmup_steps=10,
37 max_grad_norm=10,
38 report_to="wandb",
39 output_dir="./results/",
40 bf16=True,
41)