Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,6 +15,13 @@ MODELS = {
|
|
| 15 |
}
|
| 16 |
from ttts.gpt.voice_tokenizer import VoiceBpeTokenizer
|
| 17 |
import torch.nn.functional as F
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
auto_conditioning = cond_mel
|
| 19 |
settings = {'temperature': .8, 'length_penalty': 1.0, 'repetition_penalty': 2.0,
|
| 20 |
'top_p': .8,
|
|
@@ -44,13 +51,6 @@ def speak(text):
|
|
| 44 |
print(text_tokens)
|
| 45 |
gpt = load_model('gpt',MODELS['gpt.pth'], './ttts/gpt/config.json',device)
|
| 46 |
gpt.post_init_gpt2_config(use_deepspeed=False, kv_cache=False, half=False)
|
| 47 |
-
cond_audio = 'ttts/3.wav'
|
| 48 |
-
audio,sr = torchaudio.load(cond_audio)
|
| 49 |
-
if audio.shape[0]>1:
|
| 50 |
-
audio = audio[0].unsqueeze(0)
|
| 51 |
-
audio = torchaudio.transforms.Resample(sr, 24000)(audio)
|
| 52 |
-
cond_mel = MelSpectrogramFeatures()(audio).to(device)
|
| 53 |
-
print(cond_mel.shape)
|
| 54 |
codes = gpt.inference_speech(auto_conditioning, text_tokens,
|
| 55 |
do_sample=True,
|
| 56 |
top_p=top_p,
|
|
|
|
| 15 |
}
|
| 16 |
from ttts.gpt.voice_tokenizer import VoiceBpeTokenizer
|
| 17 |
import torch.nn.functional as F
|
| 18 |
+
cond_audio = 'ttts/3.wav'
|
| 19 |
+
audio,sr = torchaudio.load(cond_audio)
|
| 20 |
+
if audio.shape[0]>1:
|
| 21 |
+
audio = audio[0].unsqueeze(0)
|
| 22 |
+
audio = torchaudio.transforms.Resample(sr, 24000)(audio)
|
| 23 |
+
cond_mel = MelSpectrogramFeatures()(audio).to(device)
|
| 24 |
+
print(cond_mel.shape)
|
| 25 |
auto_conditioning = cond_mel
|
| 26 |
settings = {'temperature': .8, 'length_penalty': 1.0, 'repetition_penalty': 2.0,
|
| 27 |
'top_p': .8,
|
|
|
|
| 51 |
print(text_tokens)
|
| 52 |
gpt = load_model('gpt',MODELS['gpt.pth'], './ttts/gpt/config.json',device)
|
| 53 |
gpt.post_init_gpt2_config(use_deepspeed=False, kv_cache=False, half=False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
codes = gpt.inference_speech(auto_conditioning, text_tokens,
|
| 55 |
do_sample=True,
|
| 56 |
top_p=top_p,
|