Serhiy Stetskovych commited on
Commit
39cc8c4
1 Parent(s): 03171b5

fix vocos load

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -75,9 +75,9 @@ def load_hifigan(checkpoint_path, device):
75
 
76
 
77
  def load_vocos(checkpoint_path, config_path, device):
78
- model = Vocos.from_hparams(config_path)
79
 
80
- raw_model = torch.load(checkpoint_path, map_location=torch.device('cpu'))
81
  raw_model = raw_model if 'state_dict' not in raw_model else raw_model['state_dict']
82
  model.load_state_dict(raw_model, strict=False)
83
  model.eval()
@@ -137,7 +137,7 @@ def synthesise(text, speed):
137
  guidance_scale=1.5
138
 
139
  )
140
- waveform_vocos = vocos.decode(output["mel"]).to(device).squeeze()
141
  #waveform_vocos_44100 = vocos_44100.decode(output["mel"]).cpu().squeeze()
142
  #waveform_hifigan = hifigan(output["mel"]).clamp(-1, 1).cpu().squeeze()
143
  #transform = torchaudio.transforms.Vol(gain=-18, gain_type="db")
 
75
 
76
 
77
  def load_vocos(checkpoint_path, config_path, device):
78
+ model = Vocos.from_hparams(config_path).to(device)
79
 
80
+ raw_model = torch.load(checkpoint_path, map_location=device)
81
  raw_model = raw_model if 'state_dict' not in raw_model else raw_model['state_dict']
82
  model.load_state_dict(raw_model, strict=False)
83
  model.eval()
 
137
  guidance_scale=1.5
138
 
139
  )
140
+ waveform_vocos = vocos.decode(output["mel"]).cpu().squeeze()
141
  #waveform_vocos_44100 = vocos_44100.decode(output["mel"]).cpu().squeeze()
142
  #waveform_hifigan = hifigan(output["mel"]).clamp(-1, 1).cpu().squeeze()
143
  #transform = torchaudio.transforms.Vol(gain=-18, gain_type="db")