Spaces:
Runtime error
Runtime error
积极的屁孩 commited on
Commit ·
2fc31e9
1
Parent(s): cba1c8b
cn -> en
Browse files12 unmodified lines131415161718876 unmodified lines8958968978988999009019029039049059069079081 unmodified line9109119129139149159169179189199201 unmodified line9229239249259269279289299309319321 unmodified line9349359369379389399409419429439441 unmodified line9469479489499509519529539549559561 unmodified line9589599609619629639649659669679681 unmodified line97097197297397497597697797897998012 unmodified linesimport spaces# 创建一个全局变量来跟踪已下载的资源downloaded_resources = {"configs": False,"tokenizer_vq32": False,876 unmodified linesraise e# 在程序启动时下载所有需要的模型资源def preload_all_resources():print("预加载所有模型资源...")# 下载配置文件setup_configs()# 下载Content Tokenizer (vq32)if not downloaded_resources["tokenizer_vq32"]:print("预下载 Content Tokenizer (vq32)...")local_dir = snapshot_download(repo_id="amphion/Vevo",repo_type="model",1 unmodified lineallow_patterns=["tokenizer/vq32/*"],)downloaded_resources["tokenizer_vq32"] = Trueprint("Content Tokenizer (vq32) 下载完成")# 下载Content-Style Tokenizer (vq8192)if not downloaded_resources["tokenizer_vq8192"]:print("预下载 Content-Style Tokenizer (vq8192)...")local_dir = snapshot_download(repo_id="amphion/Vevo",repo_type="model",1 unmodified lineallow_patterns=["tokenizer/vq8192/*"],)downloaded_resources["tokenizer_vq8192"] = Trueprint("Content-Style Tokenizer (vq8192) 下载完成")# 下载Autoregressive Transformer (Vq32ToVq8192)if not downloaded_resources["ar_Vq32ToVq8192"]:print("预下载 Autoregressive Transformer (Vq32ToVq8192)...")local_dir = snapshot_download(repo_id="amphion/Vevo",repo_type="model",1 unmodified lineallow_patterns=["contentstyle_modeling/Vq32ToVq8192/*"],)downloaded_resources["ar_Vq32ToVq8192"] = Trueprint("Autoregressive Transformer (Vq32ToVq8192) 下载完成")# 下载Autoregressive Transformer (PhoneToVq8192)if not downloaded_resources["ar_PhoneToVq8192"]:print("预下载 Autoregressive Transformer (PhoneToVq8192)...")local_dir = snapshot_download(repo_id="amphion/Vevo",repo_type="model",1 unmodified lineallow_patterns=["contentstyle_modeling/PhoneToVq8192/*"],)downloaded_resources["ar_PhoneToVq8192"] = Trueprint("Autoregressive Transformer (PhoneToVq8192) 下载完成")# 下载Flow Matching Transformerif not downloaded_resources["fmt_Vq8192ToMels"]:print("预下载 Flow Matching Transformer (Vq8192ToMels)...")local_dir = snapshot_download(repo_id="amphion/Vevo",repo_type="model",1 unmodified lineallow_patterns=["acoustic_modeling/Vq8192ToMels/*"],)downloaded_resources["fmt_Vq8192ToMels"] = Trueprint("Flow Matching Transformer (Vq8192ToMels) 下载完成")# 下载Vocoderif not downloaded_resources["vocoder"]:print("预下载 Vocoder...")local_dir = snapshot_download(repo_id="amphion/Vevo",repo_type="model",1 unmodified lineallow_patterns=["acoustic_modeling/Vocoder/*"],)downloaded_resources["vocoder"] = Trueprint("Vocoder 下载完成")print("所有模型资源预加载完成!")# 在创建Gradio界面之前预加载所有资源preload_all_resources()# Create Gradio interface12 unmodified lines13141516171819876 unmodified lines8968978988999009019029039049059069079089099109119121 unmodified line9149159169179189199209219229239249251 unmodified line9279289299309319329339349359369379381 unmodified line9409419429439449459469479489499509511 unmodified line9539549559569579589599609619629639641 unmodified line9669679689699709719729739749759769771 unmodified line97998098198298398498598698798898999012 unmodified linesimport spaces# 创建一个全局变量来跟踪已下载的资源# Create a global variable to track downloaded resourcesdownloaded_resources = {"configs": False,"tokenizer_vq32": False,876 unmodified linesraise e# 在程序启动时下载所有需要的模型资源# Download all necessary model resources at startupdef preload_all_resources():print("Preloading all model resources...")# 下载配置文件# Download configuration filessetup_configs()# 下载Content Tokenizer (vq32)# Download Content Tokenizer (vq32)if not downloaded_resources["tokenizer_vq32"]:print("Preloading Content Tokenizer (vq32)...")local_dir = snapshot_download(repo_id="amphion/Vevo",repo_type="model",1 unmodified lineallow_patterns=["tokenizer/vq32/*"],)downloaded_resources["tokenizer_vq32"] = Trueprint("Content Tokenizer (vq32) download completed")# 下载Content-Style Tokenizer (vq8192)# Download Content-Style Tokenizer (vq8192)if not downloaded_resources["tokenizer_vq8192"]:print("Preloading Content-Style Tokenizer (vq8192)...")local_dir = snapshot_download(repo_id="amphion/Vevo",repo_type="model",1 unmodified lineallow_patterns=["tokenizer/vq8192/*"],)downloaded_resources["tokenizer_vq8192"] = Trueprint("Content-Style Tokenizer (vq8192) download completed")# 下载Autoregressive Transformer (Vq32ToVq8192)# Download Autoregressive Transformer (Vq32ToVq8192)if not downloaded_resources["ar_Vq32ToVq8192"]:print("Preloading Autoregressive Transformer (Vq32ToVq8192)...")local_dir = snapshot_download(repo_id="amphion/Vevo",repo_type="model",1 unmodified lineallow_patterns=["contentstyle_modeling/Vq32ToVq8192/*"],)downloaded_resources["ar_Vq32ToVq8192"] = Trueprint("Autoregressive Transformer (Vq32ToVq8192) download completed")# 下载Autoregressive Transformer (PhoneToVq8192)# Download Autoregressive Transformer (PhoneToVq8192)if not downloaded_resources["ar_PhoneToVq8192"]:print("Preloading Autoregressive Transformer (PhoneToVq8192)...")local_dir = snapshot_download(repo_id="amphion/Vevo",repo_type="model",1 unmodified lineallow_patterns=["contentstyle_modeling/PhoneToVq8192/*"],)downloaded_resources["ar_PhoneToVq8192"] = Trueprint("Autoregressive Transformer (PhoneToVq8192) download completed")# 下载Flow Matching Transformer# Download Flow Matching Transformerif not downloaded_resources["fmt_Vq8192ToMels"]:print("Preloading Flow Matching Transformer (Vq8192ToMels)...")local_dir = snapshot_download(repo_id="amphion/Vevo",repo_type="model",1 unmodified lineallow_patterns=["acoustic_modeling/Vq8192ToMels/*"],)downloaded_resources["fmt_Vq8192ToMels"] = Trueprint("Flow Matching Transformer (Vq8192ToMels) download completed")# 下载Vocoder# Download Vocoderif not downloaded_resources["vocoder"]:print("Preloading Vocoder...")local_dir = snapshot_download(repo_id="amphion/Vevo",repo_type="model",1 unmodified lineallow_patterns=["acoustic_modeling/Vocoder/*"],)downloaded_resources["vocoder"] = Trueprint("Vocoder download completed")print("All model resources preloading completed!")# 在创建Gradio界面之前预加载所有资源# Preload all resources before creating the Gradio interfacepreload_all_resources()# Create Gradio interface
app.py+24-14