-
Notifications
You must be signed in to change notification settings - Fork 436
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
本地推理和用提供的demo推理结果不一致 #190
Comments
本地效果怎么演示? |
这个bug很多人都遇到了,我暂时没想到比较好的方法能够适配所有情况,有个方案可以解决,需要手工为模型分配设备。 比如这个模型总共26B,2张卡最理想的情况是每张卡13B。因此,除去ViT的6B以外,卡0还需要放7B,也就是20B的LLM有1/3在卡0,有2/3在卡1。 写成代码就是: device_map = {
'vision_model': 0,
'mlp1': 0,
'language_model.model.tok_embeddings': 0,
'language_model.model.norm': 1,
'language_model.output.weight': 1
}
for i in range(16):
device_map[f'language_model.model.layers.{i}'] = 0
for i in range(16, 48):
device_map[f'language_model.model.layers.{i}'] = 1
print(device_map)
model = AutoModel.from_pretrained(
path,
torch_dtype=torch.bfloat16,
low_cpu_mem_usage=True,
trust_remote_code=True,
device_map=device_map
).eval() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
本地推理和提供的demo结果不一致是为什么呢,请问demo具体的参数设置是什么呢
The text was updated successfully, but these errors were encountered: