Remsky commited on
Commit
0f830fe
·
1 Parent(s): 1b3eebf

Add fallback mechanism for loading voicepack in TTSModel

Browse files
Files changed (1) hide show
  1. tts_model.py +5 -1
tts_model.py CHANGED
@@ -193,7 +193,11 @@ class TTSModel:
193
  for voice in voice_names:
194
  try:
195
  voice_path = os.path.join(self.voices_dir, "voices", f"{voice}.pt")
196
- voicepack = torch.load(voice_path, weights_only=True)
 
 
 
 
197
  t_voices.append(voicepack)
198
  except Exception as e:
199
  print(f"Warning: Failed to load voice {voice}: {str(e)}")
 
193
  for voice in voice_names:
194
  try:
195
  voice_path = os.path.join(self.voices_dir, "voices", f"{voice}.pt")
196
+ try:
197
+ voicepack = torch.load(voice_path, weights_only=True)
198
+ except Exception as e:
199
+ print(f"Warning: weights_only load failed, attempting full load: {str(e)}")
200
+ voicepack = torch.load(voice_path, weights_only=False)
201
  t_voices.append(voicepack)
202
  except Exception as e:
203
  print(f"Warning: Failed to load voice {voice}: {str(e)}")