File size: 1,654 Bytes
c764096
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
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
# DoRA Fine-tuning Config for Qwen3-4B
# Optimized for H100 80GB

# Model
base_model: Qwen/Qwen3-8B
model_type: AutoModelForCausalLM
tokenizer_type: AutoTokenizer
trust_remote_code: true

# Dataset
datasets:
  - path: output/qwen3_train_v2.jsonl
    type: chat
    split: train
  - path: output/qwen3_val_v2.jsonl
    type: chat
    split: eval

# Chat template (Qwen3 uses ChatML)
chat_template: chatml

# DoRA Configuration
adapter: dora
lora_r: 64                    # Rank - higher for more capacity
lora_alpha: 128               # Alpha = 2 * r is common
lora_dropout: 0.05
lora_target_modules:
  - q_proj
  - k_proj
  - v_proj
  - o_proj
  - gate_proj
  - up_proj
  - down_proj

# Training hyperparameters
num_epochs: 1
micro_batch_size: 64           # Per GPU batch size
gradient_accumulation_steps: 2  # Effective batch = 4 * 4 = 16
learning_rate: 0.0002
lr_scheduler: cosine
warmup_ratio: 0.05
weight_decay: 0.01
max_grad_norm: 1.0

# Optimizer
optimizer: adamw_torch_fused
adam_beta1: 0.9
adam_beta2: 0.999
adam_epsilon: 1e-8

# Precision
bf16: true
tf32: true

# Sequence length
sequence_len: 2048            # Sufficient for Q&A pairs
sample_packing: true          # Pack multiple samples per sequence
pad_to_sequence_len: false

# Evaluation
eval_steps: 500
eval_batch_size: 4
save_steps: 500
save_total_limit: 3

# Logging
logging_steps: 50
report_to: tensorboard
wandb_project: tha-fm-qwen3
wandb_run_name: dora-qwen3-4b-v1

# Output
output_dir: ./outputs/qwen3-4b-dora
hub_model_id: null            # Set to push to HuggingFace

# Performance
gradient_checkpointing: true
flash_attention: false
dataloader_num_workers: 4

# Misc
seed: 42