Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
3c02e07
1
Parent(s):
b9a2483
fix
Browse files
app.py
CHANGED
@@ -18,6 +18,26 @@ os.system('nvidia-smi')
|
|
18 |
# os.system('apt update -y && apt-get install -y apt-utils && apt install -y unzip')
|
19 |
print(torch.backends.cudnn.version())
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
import sys
|
22 |
import argparse
|
23 |
import gradio as gr
|
@@ -32,10 +52,8 @@ ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
32 |
sys.path.append('{}/third_party/Matcha-TTS'.format(ROOT_DIR))
|
33 |
|
34 |
from huggingface_hub import snapshot_download
|
35 |
-
print("Downloading pretrained models...")
|
36 |
snapshot_download('FunAudioLLM/CosyVoice2-0.5B', local_dir='pretrained_models/CosyVoice2-0.5B')
|
37 |
snapshot_download('FunAudioLLM/CosyVoice-ttsfrd', local_dir='pretrained_models/CosyVoice-ttsfrd')
|
38 |
-
print("Downloading pretrained models done.")
|
39 |
os.system('cd pretrained_models/CosyVoice-ttsfrd/ && pip install ttsfrd_dependency-0.1-py3-none-any.whl && pip install ttsfrd-0.4.2-cp310-cp310-linux_x86_64.whl && tar -xvf resource.tar')
|
40 |
|
41 |
from cosyvoice.cli.cosyvoice import CosyVoice2
|
|
|
18 |
# os.system('apt update -y && apt-get install -y apt-utils && apt install -y unzip')
|
19 |
print(torch.backends.cudnn.version())
|
20 |
|
21 |
+
import importlib
|
22 |
+
import sys
|
23 |
+
|
24 |
+
dynamic_modules_file1 = '/home/user/.pyenv/versions/3.10.16/lib/python3.10/site-packages/diffusers/utils/dynamic_modules_utils.py'
|
25 |
+
dynamic_modules_file2 = '/usr/local/lib/python3.10/site-packages/diffusers/utils/dynamic_modules_utils.py'
|
26 |
+
|
27 |
+
def modify_dynamic_modules_file(dynamic_modules_file):
|
28 |
+
if os.path.exists(dynamic_modules_file):
|
29 |
+
with open(dynamic_modules_file, 'r') as file:
|
30 |
+
lines = file.readlines()
|
31 |
+
with open(dynamic_modules_file, 'w') as file:
|
32 |
+
for line in lines:
|
33 |
+
if "from huggingface_hub import cached_download" in line:
|
34 |
+
file.write("from huggingface_hub import hf_hub_download, model_info\n")
|
35 |
+
else:
|
36 |
+
file.write(line)
|
37 |
+
|
38 |
+
modify_dynamic_modules_file(dynamic_modules_file1)
|
39 |
+
modify_dynamic_modules_file(dynamic_modules_file2)
|
40 |
+
|
41 |
import sys
|
42 |
import argparse
|
43 |
import gradio as gr
|
|
|
52 |
sys.path.append('{}/third_party/Matcha-TTS'.format(ROOT_DIR))
|
53 |
|
54 |
from huggingface_hub import snapshot_download
|
|
|
55 |
snapshot_download('FunAudioLLM/CosyVoice2-0.5B', local_dir='pretrained_models/CosyVoice2-0.5B')
|
56 |
snapshot_download('FunAudioLLM/CosyVoice-ttsfrd', local_dir='pretrained_models/CosyVoice-ttsfrd')
|
|
|
57 |
os.system('cd pretrained_models/CosyVoice-ttsfrd/ && pip install ttsfrd_dependency-0.1-py3-none-any.whl && pip install ttsfrd-0.4.2-cp310-cp310-linux_x86_64.whl && tar -xvf resource.tar')
|
58 |
|
59 |
from cosyvoice.cli.cosyvoice import CosyVoice2
|