Mark Ogata commited on
Commit
0280bc0
·
1 Parent(s): 0048ef7

fix CPU only error

Browse files
Files changed (2) hide show
  1. converter.py +3 -1
  2. requirements.txt +2 -1
converter.py CHANGED
@@ -20,6 +20,7 @@ from torch.nn.utils import weight_norm, remove_weight_norm, spectral_norm
20
 
21
  MAX_WAV_VALUE = 32768.0
22
 
 
23
 
24
  def load_wav(full_path):
25
  sampling_rate, data = read(full_path)
@@ -352,7 +353,8 @@ class Generator(torch.nn.Module):
352
  config = get_config(config_path)
353
  vocoder = cls(config)
354
 
355
- state_dict_g = torch.load(ckpt_path)
 
356
  vocoder.load_state_dict(state_dict_g["generator"])
357
  vocoder.eval()
358
  vocoder.remove_weight_norm()
 
20
 
21
  MAX_WAV_VALUE = 32768.0
22
 
23
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
24
 
25
  def load_wav(full_path):
26
  sampling_rate, data = read(full_path)
 
353
  config = get_config(config_path)
354
  vocoder = cls(config)
355
 
356
+
357
+ state_dict_g = torch.load(ckpt_path, map_location=device)
358
  vocoder.load_state_dict(state_dict_g["generator"])
359
  vocoder.eval()
360
  vocoder.remove_weight_norm()
requirements.txt CHANGED
@@ -6,4 +6,5 @@ matplotlib
6
  numpy
7
  scipy
8
  Pillow
9
- librosa
 
 
6
  numpy
7
  scipy
8
  Pillow
9
+ librosa
10
+ transformers