puzzled-neuron's picture
Upload folder using huggingface_hub
58f007a verified
Raw History Blame Contribute Delete
1.65 kB
# 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.jsonl
type: chat
split: train
- path: output/qwen3_val.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: 3
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