Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

模型并行的方式进行lora方式的finetuning要怎么设置呢 #130

Open
kunden0612 opened this issue Aug 22, 2023 · 5 comments
Open

Comments

@kunden0612
Copy link

我设置会出现mp_size=2以后进行lora训练,会出现维度不匹配的问题

@1049451037
Copy link
Member

如果是VisualGLM的话,可以参考这个issue:THUDM/VisualGLM-6B#209 (comment)

模型并行里使用lora需要构建好模型以后再model.add_mixin(lora)

@kunden0612
Copy link
Author

如果是VisualGLM的话,可以参考这个issue:THUDM/VisualGLM-6B#209 (comment)

模型并行里使用lora需要构建好模型以后再model.add_mixin(lora)

我这边微调的是GLM-10B-zh,参考这个方式,还是出现一些新的问题,如果使用model, args = FineTuneGLMModel.from_pretrained("glm-large-zh", args=args, overwrite_args={'model_parallel_size':2}),则会出现ValueError: model_parallel_size is inconsistent with prior configuration.We currently do not support changing model_parallel_size.这个问题,在去除overwrite_args={'model_parallel_size':2},和调整layer_range则还是有原来维度的问题

@1049451037
Copy link
Member

1049451037 commented Aug 22, 2023

需要在训练脚本里设置--model-parallel-size 2这个参数,否则size就会和overwrite里的不一致

@kunden0612
Copy link
Author

需要在训练脚本里设置--model-parallel-size 2这个参数,否则size就会和overwrite里的不一致

非常感谢您的耐心解答,我这边已经能够调通了!

@kunden0612
Copy link
Author

还有一个问题就是会出现if not (attention_mask.shape[-2] == 1 and (attention_mask > 0).all()): IndexError: tuple index out of range的问题,看了一下我的模型输入的attention_mask的维度是torch.Size([2, 1, 520, 520]),但是在transformer_defaults.py的29行前输出attention_mask的维度时,首先是torch.Size([2, 1, 520, 520]),后面却是torch.Size([540800])了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants