【分享】Llama-factory使用甄嬛传数据集微调 #122
Labels
No Label
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: HswOAuth/llm_course#122
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
一、准备工作
Llama-factory安装(省略)
模型:LLaMA3-8B (在魔塔社区下载)
数据集下载地址:
https://github.com/datawhalechina/self-llm/blob/master/dataset/huanhuan.json
二、使用命令行直接开始训练
Llama-factory训练命令及参数设置如下:
‘’‘
CUDA_VISIBLE_DEVICES=0 llamafactory-cli train
--stage sft
--do_train True
--model_name_or_path /home/liuyang/.cache/modelscope/hub/LLM-Research/Meta-Llama-3-8B-Instruct/
--adapter_name_or_path saves/LLaMA3-8B/lora/llama3_2024-05-23-11-02-02
--preprocessing_num_workers 16
--finetuning_type lora
--quantization_bit 4
--template llama3
--flash_attn auto
--dataset_dir data
--dataset huanhuan_zh
--cutoff_len 1024
--learning_rate 0.0001
--num_train_epochs 3.0
--max_samples 100000
--per_device_train_batch_size 4
--gradient_accumulation_steps 4
--lr_scheduler_type cosine
--max_grad_norm 1.0
--logging_steps 10
--save_steps 100
--warmup_steps 0
--optim adamw_torch
--packing False
--report_to none
--output_dir saves/LLaMA3-8B/lora/llama3_2024-05-23-11-02-02
--fp16 True
--plot_loss True
--lora_rank 8
--lora_alpha 32
--lora_dropout 0.1
--use_dora True
--lora_target all
’‘’
三、效果
收敛情况:

对话测试:

(收敛情况不是特别好,好在功能要求不高对话效果还可以)