-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[Question]: 张量并行推理内存占用异常? #8656
Comments
不合理,这块我们有优化代码还没有提交。想问下你是咋运行的,可以给个脚本来。 |
脚本如下:
2、test_qwen.py
|
qwen使用的模型参数是safetensors格式还是pdparams格式?如果是safetensors格式,应该不会有这个问题。 |
是pdparams格式的,这个权重是自动下载的。 |
可以在模型from_pretrained之后,调用save_pretrained方法来保存,设置safe_serialization=True。 |
我想进行tp推理,我在模型from_pretrained是否需要进行相应的tp配置,然后再调用save_pretrained方法来保存 |
请提出你的问题
我在进行qwen-1_8模型推理时:
当开启2路张量并行时,在load权重时,内存占用是10GB左右
当开启4路张量并行时,在load权重时,内存占用是17GB左右
两者的差距正好是权重文件占用空间的2倍
因此,我想问,假设是2路张量并行,paddlenlp在load权重时是否是先将权重复制2份并存放在内存,之后在进行张量拆分?如果是的话,在进行16路张量并行时,就要复制16份?假使是千亿模型,那内存的占用量必然更多,这是合理的吗?
The text was updated successfully, but these errors were encountered: