接着上一篇博客:在Ubuntu上用Llama Factory命令行微调Qwen2.5的简单过程_llamafactory 微调qwen 2.5-优快云博客
如果需要微调比较大的模型,例如Qwen2.5-32B,那么在两个3090上可能不够用,这里我用A6000×4的服务器。但如果仿照上篇博客,直接运行:
llamafactory-cli train examples/train_qlora/qwen_lora.yaml
那还是会报错:
torch.OutOfMemoryError: CUDA out of memory. Tried to allocate 270.00 MiB. GPU 0 has a total capacity of 47.54 GiB of which 244.94 MiB is free. Including non-PyTorch memory, this process has 47.28 GiB memory in use.
解决方法很多朋友也介绍了: