LLaMA-Factory
LLaMA-Factory copied to clipboard
请问baichuan-7B进行PT+SFT+RLHF的全流程微调的话,需要多少显存呢
看你用什么方法,全量微调要 80GB,LoRA 微调需要 24GB,QLoRA 最低需要 15GB,三阶段都一样。
好的,太感谢了!还想请问下微调用的数据量大概是多大的呢
PT 阶段需要 GB 量级数据,SFT 只需要几万条数据。
好的,谢谢
4090 在跑RLHF阶段的train_ppo.py时,显存不够. 请问是不是运行的时候需要加什么参数?
torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 30.00 MiB (GPU 0; 23.62 GiB total capacity; 21.75 GiB already allocated; 3.12 MiB free; 22.47 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
llama-7b运行命令:
CUDA_VISIBLE_DEVICES=0 python src/train_ppo.py \
--model_name_or_path decapoda-research/llama-7b-hf \
--do_train \
--dataset alpaca_gpt4_en \
--finetuning_type lora \
--checkpoint_dir alpaca \
--reward_model llama_comparison_gpt4_en \
--output_dir alpaca_ppo \
--per_device_train_batch_size 2 \
--gradient_accumulation_steps 4 \
--lr_scheduler_type cosine \
--logging_steps 10 \
--save_steps 1000 \
--learning_rate 1e-5 \
--num_train_epochs 1.0 \
--resume_lora_training False \
--plot_loss
baichuan-7B运行命令:
CUDA_VISIBLE_DEVICES=0 python src/train_ppo.py \
--model_name_or_path baichuan-inc/baichuan-7B \
--do_train \
--dataset alpaca_gpt4_en \
--finetuning_type lora \
--checkpoint_dir baichuan_simple_0326 \
--reward_model baichuan-7B_comparison_gpt4_en/checkpoint-1000 \
--output_dir baichuan-7B_ppo \
--lora_target W_pack \
--per_device_train_batch_size 2 \
--gradient_accumulation_steps 4 \
--lr_scheduler_type cosine \
--logging_steps 10 \
--save_steps 1000 \
--learning_rate 1e-5 \
--num_train_epochs 1.0 \
--resume_lora_training False \
--plot_loss
PT 阶段需要 GB 量级数据,SFT 只需要几万条数据。
现在是不能直接传参--finetuning_type qlora把 我看只有lora
4090 在跑RLHF阶段的train_ppo.py时,显存不够. 请问是不是运行的时候需要加什么参数?
torch.cuda.OutOfMemoryError: CUDA 内存不足。已尝试分配 30.00 MiB(GPU 0;23.62 GiB 总容量;已分配 21.75 GiB;3.12 MiB 可用;PyTorch 总共保留 22.47 GiB) 如果保留内存>>分配的内存,请尝试设置max_split_size_mb以避免碎片。请参阅有关内存管理和PYTORCH_CUDA_ALLOC_CONF的文档
llama-7b运行命令:
CUDA_VISIBLE_DEVICES=0 python src/train_ppo.py \ --model_name_or_path decapoda-research/llama-7b-hf \ --do_train \ --dataset alpaca_gpt4_en \ --finetuning_type lora \ --checkpoint_dir alpaca \ --reward_model llama_comparison_gpt4_en \ --output_dir alpaca_ppo \ --per_device_train_batch_size 2 \ --gradient_accumulation_steps 4 \ --lr_scheduler_type cosine \ --logging_steps 10 \ --save_steps 1000 \ --learning_rate 1e-5 \ --num_train_epochs 1.0 \ --resume_lora_training False \ --plot_loss
白川-7B运行命令:
CUDA_VISIBLE_DEVICES=0 python src/train_ppo.py \ --model_name_or_path baichuan-inc/baichuan-7B \ --do_train \ --dataset alpaca_gpt4_en \ --finetuning_type lora \ --checkpoint_dir baichuan_simple_0326 \ --reward_model baichuan-7B_comparison_gpt4_en/checkpoint-1000 \ --output_dir baichuan-7B_ppo \ --lora_target W_pack \ --per_device_train_batch_size 2 \ --gradient_accumulation_steps 4 \ --lr_scheduler_type cosine \ --logging_steps 10 \ --save_steps 1000 \ --learning_rate 1e-5 \ --num_train_epochs 1.0 \ --resume_lora_training False \ --plot_loss
解决了吗哥,我也是RLHF报OOM
PT 阶段需要 GB 量级数据,SFT 只需要几万条数据。
现在是不能直接传参--finetuning_type qlora把 我看只有lora
QLoRA 的使用方式是 --finetuning_type lora --quantization_bit 4
@laosuan @pythonprogrammer1998 PPO 训练时要比 SFT 更耗显存,可以通过用量化,或者减小 batch size,抑或是减小 max_source_length 和 max_target_length 来解决
全量微调要 80GB
你好,这个是不是跟精度有关系?FP16的话,至少应该是7*16=112G显存?