Downloads · 30 days
0
cydxg/glm-4-voice-9b-int4
glm-4-voice-9b-int4 is a machine learning model from cydxg. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Nov 1, 2024
Repo size
9.3 GB
Likes
27
Public
Click a slice to open those files.
.safetensors8.8 GB · 94%
From the Hugging Face model README
GLM-4-Voice 是智谱 AI 推出的端到端语音模型。GLM-4-Voice 能够直接理解和生成中英文语音,进行实时语音对话,并且能够根据用户的指令改变语音的情感、语调、语速、方言等属性。 本仓库是GLM-4-Voice-9B经过INT4量化的版本。经过优化后,显存需求显著降低,仅需12GB显存即可运行。经过测试,该模型可在NVIDIA GeForce RTX 3060 12GB显卡上流畅运行。
首先,确保使用Python 3.10,创建虚拟环境:
# 亲测不支持python3.8/3.9/3.12,存在库兼容问题
conda create -n GLM-4-Voice python=3.10
激活虚拟环境后,克隆模型和代码:
conda activate GLM-4-Voice
git clone https://huggingface.co/cydxg/glm-4-voice-9b-int4
对于中国大陆用户,可以使用以下命令进行克隆:
git clone https://hf-mirror.com/cydxg/glm-4-voice-9b-int4
进入模型目录并安装所需依赖:
cd glm-4-voice-9b-int4
conda install -c conda-forge openfst
conda install -c conda-forge pynini==2.1.5
pip install -r requirements.txt
mkdir third_party
cd third_party
git clone https://github.com/shivammehta25/Matcha-TTS Matcha-TTS
# 根据自己的CUDA版本选择torch
conda install pytorch==2.4.1 torchvision==0.19.1 torchaudio==2.4.1 pytorch-cuda=12.4 -c pytorch -c nvidia
首先启动模型服务:
python model_server.py
接着运行网页Demo以访问模型:
python web_demo.py
即可通过访问 http://localhost:8888 来使用模型。
如果运行web_demo提示没有matcha.models
ModuleNotFoundError: No module named 'matcha.models'; 'matcha' is not a package
则需安装matcha-tts
# 先卸载 gradio 和 diffusers ,避免出现版本冲突
pip uninstall gradio
pip uninstall diffusers
pip install matcha-tts