modelscope / modelscope/ms-swift

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

Open
#8,290 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug npu
Dominant language
Python
Stars
15.7k
Forks
1.7k
Avg merge
1d 16h
Merged PRs (30d)
136

Description

Checklist / 检查清单
  • 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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at swift/infer_engine/utils.py around line 369 and inspect how partial binds the device argument for torch.npu.mem_get_info. Reproduce with the provided swift infer command in the listed vllm-ascend environment, then verify that inference no longer raises the duplicate device-argument error and that the existing device selection still works.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
backend, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.