hf-audiolm-Qwen: “基因-直到'硬码`.to ("cuda")',在非CUDA加速器上流产

作者: li-lizhe创建于 2026年9月27日更新于 2026年9月27日

问题描述 HFAUDIOLMQWEN.generate_until(lm_eval/models/hf_audiolm.py) 将编码的批量无条件移动到 CUDA 中: inputs["input_ids"] = inputs["input_ids"].to("cuda") inputs.input_ids = inputs.input_ids.to("cuda") 在任何不属于 CUDA 的加速器(通过 torch_npu 使用 Ascend NPU、XPU、MPS 或仅使用 CPU 的构建)上,生成开始之前就会中止,因此 hf-audiolm-Qwen 后端永远无法生成 – 尽管类的其余线程会通过 self.device 或 self._model.device 传递张量。 在在 Ascend 910B4 上运行音频模型时( torch 2.15.0.dev + torch_npu) 发现了这个问题; 它不是 NPU 特有的,任何非 CUDA 后端都会遇到这个问题。

内容来源: EleutherAI/lm-evaluation-harness