[index-tts]CUDA 设备不一致问题

2025-10-31 389 views
3

如果指定非CUDA:0 就会报错 cuda设备不一致的问题。 RuntimeError: Expected all tensors to be on the same device, but got index is on cuda:6, different from other tensors on cuda:0 (when checking argument in method wrapper_CUDA__index_select) ^CKeyboard interruption in main thread... closing server.

查找原因:model:698self.inference_model.device=0 这里的self.inference_model没有到指定设备上 强制设置可见cuda设备可解决 os.environ["CUDA_VISIBLE_DEVICES"] = "7"

配置常量

DEVICE = "cuda:0"

回答

3

确实又这个问题,改变infermodel指定device之后又会报错 File "/root/anaconda3/envs/indextts2/lib/python3.10/site-packages/deepspeed/ops/transformer/inference/op_binding/qkv_gemm.py", line 86, in forward output, norm = self.qkv_gemm_func(input, weight, q_scale, bias, gamma, beta, self.config.epsilon, add_bias, ValueError: Specified device cuda:6 does not match device of data cuda:0