2noise / ChatTTS

A generative speech model for daily dialogue.
https://2noise.com
Other
27.01k stars 2.94k forks source link

Windows not yet supported for torch.compile fix #377

Closed asamaayako closed 2 weeks ago

asamaayako commented 2 weeks ago

Windows not yet supported for torch.compile 报错位置 ChatTTS->core.py->125: gpt.gpt.forward = torch.compile(gpt.gpt.forward, backend='inductor', dynamic=True)

 if compile and 'cuda' in str(device):
                gpt.gpt.forward = torch.compile(gpt.gpt.forward,  backend='inductor', dynamic=True)

希望修改为

      if compile and 'cuda' in str(device):
          try:
              gpt.gpt.forward = torch.compile(gpt.gpt.forward, backend='inductor', dynamic=True)
          except RuntimeError as e:
              logging.warning(f'Compile failed,{e}. fallback to normal mode.')

以拦截 平台不支持compile 出现RuntimeError 处理方式继续以普通模式运行并打印log输出原因。