Edit model card

GLM-4-Voice-9B (INT4 Quantized)

中文 | English

模型简介

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

接着运行网页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
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference API
Unable to determine this model's library. Check the docs .

Model tree for cydxg/glm-4-voice-9b-int4

Quantized
(2)
this model