LLaMA Factory微调示例
微调qwen3-0.6b的function calling能力
# my-train.yaml
### model
model_name_or_path: Qwen/Qwen3-0.6B
trust_remote_code: true
### method
stage: sft
do_train: true
finetuning_type: lora
lora_rank: 8
lora_target: all
### dataset
dataset: glaive_toolcall_100k,glaive_toolcall_zh
template: qwen3
cutoff_len: 2048
max_samples: 100000
overwrite_cache: true
preprocessing_num_workers: 16
dataloader_num_workers: 4
### output
output_dir: saves/Qwen3-0.6B-Instruct/lora/sft
logging_steps: 10
save_steps: 500
plot_loss: true
overwrite_output_dir: true
save_only_model: false
report_to: none # choices: [none, wandb, tensorboard, swanlab, mlflow]
### train
per_device_train_batch_size: 3
gradient_accumulation_steps: 8
learning_rate: 1.0e-4
num_train_epochs: 3.0
lr_scheduler_type: cosine
warmup_ratio: 0.1
bf16: true
ddp_timeout: 180000000
resume_from_checkpoint: null
### eval
# eval_dataset: alpaca_en_demo
# val_size: 0.1
# per_device_eval_batch_size: 1
# eval_strategy: steps
# eval_steps: 500
### swanlab
use_swanlab: true
swanlab_project: llamafactory
swanlab_run_name: qwen3-0.6b-sft
swanlab_api_key: xxxxxxxxxxxx # 这里输入swanlab的api key
swanlab_mode: cloud开始
llamafactory-cli train my-train.yaml遇到的问题
训练过程中出现报错:RuntimeError: Invalid device string: '0' ,执行:uv pip install safetensors==0.5.3 ,参考 https://github.com/hiyouga/LLaMA-Factory/issues/8420
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 Ryan的折腾日记
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果