Closed surviveMiao closed 11 months ago
抱歉,我们的脚本暂时不支持多卡微调,如果您有多卡微调的需求的话,您可以看看另一个优秀的大模型微调项目:LLaMA-Factory
很高兴收到您的回复,我可以进行单卡微调, 但是我运行咱们的脚本时它自动使用的是多卡,如果我是用单卡的话,应该怎么修改脚本?
嗯,是这样的。由于我们的脚本只在单卡的机器上测试过,所以您可以尝试把fine_tune/lora
目录下的train.py
中第
208和213行中的device_map="auto"
修改为device_map="cuda:0"
或device_map="cuda:7"
(这个修改时根据您的报错而修改的,您可以选择现存最大的那张卡)。具体需要修改的代码位置如下图所示:
希望能对您有帮助~
谢谢谢谢! 我晓得了。 还有一个问题就是 我昨天使用咱们项目下huanhuan数据集使用pt2的方法对官方Chatglm2-6b模型进行训练,使用的代码是Chatglm2官方微调的代码, 经过我微调后,我问模型“你是谁”类似的问题,模型不不知道它叫“嬛嬛”,这个问题是因为我是用的训练方式是pt2的原因吗? 很期待您的解答。谢谢
由于微调方法不同,模型展现出来的效果也会有差异,对于不同的问题也是这样的。角色对话类微调在我们尝试过很多种微调方法之后,确定lora是最适合的。希望这个回答可以帮到您~
如果有更多的问题想要交流的话,可以看我的github主页的联系方式。(加微信也可以,需要通过邮箱添加)
谢谢!非常感谢您的回答。我已向您发送邮件,添加您为好友。万般感谢!
model = AutoModel.from_pretrained(
finetune_args.model_path, load_in_8bit=False, trust_remote_code=True
)
model = model.to("cuda:0")
可以改成这样,选择特定显卡,或者使用export CUDA_VISIBLE_DEVICES=0
model = AutoModel.from_pretrained( finetune_args.model_path, load_in_8bit=False, trust_remote_code=True ) model = model.to("cuda:0")
可以改成这样,选择特定显卡,或者使用export CUDA_VISIBLE_DEVICES=0
好的,谢谢您的回复!
使用多卡微调时,提示数据不在同一张显卡上,报错: RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:7 and cuda:0! (when checking argument for argument target in method wrapper_CUDA_nll_loss_forward)