Skip to content

Commit

Permalink
fix: Windows not yet supported for torch.compile (#377)
Browse files Browse the repository at this point in the history
  • Loading branch information
asamaayako authored Jun 20, 2024
1 parent 654b0f2 commit 153ccde
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ChatTTS/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ def _load(
assert gpt_ckpt_path, 'gpt_ckpt_path should not be None'
gpt.load_state_dict(torch.load(gpt_ckpt_path))
if compile and 'cuda' in str(device):
gpt.gpt.forward = torch.compile(gpt.gpt.forward, backend='inductor', dynamic=True)
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.')
self.pretrain_models['gpt'] = gpt
spk_stat_path = os.path.join(os.path.dirname(gpt_ckpt_path), 'spk_stat.pt')
assert os.path.exists(spk_stat_path), f'Missing spk_stat.pt: {spk_stat_path}'
Expand Down

0 comments on commit 153ccde

Please sign in to comment.