herimor commited on
Commit
1700774
·
1 Parent(s): 6f3fc33

Update device check

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -46,11 +46,11 @@ audio {outline: none;}
46
 
47
  @spaces.GPU
48
  def synthesize_fn(prompt_audio_path, prompt_text, target_text):
49
- if speech_generator.model.device == "cpu":
50
  speech_generator.model.to("cuda")
51
  speech_generator.mimi.to("cuda")
52
  speech_generator.spk_enc.to("cuda")
53
- speech_generator.aligner.to("cuda")
54
 
55
  if not prompt_audio_path or not target_text:
56
  return None
 
46
 
47
  @spaces.GPU
48
  def synthesize_fn(prompt_audio_path, prompt_text, target_text):
49
+ if next(speech_generator.model.parameters()).device.type == "cpu":
50
  speech_generator.model.to("cuda")
51
  speech_generator.mimi.to("cuda")
52
  speech_generator.spk_enc.to("cuda")
53
+ speech_generator.aligner.aligner.to("cuda")
54
 
55
  if not prompt_audio_path or not target_text:
56
  return None