0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Coqui TTS の xtts_v2 モデルを使用した際の mecab エラーの対処法

Posted at

事象

Coqui TTSxtts_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-liteunidic )が足りないだけなので追加する。

> pip install unidic-lite

補足

今回のエラーをネット調べるとapt install mecabmecab をインストールするとか、apt install mecab-ipdadic-utf8で辞書を追加するとかヒットしますが、自分の環境だと unidic のインストールだけで済みました。

fugashiのドキュメントを読むと、unidic が推奨と記載されているので問題ないはず。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?