积极的屁孩
commited on
Commit
·
2fc31e9
1
Parent(s):
cba1c8b
cn -> en
Browse files
app.py
CHANGED
|
@@ -13,6 +13,7 @@ import re
|
|
| 13 |
import spaces
|
| 14 |
|
| 15 |
# 创建一个全局变量来跟踪已下载的资源
|
|
|
|
| 16 |
downloaded_resources = {
|
| 17 |
"configs": False,
|
| 18 |
"tokenizer_vq32": False,
|
|
@@ -895,14 +896,17 @@ def vevo_tts(text, ref_wav, timbre_ref_wav=None, style_ref_text=None, src_langua
|
|
| 895 |
raise e
|
| 896 |
|
| 897 |
# 在程序启动时下载所有需要的模型资源
|
|
|
|
| 898 |
def preload_all_resources():
|
| 899 |
-
print("
|
| 900 |
# 下载配置文件
|
|
|
|
| 901 |
setup_configs()
|
| 902 |
|
| 903 |
# 下载Content Tokenizer (vq32)
|
|
|
|
| 904 |
if not downloaded_resources["tokenizer_vq32"]:
|
| 905 |
-
print("
|
| 906 |
local_dir = snapshot_download(
|
| 907 |
repo_id="amphion/Vevo",
|
| 908 |
repo_type="model",
|
|
@@ -910,11 +914,12 @@ def preload_all_resources():
|
|
| 910 |
allow_patterns=["tokenizer/vq32/*"],
|
| 911 |
)
|
| 912 |
downloaded_resources["tokenizer_vq32"] = True
|
| 913 |
-
print("Content Tokenizer (vq32)
|
| 914 |
|
| 915 |
# 下载Content-Style Tokenizer (vq8192)
|
|
|
|
| 916 |
if not downloaded_resources["tokenizer_vq8192"]:
|
| 917 |
-
print("
|
| 918 |
local_dir = snapshot_download(
|
| 919 |
repo_id="amphion/Vevo",
|
| 920 |
repo_type="model",
|
|
@@ -922,11 +927,12 @@ def preload_all_resources():
|
|
| 922 |
allow_patterns=["tokenizer/vq8192/*"],
|
| 923 |
)
|
| 924 |
downloaded_resources["tokenizer_vq8192"] = True
|
| 925 |
-
print("Content-Style Tokenizer (vq8192)
|
| 926 |
|
| 927 |
# 下载Autoregressive Transformer (Vq32ToVq8192)
|
|
|
|
| 928 |
if not downloaded_resources["ar_Vq32ToVq8192"]:
|
| 929 |
-
print("
|
| 930 |
local_dir = snapshot_download(
|
| 931 |
repo_id="amphion/Vevo",
|
| 932 |
repo_type="model",
|
|
@@ -934,11 +940,12 @@ def preload_all_resources():
|
|
| 934 |
allow_patterns=["contentstyle_modeling/Vq32ToVq8192/*"],
|
| 935 |
)
|
| 936 |
downloaded_resources["ar_Vq32ToVq8192"] = True
|
| 937 |
-
print("Autoregressive Transformer (Vq32ToVq8192)
|
| 938 |
|
| 939 |
# 下载Autoregressive Transformer (PhoneToVq8192)
|
|
|
|
| 940 |
if not downloaded_resources["ar_PhoneToVq8192"]:
|
| 941 |
-
print("
|
| 942 |
local_dir = snapshot_download(
|
| 943 |
repo_id="amphion/Vevo",
|
| 944 |
repo_type="model",
|
|
@@ -946,11 +953,12 @@ def preload_all_resources():
|
|
| 946 |
allow_patterns=["contentstyle_modeling/PhoneToVq8192/*"],
|
| 947 |
)
|
| 948 |
downloaded_resources["ar_PhoneToVq8192"] = True
|
| 949 |
-
print("Autoregressive Transformer (PhoneToVq8192)
|
| 950 |
|
| 951 |
# 下载Flow Matching Transformer
|
|
|
|
| 952 |
if not downloaded_resources["fmt_Vq8192ToMels"]:
|
| 953 |
-
print("
|
| 954 |
local_dir = snapshot_download(
|
| 955 |
repo_id="amphion/Vevo",
|
| 956 |
repo_type="model",
|
|
@@ -958,11 +966,12 @@ def preload_all_resources():
|
|
| 958 |
allow_patterns=["acoustic_modeling/Vq8192ToMels/*"],
|
| 959 |
)
|
| 960 |
downloaded_resources["fmt_Vq8192ToMels"] = True
|
| 961 |
-
print("Flow Matching Transformer (Vq8192ToMels)
|
| 962 |
|
| 963 |
# 下载Vocoder
|
|
|
|
| 964 |
if not downloaded_resources["vocoder"]:
|
| 965 |
-
print("
|
| 966 |
local_dir = snapshot_download(
|
| 967 |
repo_id="amphion/Vevo",
|
| 968 |
repo_type="model",
|
|
@@ -970,11 +979,12 @@ def preload_all_resources():
|
|
| 970 |
allow_patterns=["acoustic_modeling/Vocoder/*"],
|
| 971 |
)
|
| 972 |
downloaded_resources["vocoder"] = True
|
| 973 |
-
print("Vocoder
|
| 974 |
|
| 975 |
-
print("
|
| 976 |
|
| 977 |
# 在创建Gradio界面之前预加载所有资源
|
|
|
|
| 978 |
preload_all_resources()
|
| 979 |
|
| 980 |
# Create Gradio interface
|
|
|
|
| 13 |
import spaces
|
| 14 |
|
| 15 |
# 创建一个全局变量来跟踪已下载的资源
|
| 16 |
+
# Create a global variable to track downloaded resources
|
| 17 |
downloaded_resources = {
|
| 18 |
"configs": False,
|
| 19 |
"tokenizer_vq32": False,
|
|
|
|
| 896 |
raise e
|
| 897 |
|
| 898 |
# 在程序启动时下载所有需要的模型资源
|
| 899 |
+
# Download all necessary model resources at startup
|
| 900 |
def preload_all_resources():
|
| 901 |
+
print("Preloading all model resources...")
|
| 902 |
# 下载配置文件
|
| 903 |
+
# Download configuration files
|
| 904 |
setup_configs()
|
| 905 |
|
| 906 |
# 下载Content Tokenizer (vq32)
|
| 907 |
+
# Download Content Tokenizer (vq32)
|
| 908 |
if not downloaded_resources["tokenizer_vq32"]:
|
| 909 |
+
print("Preloading Content Tokenizer (vq32)...")
|
| 910 |
local_dir = snapshot_download(
|
| 911 |
repo_id="amphion/Vevo",
|
| 912 |
repo_type="model",
|
|
|
|
| 914 |
allow_patterns=["tokenizer/vq32/*"],
|
| 915 |
)
|
| 916 |
downloaded_resources["tokenizer_vq32"] = True
|
| 917 |
+
print("Content Tokenizer (vq32) download completed")
|
| 918 |
|
| 919 |
# 下载Content-Style Tokenizer (vq8192)
|
| 920 |
+
# Download Content-Style Tokenizer (vq8192)
|
| 921 |
if not downloaded_resources["tokenizer_vq8192"]:
|
| 922 |
+
print("Preloading Content-Style Tokenizer (vq8192)...")
|
| 923 |
local_dir = snapshot_download(
|
| 924 |
repo_id="amphion/Vevo",
|
| 925 |
repo_type="model",
|
|
|
|
| 927 |
allow_patterns=["tokenizer/vq8192/*"],
|
| 928 |
)
|
| 929 |
downloaded_resources["tokenizer_vq8192"] = True
|
| 930 |
+
print("Content-Style Tokenizer (vq8192) download completed")
|
| 931 |
|
| 932 |
# 下载Autoregressive Transformer (Vq32ToVq8192)
|
| 933 |
+
# Download Autoregressive Transformer (Vq32ToVq8192)
|
| 934 |
if not downloaded_resources["ar_Vq32ToVq8192"]:
|
| 935 |
+
print("Preloading Autoregressive Transformer (Vq32ToVq8192)...")
|
| 936 |
local_dir = snapshot_download(
|
| 937 |
repo_id="amphion/Vevo",
|
| 938 |
repo_type="model",
|
|
|
|
| 940 |
allow_patterns=["contentstyle_modeling/Vq32ToVq8192/*"],
|
| 941 |
)
|
| 942 |
downloaded_resources["ar_Vq32ToVq8192"] = True
|
| 943 |
+
print("Autoregressive Transformer (Vq32ToVq8192) download completed")
|
| 944 |
|
| 945 |
# 下载Autoregressive Transformer (PhoneToVq8192)
|
| 946 |
+
# Download Autoregressive Transformer (PhoneToVq8192)
|
| 947 |
if not downloaded_resources["ar_PhoneToVq8192"]:
|
| 948 |
+
print("Preloading Autoregressive Transformer (PhoneToVq8192)...")
|
| 949 |
local_dir = snapshot_download(
|
| 950 |
repo_id="amphion/Vevo",
|
| 951 |
repo_type="model",
|
|
|
|
| 953 |
allow_patterns=["contentstyle_modeling/PhoneToVq8192/*"],
|
| 954 |
)
|
| 955 |
downloaded_resources["ar_PhoneToVq8192"] = True
|
| 956 |
+
print("Autoregressive Transformer (PhoneToVq8192) download completed")
|
| 957 |
|
| 958 |
# 下载Flow Matching Transformer
|
| 959 |
+
# Download Flow Matching Transformer
|
| 960 |
if not downloaded_resources["fmt_Vq8192ToMels"]:
|
| 961 |
+
print("Preloading Flow Matching Transformer (Vq8192ToMels)...")
|
| 962 |
local_dir = snapshot_download(
|
| 963 |
repo_id="amphion/Vevo",
|
| 964 |
repo_type="model",
|
|
|
|
| 966 |
allow_patterns=["acoustic_modeling/Vq8192ToMels/*"],
|
| 967 |
)
|
| 968 |
downloaded_resources["fmt_Vq8192ToMels"] = True
|
| 969 |
+
print("Flow Matching Transformer (Vq8192ToMels) download completed")
|
| 970 |
|
| 971 |
# 下载Vocoder
|
| 972 |
+
# Download Vocoder
|
| 973 |
if not downloaded_resources["vocoder"]:
|
| 974 |
+
print("Preloading Vocoder...")
|
| 975 |
local_dir = snapshot_download(
|
| 976 |
repo_id="amphion/Vevo",
|
| 977 |
repo_type="model",
|
|
|
|
| 979 |
allow_patterns=["acoustic_modeling/Vocoder/*"],
|
| 980 |
)
|
| 981 |
downloaded_resources["vocoder"] = True
|
| 982 |
+
print("Vocoder download completed")
|
| 983 |
|
| 984 |
+
print("All model resources preloading completed!")
|
| 985 |
|
| 986 |
# 在创建Gradio界面之前预加载所有资源
|
| 987 |
+
# Preload all resources before creating the Gradio interface
|
| 988 |
preload_all_resources()
|
| 989 |
|
| 990 |
# Create Gradio interface
|