Skip to content

Commit 153ccde

Browse files
authored
fix: Windows not yet supported for torch.compile (#377)
1 parent 654b0f2 commit 153ccde

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ChatTTS/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ def _load(
122122
assert gpt_ckpt_path, 'gpt_ckpt_path should not be None'
123123
gpt.load_state_dict(torch.load(gpt_ckpt_path))
124124
if compile and 'cuda' in str(device):
125-
gpt.gpt.forward = torch.compile(gpt.gpt.forward, backend='inductor', dynamic=True)
125+
try:
126+
gpt.gpt.forward = torch.compile(gpt.gpt.forward, backend='inductor', dynamic=True)
127+
except RuntimeError as e:
128+
logging.warning(f'Compile failed,{e}. fallback to normal mode.')
126129
self.pretrain_models['gpt'] = gpt
127130
spk_stat_path = os.path.join(os.path.dirname(gpt_ckpt_path), 'spk_stat.pt')
128131
assert os.path.exists(spk_stat_path), f'Missing spk_stat.pt: {spk_stat_path}'

0 commit comments

Comments
 (0)