← BACK TO BLOG

WhisperLiveKit安装记录

WhisperLiveKit 的安装与部署记录,包括服务启动、自签名证书、conda 环境导入及 torch 版本不匹配等问题。

次阅读

仓库地址:

https://github.com/whl88/WhisperLiveKit

相关命令

启动

bash
nohup whisperlivekit-server --model large-v3 --host 0.0.0.0 --port 8081 --ssl-certfile ./cert.pem --ssl-keyfile key.pem --language zh > run.log 2>&1 &
tail -f run.log

生成自签名证书

bash
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 -nodes

导入conda环境

environment.yml

问题:

1. torch版本不匹配

bash
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
torchaudio 2.7.1 requires torch==2.7.1, but you have torch 2.3.1 which is incompatible.
torchvision 0.22.1 requires torch==2.7.1, but you have torch 2.3.1 which is incompatible.

解决:

torchaudiotorchvision依赖的torch版本不够,升一下版本

bash
pip install torch==2.7.1ip install torch==2.7.1

2. 模型在huggingface上,如果国内部署,可能下载缓慢,可以手动下载

huggingface手动下载模型,并放在到models文件夹下。

bash
git clone https://huggingface.co/mlx-community/whisper-large-v2-mlx

下载到本地后可以用命令指定模型目录来启动,--model参数换成--model_dir。例如:

bash
whisperlivekit-server --model_dir /home/user/workspace/whisper_streaming/model/faster-whisper-large-v2 --host 0.0.0.0 --port 8081 --ssl-certfile ./cert.pem --ssl-keyfile key.pem --language zh

可用的模型如下,跟据需要下载:

模型大小 (Size) 参数量 (Parameters) 英文模型 (English-only model) 多语言模型 (Multilingual model) 所需显存 (Required VRAM) 相对速度 (Relative speed)
tiny 39 M tiny.en tiny ~1 GB ~10x
base 74 M base.en base ~1 GB ~7x
small 244 M small.en small ~2 GB ~4x
medium 769 M medium.en medium ~5 GB ~2x
large 1550 M N/A large ~10 GB 1x
turbo 809 M N/A turbo ~6 GB ~8x

3. Unable to load any of {libcudnn_ops.so.9.1.0, libcudnn_ops.so.9.1, libcudnn_ops.so.9, libcudnn_ops.so}

没有安装cudnn

bash
INFO    Audio duration is: 25.11 seconds
INFO    Loading Whisper large-v2 model for zh...
DEBUG   Loading whisper model from model_dir /home/user/workspace/whisper_streaming/model/faster-whisper-large-v2. modelsize and cache_dir parameters are not used.
INFO    done. It took 2.27 seconds.
Unable to load any of {libcudnn_ops.so.9.1.0, libcudnn_ops.so.9.1, libcudnn_ops.so.9, libcudnn_ops.so}
Invalid handle. Cannot load symbol cudnnCreateTensorDescriptor

解决:

cudd下载页,下载并安装相应版本。下载需要确定linux分支的版本,以下是相关命令

  • 查看系统版本:lsb_release -a
  • 查看cuda版本:nvcc --version