我们提供了多样化的大模型微调示例脚本。
请确保在 LLaMA-Factory
目录下执行下述命令。
使用 CUDA_VISIBLE_DEVICES
(GPU)或 ASCEND_RT_VISIBLE_DEVICES
(NPU)选择计算设备。
llamafactory-cli train examples/train_lora/llama3_lora_pretrain.yaml
llamafactory-cli train examples/train_lora/llama3_lora_sft.yaml
llamafactory-cli train examples/train_lora/llava1_5_lora_sft.yaml
llamafactory-cli train examples/train_lora/llama3_lora_reward.yaml
llamafactory-cli train examples/train_lora/llama3_lora_ppo.yaml
llamafactory-cli train examples/train_lora/llama3_lora_dpo.yaml
llamafactory-cli train examples/train_lora/llama3_lora_kto.yaml
对于大数据集有帮助,在配置中使用 tokenized_path
以加载预处理后的数据集。
llamafactory-cli train examples/train_lora/llama3_preprocess.yaml
llamafactory-cli eval examples/train_lora/llama3_lora_eval.yaml
llamafactory-cli train examples/train_lora/llama3_lora_predict.yaml
FORCE_TORCHRUN=1 NNODES=2 RANK=0 MASTER_ADDR=192.168.0.1 MASTER_PORT=29500 llamafactory-cli train examples/train_lora/llama3_lora_sft.yaml
FORCE_TORCHRUN=1 NNODES=2 RANK=1 MASTER_ADDR=192.168.0.1 MASTER_PORT=29500 llamafactory-cli train examples/train_lora/llama3_lora_sft.yaml
FORCE_TORCHRUN=1 llamafactory-cli train examples/train_lora/llama3_lora_sft_ds3.yaml
llamafactory-cli train examples/train_qlora/llama3_lora_sft_bitsandbytes.yaml
llamafactory-cli train examples/train_qlora/llama3_lora_sft_gptq.yaml
llamafactory-cli train examples/train_qlora/llama3_lora_sft_awq.yaml
llamafactory-cli train examples/train_qlora/llama3_lora_sft_aqlm.yaml
FORCE_TORCHRUN=1 llamafactory-cli train examples/train_full/llama3_full_sft_ds3.yaml
FORCE_TORCHRUN=1 NNODES=2 RANK=0 MASTER_ADDR=192.168.0.1 MASTER_PORT=29500 llamafactory-cli train examples/train_full/llama3_full_sft_ds3.yaml
FORCE_TORCHRUN=1 NNODES=2 RANK=1 MASTER_ADDR=192.168.0.1 MASTER_PORT=29500 llamafactory-cli train examples/train_full/llama3_full_sft_ds3.yaml
llamafactory-cli train examples/train_full/llama3_full_predict.yaml
注:请勿使用量化后的模型或 quantization_bit
参数来合并 LoRA 适配器。
llamafactory-cli export examples/merge_lora/llama3_lora_sft.yaml
llamafactory-cli export examples/merge_lora/llama3_gptq.yaml
llamafactory-cli chat examples/inference/llama3_lora_sft.yaml
llamafactory-cli webchat examples/inference/llama3_lora_sft.yaml
llamafactory-cli api examples/inference/llama3_lora_sft.yaml
llamafactory-cli train examples/extras/galore/llama3_full_sft.yaml
llamafactory-cli train examples/extras/badam/llama3_full_sft.yaml
llamafactory-cli train examples/extras/loraplus/llama3_lora_sft.yaml
llamafactory-cli train examples/extras/pissa/llama3_lora_sft.yaml
llamafactory-cli train examples/extras/mod/llama3_full_sft.yaml
bash examples/extras/llama_pro/expand.sh
llamafactory-cli train examples/extras/llama_pro/llama3_freeze_sft.yaml
bash examples/extras/fsdp_qlora/train.sh