事象
Coqui TTS の xtts_v2 モデルを使用して tts_to_file
を実行した際に発生しうるエラーに対する解決方法です。
実行環境
- ホストOS: Windows
- Docker コンテナ
- Image: pytorch/pytorch:2.8.0-cuda12.9-cudnn9-runtime
- OS: Ubuntu 22.04
ソースコード
from TTS.api import TTS
tts = TTS('tts_models/multilingual/multi-dataset/xtts_v2')
tts.tts_to_file(
text='テストの文章です',
file_path='/workspace/data/output.wav',
speaker_wav='/workspace/data/input.wav',
language='ja',
)
エラーその1
ModuleNotFoundError: No module named 'cutlet'
エラーその2
その1解決後に発生したもの。
RuntimeError:
Failed initializing MeCab. Please see the README for possible solutions:
https://github.com/polm/fugashi
If you are still having trouble, please file an issue here, and include the
ERROR DETAILS below:
https://github.com/polm/fugashi/issues
issueを英語で書く必要はありません。
------------------- ERROR DETAILS ------------------------
arguments: [b'fugashi', b'-C']
param.cpp(69) [ifs] no such file or directory: /usr/local/etc/mecabrc
----------------------------------------------------------
解決方法
ModuleNotFoundError: No module named 'cutlet'
cutlet
パッケージが足りないので追加する。
> pip install cutlet
no such file or directory: /usr/local/etc/mecabrc
これも実は unidic-lite
( unidic
)が足りないだけなので追加する。
> pip install unidic-lite
補足
今回のエラーをネット調べるとapt install mecab
で mecab をインストールするとか、apt install mecab-ipdadic-utf8
で辞書を追加するとかヒットしますが、自分の環境だと unidic のインストールだけで済みました。