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

使用昇腾910进行ChatGLM单机多卡推理报错 #7

Open
BellMeng opened this issue Feb 21, 2024 · 0 comments
Open

使用昇腾910进行ChatGLM单机多卡推理报错 #7

BellMeng opened this issue Feb 21, 2024 · 0 comments

Comments

@BellMeng
Copy link

BellMeng commented Feb 21, 2024

使用PyTorch/built-in/foundation/ChatGLM-6B/utils.py中的样例执行
发生异常: TypeError (note: full exception trace is shown but execution is paused at: _run_module_as_main)
new() received an invalid combination of arguments - got (Tensor, requires_grad=bool), but expected one of:

  • (*, torch.device device)
    didn't match because some of the keywords were incorrect: requires_grad
  • (torch.Storage storage)
  • (Tensor other)
  • (tuple of ints size, *, torch.device device)
  • (object data, *, torch.device device)
    File "/home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib/python3.9/site-packages/accelerate/utils/modeling.py", line 368, in set_module_tensor_to_device
    new_value = param_cls(new_value, requires_grad=old_value.requires_grad).to(device)
    File "/home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib/python3.9/site-packages/accelerate/hooks.py", line 253, in init_hook
    set_module_tensor_to_device(module, name, self.execution_device)
    File "/home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib/python3.9/site-packages/accelerate/hooks.py", line 155, in add_hook_to_module
    module = hook.init_hook(module)
    File "/home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib/python3.9/site-packages/accelerate/hooks.py", line 350, in attach_execution_device_hook
    add_hook_to_module(module, AlignDevicesHook(execution_device, skip_keys=skip_keys))
    File "/home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib/python3.9/site-packages/accelerate/hooks.py", line 357, in attach_execution_device_hook
    attach_execution_device_hook(child, execution_device)
    File "/home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib/python3.9/site-packages/accelerate/hooks.py", line 517, in attach_align_device_hook_on_blocks
    attach_execution_device_hook(module, execution_device[module_name])
    File "/home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib/python3.9/site-packages/accelerate/hooks.py", line 546, in attach_align_device_hook_on_blocks
    attach_align_device_hook_on_blocks(
    File "/home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib/python3.9/site-packages/accelerate/hooks.py", line 546, in attach_align_device_hook_on_blocks
    attach_align_device_hook_on_blocks(
    File "/home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib/python3.9/site-packages/accelerate/hooks.py", line 546, in attach_align_device_hook_on_blocks
    attach_align_device_hook_on_blocks(
    [Previous line repeated 2 more times]
    File "/home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib/python3.9/site-packages/accelerate/big_modeling.py", line 399, in dispatch_model
    attach_align_device_hook_on_blocks(
    File "/home/ma-user/work/test.py", line 44, in load_model_on_gpus
    model = dispatch_model(model, device_map=device_map)
    File "/home/ma-user/work/test.py", line 51, in
    model = load_model_on_gpus("/home/ma-user/work/chatglm3-6b", 2)
    File "/home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
    File "/home/ma-user/anaconda3/envs/PyTorch-2.1.0/lib/python3.9/runpy.py", line 197, in _run_module_as_main (Current frame)
    return _run_code(code, main_globals, None,
    TypeError: new() received an invalid combination of arguments - got (Tensor, requires_grad=bool), but expected one of:
  • (*, torch.device device)
    didn't match because some of the keywords were incorrect: requires_grad
  • (torch.Storage storage)
  • (Tensor other)
  • (tuple of ints size, *, torch.device device)
  • (object data, *, torch.device device)
@BellMeng BellMeng changed the title 使用昇腾910进行单机多卡推理报错 使用昇腾910进行ChatGLM单机多卡推理报错 Feb 21, 2024
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

1 participant