多報酬強化学習による制御可能で感情表現豊かなゼロショットTTS「GLM-TTS」をWindows + Dockerで動かす

初めに

最近出てきた以下のTTSを触ってみます

github.com

アーキテクチャは以下のようになっています

  1. LLM (Llama): テキスト → 音声トークン列を生成
  2. Flow Matching: 音声トークン → メルスペクトログラム → ボコーダーで波形生成

依存ライブラリにWeTextProcessingがあるため、WindowsMacでは動かすのが大変なのでDockerを使うことが推奨されます

Windowsでインストールしようとすると以下のエラーが出ました。

error: Unable to find a compatible Visual Studio installation

この記事では Docker版に対応したリポジトリを公開しており、こちらを元に進めていきます

github.com

開発環境

  • Windows 11
  • RTX 4070 ti super
  • Docker

環境構築

リポジトリのクローンします

git clone https://github.com/ayutaz/GLM-TTS.git
cd GLM-TTS

Dockerビルド前にモデルをダウンロードしておきます(約10GB):

# ディレクトリ作成
mkdir ckpt

# HuggingFace CLIでダウンロード
pip install huggingface-hub
huggingface-cli download zai-org/GLM-TTS --local-dir ckpt

Dockerイメージのビルドします

docker compose build

推論

CLI推論で確認:

# 中国語サンプル
docker compose --profile cli run --rm glm-tts-cli

# 英語サンプル
docker compose --profile cli run --rm glm-tts-cli python glmtts_inference.py --data=example_en --exp_name=_test_en --use_cache

Web UI(Gradio)で確認:

docker compose up glm-tts