Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,27 +10,25 @@ import os
|
|
10 |
from huggingface_hub import snapshot_download
|
11 |
|
12 |
# ... (Whisper and Vicuna setup remain the same)
|
13 |
-
|
14 |
# --- VITS (TTS) Setup ---
|
15 |
-
TTS_MODEL_NAME = "espnet/
|
16 |
tts_device = "cuda" if torch.cuda.is_available() else "cpu"
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
if
|
21 |
-
|
22 |
|
|
|
23 |
download_path = snapshot_download(repo_id=TTS_MODEL_NAME, local_dir=model_dir, local_dir_use_symlinks=False)
|
24 |
-
print(f"Downloaded ESPnet model to: {download_path}")
|
25 |
|
26 |
-
#
|
27 |
-
config_path = os.path.join(download_path, "exp/
|
28 |
-
model_path = os.path.join(download_path, "exp/
|
29 |
|
30 |
-
# Load the Text2Speech model using the downloaded files and absolute paths
|
31 |
tts_model = Text2Speech(train_config=config_path, model_file=model_path, device=tts_device)
|
32 |
|
33 |
-
|
34 |
# --- Vicuna (LLM) Setup ---
|
35 |
VICUNA_MODEL_NAME = "lmsys/vicuna-7b-v1.5"
|
36 |
vicuna_device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
10 |
from huggingface_hub import snapshot_download
|
11 |
|
12 |
# ... (Whisper and Vicuna setup remain the same)
|
|
|
13 |
# --- VITS (TTS) Setup ---
|
14 |
+
TTS_MODEL_NAME = "espnet/speechlm_tts_v1" # Updated Model Name
|
15 |
tts_device = "cuda" if torch.cuda.is_available() else "cpu"
|
16 |
|
17 |
+
model_dir = "speechlm_model" # Updated directory name
|
18 |
+
|
19 |
+
if os.path.exists(model_dir):
|
20 |
+
shutil.rmtree(model_dir)
|
21 |
|
22 |
+
os.makedirs(model_dir)
|
23 |
download_path = snapshot_download(repo_id=TTS_MODEL_NAME, local_dir=model_dir, local_dir_use_symlinks=False)
|
24 |
+
print(f"Downloaded ESPnet model to: {download_path}")
|
25 |
|
26 |
+
# --- KEY CHANGE: Adjust paths for speechlm_tts_v1 ---
|
27 |
+
config_path = os.path.join(download_path, "exp/speechlm_tts_v1/config.yaml") # Correct path for speechlm_tts_v1
|
28 |
+
model_path = os.path.join(download_path, "exp/speechlm_tts_v1/model.pth") # Correct path for speechlm_tts_v1
|
29 |
|
|
|
30 |
tts_model = Text2Speech(train_config=config_path, model_file=model_path, device=tts_device)
|
31 |
|
|
|
32 |
# --- Vicuna (LLM) Setup ---
|
33 |
VICUNA_MODEL_NAME = "lmsys/vicuna-7b-v1.5"
|
34 |
vicuna_device = "cuda" if torch.cuda.is_available() else "cpu"
|