[index-tts]运行webui时出现RuntimeError: User specified an unsupported autocast device_type 'cuda:0'问题

2025-10-30 254 views
2

你好,我在运行webui的时候遇到了这个问题

Traceback (most recent call last):
  File "D:\anaconda\envs\tts\lib\site-packages\gradio\queueing.py", line 625, in process_events
    response = await route_utils.call_process_api(
  File "D:\anaconda\envs\tts\lib\site-packages\gradio\route_utils.py", line 322, in call_process_api
    output = await app.get_blocks().process_api(
  File "D:\anaconda\envs\tts\lib\site-packages\gradio\blocks.py", line 2136, in process_api
    result = await self.call_function(
  File "D:\anaconda\envs\tts\lib\site-packages\gradio\blocks.py", line 1662, in call_function
    prediction = await anyio.to_thread.run_sync(  # type: ignore
  File "D:\anaconda\envs\tts\lib\site-packages\anyio\to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "D:\anaconda\envs\tts\lib\site-packages\anyio\_backends\_asyncio.py", line 2470, in run_sync_in_worker_thread
    return await future
  File "D:\anaconda\envs\tts\lib\site-packages\anyio\_backends\_asyncio.py", line 967, in run
    result = context.run(func, *args)
  File "D:\anaconda\envs\tts\lib\site-packages\gradio\utils.py", line 883, in wrapper
    response = f(*args, **kwargs)
  File "A:\code\TTS\index-tts\webui.py", line 36, in gen_single
    output = tts.infer(prompt, text, output_path) # 普通推理
  File "A:\code\TTS\index-tts\indextts\infer.py", line 520, in infer
    with torch.amp.autocast(self.device, enabled=self.dtype is not None, dtype=self.dtype):
  File "D:\anaconda\envs\tts\lib\site-packages\torch\amp\autocast_mode.py", line 241, in __init__
    raise RuntimeError(
RuntimeError: User specified an unsupported autocast device_type 'cuda:0'

我的环境中配置的torch和cuda是可以读到显卡的,运行webui的时候会出现这个问题

回答