Alidr79 commited on
Commit
445ea0c
1 Parent(s): a441b22

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -11
app.py CHANGED
@@ -42,16 +42,14 @@ import librosa
42
 
43
 
44
 
45
- # def set_seed(seed):
46
- # torch.manual_seed(seed)
47
- # if torch.cuda.is_available():
48
- # torch.cuda.manual_seed_all(seed)
49
- # np.random.seed(seed)
50
- # random.seed(seed)
51
- # torch.backends.cudnn.deterministic = True
52
- # torch.backends.cudnn.benchmark = False
53
-
54
- # set_seed(42)
55
  # Load model directly
56
  from transformers import AutoProcessor, AutoModelForTextToSpectrogram
57
 
@@ -128,7 +126,7 @@ def tts_fn(slider_value, input_text):
128
  inputs = processor(text = text, return_tensors="pt")
129
 
130
  with torch.no_grad():
131
- spectrogram = model.generate_speech(inputs["input_ids"], speaker_embedding, minlenratio = 2, maxlenratio = 4, threshold = 0.3)
132
 
133
  with torch.no_grad():
134
  speech = vocoder(spectrogram)
 
42
 
43
 
44
 
45
+ def set_seed(seed):
46
+ torch.manual_seed(seed)
47
+ if torch.cuda.is_available():
48
+ torch.cuda.manual_seed_all(seed)
49
+ np.random.seed(seed)
50
+ torch.backends.cudnn.benchmark = False
51
+
52
+ set_seed(997)
 
 
53
  # Load model directly
54
  from transformers import AutoProcessor, AutoModelForTextToSpectrogram
55
 
 
126
  inputs = processor(text = text, return_tensors="pt")
127
 
128
  with torch.no_grad():
129
+ spectrogram = model.generate_speech(inputs["input_ids"], speaker_embedding, minlenratio = 2, maxlenratio = 4, threshold = 0.4)
130
 
131
  with torch.no_grad():
132
  speech = vocoder(spectrogram)