ms-swift icon indicating copy to clipboard operation
ms-swift copied to clipboard

torch.npu.mem_get_info 出现 got multiple values for argument 'device' 错误

Open Michel-liu opened this issue 8 months ago • 6 comments

Checklist / 检查清单

  • [x] I have searched existing issues, and this is a new bug report. / 我已经搜索过现有的 issues,确认这是一个新的 bug report。

Bug Description / Bug 描述

infer时,使用partial绑定device导致出现 got multiple values for argument 'device' 错误。

https://github.com/modelscope/ms-swift/blob/05149f5e06a741b2f5494876ce5384e90a7d6fb8/swift/infer_engine/utils.py#L369

How to Reproduce / 如何复现

复现环境:quay.io/ascend/vllm-ascend:v0.16.0rc1 复现脚本: swift infer --val_dataset "$INFER_DATASET"
--infer_backend vllm
--vllm_gpu_memory_utilization 0.8
--vllm_max_num_seqs $VLLM_GLOBAL_BATCH_SIZE
--model Qwen/Qwen3-VL-2B
--torch_dtype bfloat16
--write_batch_size $VLLM_GLOBAL_BATCH_SIZE
--max_new_tokens 2048
--enable_thinking false
--temperature 0.0
--result_path "$RESULT_PATH"

Additional Information / 补充信息

暂时可通过包装一层解决。

def _mem_get_info_wrapper(device=None):
    return original_mem_get_info(device=vllm_device)

Michel-liu avatar Mar 11 '26 14:03 Michel-liu

vllm_ascend==0.14.1rc1,还有配套的torch_npu==2.9.0正常运行无报错,我理解应该是版本问题,可以尝试升级一下

jiaqiw09 avatar Mar 12 '26 08:03 jiaqiw09

vllm_ascend==0.14.1rc1,还有配套的torch_npu==2.9.0正常运行无报错,我理解应该是版本问题,可以尝试升级一下

旧版本是兼容的,升级到vllm-ascend:v0.16.0rc1出现的问题。镜像:quay.io/ascend/vllm-ascend:v0.16.0rc1

Michel-liu avatar Mar 13 '26 03:03 Michel-liu

vllm_ascend==0.14.1rc1,还有配套的torch_npu==2.9.0正常运行无报错,我理解应该是版本问题,可以尝试升级一下

旧版本是兼容的,升级到vllm-ascend:v0.16.0rc1出现的问题。镜像:quay.io/ascend/vllm-ascend:v0.16.0rc1

新版本问题我反馈一下,谢谢

jiaqiw09 avatar Mar 16 '26 07:03 jiaqiw09

同样遇到这个问题, 感谢大佬的方法解决了 环境 vllm_ascend==0.18.1rc1

original_mem_get_info = torch.npu.mem_get_info
def _mem_get_info_wrapper(*args, **kwargs):
    return original_mem_get_info(device=vllm_device)
torch.npu.mem_get_info = _mem_get_info_wrapper

scorpionfree98 avatar Apr 16 '26 14:04 scorpionfree98

This issue has been inactive for over 3 months and will be automatically closed in 7 days. If this issue is still relevant, please reply to this message.

github-actions[bot] avatar Nov 08 '26 00:11 github-actions[bot]

This issue has been automatically closed due to inactivity. If needed, it can be reopened.

github-actions[bot] avatar Nov 16 '26 00:11 github-actions[bot]