diff --git a/README.md b/README.md index ee5f98d..f8a2c63 100644 --- a/README.md +++ b/README.md @@ -44,8 +44,8 @@ Ensure you use Python 3.10 - Python 3.12 versions. git clone https://github.com/zai-org/GLM-TTS.git cd GLM-TTS -# Install dependencies -pip install -r requirements.txt +# Install minimum runtime dependencies +pip install -r requirements-mini.txt # Install reinforcement learning related dependencies (optional) cd grpo/modules diff --git a/README_zh.md b/README_zh.md index ed1453b..a8a11a1 100644 --- a/README_zh.md +++ b/README_zh.md @@ -44,8 +44,8 @@ GLM-TTS 是一个基于大型语言模型的高质量文本到语音(TTS)合成 git clone https://github.com/zai-org/GLM-TTS.git cd GLM-TTS -# 安装依赖 -pip install -r requirements.txt +# 安装最小运行依赖 +pip install -r requirements-mini.txt # 安装强化学习相关依赖(可选) cd grpo/modules diff --git a/cosyvoice/cli/frontend.py b/cosyvoice/cli/frontend.py index 3d752ef..7f51eb6 100644 --- a/cosyvoice/cli/frontend.py +++ b/cosyvoice/cli/frontend.py @@ -41,10 +41,15 @@ import ttsfrd use_ttsfrd = True except ImportError: - print("Warning: failed to import ttsfrd, use WeTextProcessing instead") - from tn.chinese.normalizer import Normalizer as ZhNormalizer - from tn.english.normalizer import Normalizer as EnNormalizer use_ttsfrd = False + try: + print("Warning: failed to import ttsfrd, use WeTextProcessing instead") + from tn.chinese.normalizer import Normalizer as ZhNormalizer + from tn.english.normalizer import Normalizer as EnNormalizer + except ImportError: + print("Warning: failed to import ttsfrd and WeTextProcessing, use wetext instead") + from wetext import Normalizer as ZhNormalizer + from wetext import Normalizer as EnNormalizer class SpeechTokenizer: @@ -144,7 +149,7 @@ def __init__(self, use_phoneme: bool = False): remove_erhua=False, full_to_half=True, remove_interjections=False, - overwrite_cache=True + #overwrite_cache=True ) self.en_tn_model = EnNormalizer() diff --git a/requirements-mini.txt b/requirements-mini.txt new file mode 100644 index 0000000..4662c31 --- /dev/null +++ b/requirements-mini.txt @@ -0,0 +1,21 @@ +torch==2.7.1 +torchaudio +torchvision +transformers +huggingface_hub +modelscope +gradio==5.49.0 +numpy==1.26.4 +contractions +inflect +funasr +onnxruntime-gpu==1.22.0 +pypinyin +emoji +pronouncing +hyperpyyaml +peft +tiktoken +x_transformers +wetext; sys_platform == 'win32' +WeTextProcessing; sys_platform != 'win32' \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index a0c9293..4f7ad73 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,7 +26,7 @@ emoji==2.14.1 evaluation==0.0.2 fastapi==0.123.9 funasr==1.1.6 -gradio==6.1.0 +gradio==5.49.0 HyperPyYAML==1.2.2 jieba==0.42.1 jiwer==4.0.0 diff --git a/tools/gradio_app.py b/tools/gradio_app.py index 9164f87..75a65bb 100644 --- a/tools/gradio_app.py +++ b/tools/gradio_app.py @@ -11,6 +11,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import onnxruntime +onnxruntime.set_default_logger_severity(3) import gradio as gr import torch import numpy as np @@ -21,6 +23,14 @@ generate_long, DEVICE ) +import argparse + +parser = argparse.ArgumentParser() +parser.add_argument("--server_name", type=str, default="0.0.0.0", help="IP address, change to 0.0.0.0 for LAN access") +parser.add_argument("--server_port", type=int, default=8048, help="Port number to use") +parser.add_argument("--share", action="store_true", help="Whether to enable gradio sharing") +parser.add_argument("--mcp_server", action="store_true", help="Whether to enable mcp server") +args = parser.parse_args() # Configure logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') @@ -157,7 +167,7 @@ def clear_memory(): # --- Gradio UI Layout --- -with gr.Blocks(title="GLMTTS Inference") as app: +with gr.Blocks(title="GLMTTS Inference", theme=gr.themes.Soft()) as app: gr.Markdown("# 🎵 GLMTTS Open Source Demo") gr.Markdown("Zero-shot text-to-speech generation using GLMTTS models.") @@ -220,8 +230,9 @@ def clear_memory(): if __name__ == "__main__": app.queue().launch( - server_name="0.0.0.0", - server_port=8048, - theme=gr.themes.Soft(), - share=False + server_name=args.server_name, + server_port=args.server_port, + share=args.share, + mcp_server=args.mcp_server, + inbrowser=True, ) \ No newline at end of file