『Yukarinライブラリ』 become-yukarin, yukarin のトラブルシューティング

# 概要
yukarin, become-yukarin でよくあるエラーとその対策を共有します。
このエラー共有で、道半ばで挫折されないようにとの思いです。(プログラム慣れてない人だとわからないことも多いかと思います)

偉そうなこと書いていますが、これらのエラーはほぼ全て自分も踏みました！
エラーがあれば相談に乗りますので、コメントください(解決できるとは言っていない)。

**トラブル・ご相談**
エラー・トラブルなどございましたら、こちらのDiscordサーバのいらしていただいた方が、対応が早いかと思います。
同好の士もおりますので、是非ご参加ください！

[Yukarinライブラリ Discord サーバ 招待リンク](https://discord.gg/eR3sU2v)

# A. become-yukarin

## A.1 環境設定
### pip のライブラリの挙動が怪しいとき
**原因**
いろんなケースが考えられる

**対策**

```sh
pip uninstall [libname] 
pip --no-cache-dir install -I [libname]
```

## A.2 第1段 学習データ作成

### A.2.1 ValueError: operands could not be broadcast together with shapes (373,21) (1007,21)

**原因**
学習用データを作った時に、違う条件のものが混じってる(違うサンプリングレートのものなど)

**対策**
npy を一度削除して 学習データ作成コマンド(extract_acoustic_feature.py)を再実行

**エラー文例**

```console
yoshikazuoota@localhost:~/Dropbox/dev/deep_yukarin $ python become-yukarin/scripts/extract_acoustic_feature.py \
  -i1 dat/1st_models/aoi/voice_pair/own \
  -i2 dat/1st_models/aoi/voice_pair/target \
  -o1 dat/1st_models/aoi/npy_pair/own \
  -o2 dat/1st_models/aoi/npy_pair/target

...

Traceback (most recent call last):
  File "become-yukarin/scripts/extract_acoustic_feature.py", line 208, in <module>
    main()
  File "become-yukarin/scripts/extract_acoustic_feature.py", line 203, in main
    generate_mean_var(arguments.output1_directory)
  File "become-yukarin/scripts/extract_acoustic_feature.py", line 177, in generate_mean_var
    mfcc=numpy.mean(mfcc_list, axis=0, keepdims=True),
  File "/Users/yoshikazuoota/.pyenv/versions/3.6.3/lib/python3.6/site-packages/numpy/core/fromnumeric.py", line 3118, in mean
    out=out, **kwargs)
  File "/Users/yoshikazuoota/.pyenv/versions/3.6.3/lib/python3.6/site-packages/numpy/core/_methods.py", line 75, in _mean
    ret = umr_sum(arr, axis, dtype, out, keepdims)
ValueError: operands could not be broadcast together with shapes (373,21) (1007,21) 


```



### A.2.2 assert len(paths1) == len(paths2)
**原因**
```scripts/extract_acoustic_feature.py``` 実行時に設定する下記2ディレクトリの数が合わない。
学習用音声はファイル名を合わせて 1対1 対応で配置する必要があります。

- ```-i1 in_1st_my_wav```
- ```-i2 in_1st_yukari_wav```

**対策**
diff tool などを使って、ファイル名の対応が取れているか確認する

- Windows : [WinMerge](http://winmerge.org/?lang=ja)
- Linux : [Meld](https://meldmerge.org/) 

ターミナルでファイル一覧を出力して、テキストで差分をとってもいいと思います。

```sh
ls -1 in_1st_my_wav > in_1st_my_wav_list.txt
ls -1 in_1st_yukari_wav > in_1st_yukari_wav_list.txt
diff in_1st_my_wav_list.txt in_1st_yukari_wav_list.txt 
```

**エラー文例**

```
Traceback (most recent call last):
File "scripts/extract_acoustic_feature.py", line 206, in
main()
File "scripts/extract_acoustic_feature.py", line 193, in main
assert len(paths1) == len(paths2)
AssertionError
```

### A.3.1 ValueError: Axis dimension mismatch
**原因**
params.py のオーダーや、config.json の設定の整合性が取れていない(場合が多いと思う)

**対応**
一度、npyデータなど、一式を削除してやり直す。

```console
attic@deeplearning:~/voice/become-yukarin$  python train.py dat/in_zun_1st/config_add_network_noise_cut_rerecord01_vr2.json dat/model/zun_1st_art503_2019_06_10_add_network_low_noise_cut_rerecord01_vr2 
Exception in main training loop: Axis dimension mismatch
Traceback (most recent call last):
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/training/trainer.py", line 316, in run
    update()
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/training/updaters/standard_updater.py", line 175, in update
    self.update_core()
  File "/home/attic/voice/become-yukarin/become_yukarin/updater/updater.py", line 84, in update_core
    loss = self.forward(**batch)
  File "/home/attic/voice/become-yukarin/become_yukarin/updater/updater.py", line 65, in forward
    output = self.predictor(input)
  File "/home/attic/voice/become-yukarin/become_yukarin/model/model.py", line 137, in __call__
    return self.decoder(self.encoder(x))
  File "/home/attic/voice/become-yukarin/become_yukarin/model/model.py", line 93, in __call__
    hs = [F.leaky_relu(self.c0(x))]
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/link.py", line 294, in __call__
    out = forward(*args, **kwargs)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/links/connection/convolution_nd.py", line 162, in forward
    dilate=self.dilate, groups=self.groups)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/functions/connection/convolution_nd.py", line 496, in convolution_nd
    y, = fnode.apply(args)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/function_node.py", line 321, in apply
    outputs = self.forward(in_data)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/functions/connection/convolution_nd.py", line 188, in forward
    return self._forward_xp(x, W, b, cuda.cupy)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/functions/connection/convolution_nd.py", line 86, in _forward_xp
    return self._forward_xp_core(x, W, b, xp)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/functions/connection/convolution_nd.py", line 146, in _forward_xp_core
    y = xp.tensordot(col, W, (axes, axes)).astype(x.dtype, copy=False)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/cupy/linalg/product.py", line 183, in tensordot
    raise ValueError('Axis dimension mismatch')
Will finalize trainer extensions and updater before reraising the exception.
Traceback (most recent call last):
  File "train.py", line 83, in <module>
    trainer.run()
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/training/trainer.py", line 349, in run
    six.reraise(*exc_info)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/six.py", line 693, in reraise
    raise value
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/training/trainer.py", line 316, in run
    update()
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/training/updaters/standard_updater.py", line 175, in update
    self.update_core()
  File "/home/attic/voice/become-yukarin/become_yukarin/updater/updater.py", line 84, in update_core
    loss = self.forward(**batch)
  File "/home/attic/voice/become-yukarin/become_yukarin/updater/updater.py", line 65, in forward
    output = self.predictor(input)
  File "/home/attic/voice/become-yukarin/become_yukarin/model/model.py", line 137, in __call__
    return self.decoder(self.encoder(x))
  File "/home/attic/voice/become-yukarin/become_yukarin/model/model.py", line 93, in __call__
    hs = [F.leaky_relu(self.c0(x))]
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/link.py", line 294, in __call__
    out = forward(*args, **kwargs)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/links/connection/convolution_nd.py", line 162, in forward
    dilate=self.dilate, groups=self.groups)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/functions/connection/convolution_nd.py", line 496, in convolution_nd
    y, = fnode.apply(args)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/function_node.py", line 321, in apply
    outputs = self.forward(in_data)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/functions/connection/convolution_nd.py", line 188, in forward
    return self._forward_xp(x, W, b, cuda.cupy)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/functions/connection/convolution_nd.py", line 86, in _forward_xp
    return self._forward_xp_core(x, W, b, xp)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/functions/connection/convolution_nd.py", line 146, in _forward_xp_core
    y = xp.tensordot(col, W, (axes, axes)).astype(x.dtype, copy=False)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/cupy/linalg/product.py", line 183, in tensordot
    raise ValueError('Axis dimension mismatch')
ValueError: Axis dimension mismatch

```

### A.3.2 FileNotFoundError: [Errno 2] No such file or directory: [file_path or dir_path]
**原因**
パスの指定間違い

**対応**
パスをチェック

**エラー文例**

```console
attic@deeplearning:~/voice/become-yukarin$ python train.py dat/in_zun_1st/config_add_network_noise_cut_rerecord01_vr2_2.json dat/model/zun_1st_art503_2019_06_10_add_network_low_noise_cut_rerecord01_vr2
Traceback (most recent call last):
  File "train.py", line 37, in <module>
    dataset = create_dataset(config.dataset)
  File "/home/attic/voice/become-yukarin/become_yukarin/dataset/dataset.py", line 453, in create
    target_mean = acoustic_feature_load_process(config.target_mean_path, test=True)
  File "/home/attic/voice/become-yukarin/become_yukarin/dataset/dataset.py", line 185, in __call__
    d: Dict[str, Any] = numpy.load(path.expanduser(), allow_pickle=True).item()
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/numpy/lib/npyio.py", line 415, in load
    fid = open(os_fspath(file), "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'dat/out_zun_1st/in_zunVoice_art503_44100_vr/mean.npy'
```

### A.3.3 ModuleNotFoundError: No module named 'become_yukarin'
**原因**
PYTHONPATH の設定ミス。

**対応**
下記コマンドなどで、PYTHONPATH を設定してください。

```sh
cd /home/[user_name]/become-yukarin
PYTHONPATH=`pwd`
```

どうしてもうまくいかない場合は、先頭に``` PYTHONPATH=`pwd` ```を付ける。

```sh
PYTHONPATH=`pwd` [各種コマンド]
```

**エラー文例(いくつかパターンがあるようです)**

```
Traceback (most recent call last):
File "scripts/voice_conversion_test.py", line 11, in
from become_yukarin import AcousticConverter
ModuleNotFoundError: No module named 'become_yukarin'
```


## A.4 第2段 学習データ作成時

### A.4.1 ```LLVM ERROR: out of memory```
**原因**
メモリ不足(だと思う)

**対応**
繰り返し実行すれば、エラーで変換できなかったデータを再計算してくれる。

**エラー文例**

```console
attic@localhost:~/Dropbox/dev/deep_yukarin $ python become-yukarin/scripts/extract_spectrogram_pair.py -i dat/voice_src/voice_44100/aoi_voice_single/ -o dat/2nd_models/aoi/npy_single
...
LLVM ERROR: out of memory
```

### A.4.2  error! test_data_sr/hoge.wav などで音声変換できない

**追記**
本家リポジトリに修正が入り、```print(traceback.format_exc())``` への修正は必要なくなりました！

**原因**
過去のケースでは、ffmpeg のインストールをしていない。
（これ、自分の環境構築の記事に書いてなくてすいません）

**対応**
下記の、エラー詳細出力の修正は必要なくなりました。最新の become-yukarin では修正済みとなっています。

ffmpeg のインストールで改善しない場合は、エラー表示から原因を探ってください！
わからなければ、コメントに投げて貰えれば、一緒に調べます！


~~ffmpeg のインストールで改善しない場合は、下記の手順でエラー出力をして、見てください。~~
~~エラートレース文が表示されます。~~

~~(1) script/super_resolution_test.py を編集する~~
~~エディタで　super_resolution_test.py を開き 65行あたりにあ~~る。

~~`traceback.format_exc()`~~

~~を~~

~~`print(traceback.format_exc())`~~

~~に、書き換えてください。~~

~~(2) エラーが出た場合と同じように実行する~~
~~これにより、~~
~~`error! test_data_sr/hoge.wav`~~
~~の下にエラー詳細が表示されます。~~

### A.4.3 Expect: in_types[0].shape[2] == in_types[1].shape[2] Actual: 6 != 7
**原因**
原因不明。
log 出力をする updater でエラーが出ているようですが、よくわからない。

become-yukarin の issue にも同様のエラーが報告されていますが、ヒホ様も思い当たる節がないとのことです。
https://github.com/Hiroshiba/become-yukarin/issues/39

**対応**
config.json(config_sr.json) の ```log_iteration```を大きな値にする。  
副作用として、学習の log ファイル(学習精度チェック用ファイル)が出力されなくなります。

```
    "log_iteration": 10000000000,
```    

自分も同じエラーを出したことがありますが、色々いじっているうちに消えてしまいました。  
最初から手順をやり直すことで治るのかもしれません。

**エラー文例(いくつかパターンがあるようです)**

```
/home/name/.local/lib/python3.6/site-packages/chainer/functions/normalization/batch_normalization.py:67: UserWarning: A batch with no more than one sample has been given to F.batch_normalization. F.batch_normalization will always output a zero tensor for such batches. This could be caused by incorrect configuration in your code (such as running evaluation while chainer.config.train=True), but could also happen in the last batch of training if non-repeating iterator is used.
UserWarning)
predictor/loss
Exception in main training loop:
Invalid operation is performed in: Concat (Forward)

Expect: in_types[0].shape[2] == in_types[1].shape[2]
Actual: 6 != 7
Traceback (most recent call last):
File "/home/name/.local/lib/python3.6/site-packages/chainer/training/trainer.py", line 309, in run
entry.extension(self)
File "/home/name/.local/lib/python3.6/site-packages/chainer/training/extensions/evaluator.py", line 157, in call
result = self.evaluate()
File "/home/name/.local/lib/python3.6/site-packages/chainer/training/extensions/evaluator.py", line 211, in evaluate
eval_func(in_arrays)
File "/media/name/ボリューム/become-yukarin-master/become_yukarin/updater/sr_updater.py", line 61, in forward
output = self.predictor(input)
File "/media/name/ボリューム/become-yukarin-master/become_yukarin/model/sr_model.py", line 101, in call
return self.decoder(self.encoder(x))
File "/media/name/ボリューム/become-yukarin-master/become_yukarin/model/sr_model.py", line 85, in call
h = F.concat([h, hs[-i - 1]])
File "/home/name/.local/lib/python3.6/site-packages/chainer/functions/array/concat.py", line 105, in concat
y, = Concat(axis).apply(xs)
File "/home/name/.local/lib/python3.6/site-packages/chainer/function_node.py", line 243, in apply
self.check_data_type_forward(in_data)
File "/home/name/.local/lib/python3.6/site-packages/chainer/function_node.py", line 328, in check_data_type_forward
self.check_type_forward(in_type)
File "/home/name/.local/lib/python3.6/site-packages/chainer/functions/array/concat.py", line 41, in check_type_forward
type_check.expect(in_types[0].shape[d] == in_types[i].shape[d])
File "/home/name/.local/lib/python3.6/site-packages/chainer/utils/type_check.py", line 524, in expect
expr.expect()
File "/home/name/.local/lib/python3.6/site-packages/chainer/utils/typecheck.py", line 482, in expect
'{0} {1} {2}'.format(left, self.inv, right))
Will finalize trainer extensions and updater before reraising the exception.
Traceback (most recent call last):
File "trainsr.py", line 84, in
trainer.run()
File "/home/name/.local/lib/python3.6/site-packages/chainer/training/trainer.py", line 320, in run
six.reraise(*sys.exc_info())
File "/home/name/.local/lib/python3.6/site-packages/six.py", line 693, in reraise
raise value
File "/home/name/.local/lib/python3.6/site-packages/chainer/training/trainer.py", line 309, in run
entry.extension(self)
File "/home/name/.local/lib/python3.6/site-packages/chainer/training/extensions/evaluator.py", line 157, in call
result = self.evaluate()
File "/home/name/.local/lib/python3.6/site-packages/chainer/training/extensions/evaluator.py", line 211, in evaluate
eval_func(in_arrays)
File "/media/name/ボリューム/become-yukarin-master/become_yukarin/updater/sr_updater.py", line 61, in forward
output = self.predictor(input)
File "/media/name/ボリューム/become-yukarin-master/become_yukarin/model/sr_model.py", line 101, in call
return self.decoder(self.encoder(x))
File "/media/name/ボリューム/become-yukarin-master/become_yukarin/model/sr_model.py", line 85, in call
h = F.concat([h, hs[-i - 1]])
File "/home/name/.local/lib/python3.6/site-packages/chainer/functions/array/concat.py", line 105, in concat
y, = Concat(axis).apply(xs)
File "/home/name/.local/lib/python3.6/site-packages/chainer/function_node.py", line 243, in apply
self.check_data_type_forward(in_data)
File "/home/name/.local/lib/python3.6/site-packages/chainer/function_node.py", line 328, in check_data_type_forward
self.check_type_forward(in_type)
File "/home/name/.local/lib/python3.6/site-packages/chainer/functions/array/concat.py", line 41, in checktype_forward
type_check.expect(in_types[0].shape[d] == in_types[i].shape[d])
File "/home/name/.local/lib/python3.6/site-packages/chainer/utils/typecheck.py", line 524, in expect
expr.expect()
File "/home/name/.local/lib/python3.6/site-packages/chainer/utils/type_check.py", line 482, in expect
'{0} {1} {2}'.format(left, self.inv, right))
chainer.utils.type_check.InvalidType:
Invalid operation is performed in: Concat (Forward)

Expect: in_types[0].shape[2] == in_types[1].shape[2]
Actual: 6 != 7
```

##### エラー文例
表示されない。
上記の対応をしないと、エラー文が出力されない。

## B. yukarin

### B.1 環境設定

#### imageio のバージョン不整合 
**原因**
未特定

**対応**
エラーは出ているが、一応動く。

**エラー文**

```
ERROR: moviepy 1.0.0 has requirement imageio<2.5,>=2.0; python_version < "3.4", but you'll have imageio 2.5.0 which is incompatible.
```

```
ERROR: moviepy 1.0.0 has requirement imageio<3.0,>=2.5; python_version >= "3.4", but you'll have imageio 2.4.1 which is incompatible.
```

### B.2 第1段 train.py 学習時のエラー

#### B.2.1 aligned_indexes 作り忘れ

**原因**
aligned_indexes 作り忘れ。

**対応**
aligned_indexesを作る

**エラー文例**

```console
attic@deeplearning:~/voice/yukarin$ python train.py     ./dat/1st_models/zun_voice_set/config.json     ./dat/1st_models/zun_voice_set/zun_model
Exception in main training loop: Epoch size must be positive for an iterator that repeats.
Traceback (most recent call last):
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/training/trainer.py", line 316, in run
    update()
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/training/updaters/standard_updater.py", line 175, in update
    self.update_core()
  File "/home/attic/voice/yukarin/yukarin/updater.py", line 87, in update_core
    batch = self.get_iterator('main').next()
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/iterators/multiprocess_iterator.py", line 149, in __next__
    self.dataset_timeout)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/iterators/multiprocess_iterator.py", line 392, in measure
    self.order_sampler, len(self.dataset))
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/iterators/_statemachine.py", line 21, in iterator_statemachine
    raise ValueError('Epoch size must be positive for an iterator '
Will finalize trainer extensions and updater before reraising the exception.
Traceback (most recent call last):
  File "train.py", line 107, in <module>
    trainer.run()
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/training/trainer.py", line 349, in run
    six.reraise(*exc_info)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/six.py", line 693, in reraise
    raise value
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/training/trainer.py", line 316, in run
    update()
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/training/updaters/standard_updater.py", line 175, in update
    self.update_core()
  File "/home/attic/voice/yukarin/yukarin/updater.py", line 87, in update_core
    batch = self.get_iterator('main').next()
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/iterators/multiprocess_iterator.py", line 149, in __next__
    self.dataset_timeout)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/iterators/multiprocess_iterator.py", line 392, in measure
    self.order_sampler, len(self.dataset))
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/iterators/_statemachine.py", line 21, in iterator_statemachine
    raise ValueError('Epoch size must be positive for an iterator '
ValueError: Epoch size must be positive for an iterator that repeats.
```


### B.3 音声変換時のエラー

#### B.3.1 convert_loop エラー
**原因**
ライブラリの become-yukarin のバージョンが古いので convert_loop メソッドが見つからない

**対応**
ライブラリとしてインストールしている、become-yukarin を削除して、
キャッシュ無効化して再インストール。

```sh
pip uninstall became-yukarin
pip --no-cache-dir install -I git+https://github.com/Hiroshiba/become-yukarin
```

**エラー文例**

```
Traceback (most recent call last):
  File "scripts/voice_change.py", line 100, in process
    s_high = super_resolution.convert_loop(f_low.sp.astype(numpy.float32))
AttributeError: 'SuperResolution' object has no attribute 'convert_loop'

```


### B.3.2 cupy.cuda.memory.OutOfMemoryError: out of memory to allocate  
**原因**
GPU メモリが足りない？
音声合成処理をパラレルに実行しているので、直列化すれば改善するかも？
当初、音声周波数を44100Hzで実行していましたが、デフォルトの24000Hzで実行した時は、このエラーは出なかった。

**対応 1(筆者未確認)**
ヒホ様によると『generator_base_channelsの値を小さくすると解決するかも（チャンネル数がこの乗数に比例する）』

[ヒホさんのツイート](https://twitter.com/hiho_karuta/status/1144638131171282944)

**対応 2(筆者未確認)**
下記記事をためしてしてみる(プログラムをいじる必要あり)。
[Unified Memoryを使ってGPUメモリよりも大きなモデルをChainerで扱う](https://qiita.com/koreyou/items/4494442eb71bea0bb5b2)

**対応 3**
再起動。

**エラー文例**

```
Traceback (most recent call last):
  File "scripts/voice_change.py", line 100, in process
    s_high = super_resolution.convert_loop(f_low.sp.astype(numpy.float32))
  File "/home/attic/voice/become-yukarin/become_yukarin/super_resolution.py", line 73, in convert_loop
    o_warp = self.convert(f)
  File "/home/attic/voice/become-yukarin/become_yukarin/super_resolution.py", line 53, in convert
    out = self.model(inputs).data[0]
  File "/home/attic/voice/become-yukarin/become_yukarin/model/sr_model.py", line 101, in __call__
    return self.decoder(self.encoder(x))
  File "/home/attic/voice/become-yukarin/become_yukarin/model/sr_model.py", line 85, in __call__
    h = F.concat([h, hs[-i - 1]])
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/functions/array/concat.py", line 108, in concat
    y, = Concat(axis).apply(xs)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/function_node.py", line 321, in apply
    outputs = self.forward(in_data)
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/chainer/functions/array/concat.py", line 52, in forward
    return xp.concatenate(xs, self.axis),
  File "/home/attic/.pyenv/versions/3.6.3/lib/python3.6/site-packages/cupy/manipulation/join.py", line 49, in concatenate
    return core.concatenate_method(tup, axis)
  File "cupy/core/_routines_manipulation.pyx", line 563, in cupy.core._routines_manipulation.concatenate_method
  File "cupy/core/_routines_manipulation.pyx", line 608, in cupy.core._routines_manipulation.concatenate_method
  File "cupy/core/_routines_manipulation.pyx", line 637, in cupy.core._routines_manipulation._concatenate
  File "cupy/core/core.pyx", line 134, in cupy.core.core.ndarray.__init__
  File "cupy/cuda/memory.pyx", line 518, in cupy.cuda.memory.alloc
  File "cupy/cuda/memory.pyx", line 1085, in cupy.cuda.memory.MemoryPool.malloc
  File "cupy/cuda/memory.pyx", line 1106, in cupy.cuda.memory.MemoryPool.malloc
  File "cupy/cuda/memory.pyx", line 934, in cupy.cuda.memory.SingleDeviceMemoryPool.malloc
  File "cupy/cuda/memory.pyx", line 949, in cupy.cuda.memory.SingleDeviceMemoryPool._malloc
  File "cupy/cuda/memory.pyx", line 697, in cupy.cuda.memory._try_malloc
cupy.cuda.memory.OutOfMemoryError: out of memory to allocate 402653184 bytes (total 3209814528 bytes)
```

### B.3.3 ValueError: Mismatched dimensionality (spec size) between spectrogram (1025) and aperiodicity (513)
**原因**
音声特徴量抽出(scripts/extract_spectrogram_pair.py)をする際、pラメータなどの条件が違うデータが混入している。

**対応**
npyファイルを削除して、やり直す。

```console
attic@ubuntu-win:~/voice/yukarin$ python scripts/voice_change_sereal.py     --voice_changer_model_dir './dat/1st_models/zun_voice_set/zun_model'     --voice_changer_config './dat/1st_models/zun_voice_set/config.json'     --voice_changer_model_iteration 450000     --super_resolution_model './dat/2nd_models/zun/predictor_140000.npz'     --super_resolution_config './dat/2nd_models/zun/config.json'     --input_statistics 'dat/1st_models/zun_voice_set/statistics/my.npy'     --target_statistics 'dat/1st_models/zun_voice_set/statistics/zun.npy'     --out_sampling_rate 41000     --dataset_target_wave_dir 'dat/voice_src/zun_voice_set/in_zunVoice_44100'     --dataset_input_wave_dir 'dat/1st_models/zun_voice_set/out_myVoice_44100'     --test_wave_dir './test_my_voice'     --output_dir './output/'     --gpu 0
Loaded acoustic converter model "dat/1st_models/zun_voice_set/zun_model/predictor_450000.npz"
Loaded super resolution model "dat/2nd_models/zun/predictor_140000.npz"
Traceback (most recent call last):
  File "scripts/voice_change_sereal.py", line 152, in process
    wave = super_resolution.convert_to_audio(s_high, acoustic_feature=f_low_sr, sampling_rate=rate)
  File "/home/attic/voice/become-yukarin/become_yukarin/super_resolution.py", line 109, in convert_to_audio
    frame_period=self._param.acoustic_feature_param.frame_period,
  File "pyworld/pyworld.pyx", line 430, in pyworld.pyworld.synthesize
ValueError: Mismatched dimensionality (spec size) between spectrogram (1025) and aperiodicity (513)
Traceback (most recent call last):
  File "scripts/voice_change_sereal.py", line 152, in process
    wave = super_resolution.convert_to_audio(s_high, acoustic_feature=f_low_sr, sampling_rate=rate)
  File "/home/attic/voice/become-yukarin/become_yukarin/super_resolution.py", line 109, in convert_to_audio
    frame_period=self._param.acoustic_feature_param.frame_period,
  File "pyworld/pyworld.pyx", line 430, in pyworld.pyworld.synthesize
ValueError: Mismatched dimensionality (spec size) between spectrogram (1025) and aperiodicity (513)
Traceback (most recent call last):
  File "scripts/voice_change_sereal.py", line 152, in process
    wave = super_resolution.convert_to_audio(s_high, acoustic_feature=f_low_sr, sampling_rate=rate)
  File "/home/attic/voice/become-yukarin/become_yukarin/super_resolution.py", line 109, in convert_to_audio
    frame_period=self._param.acoustic_feature_param.frame_period,
  File "pyworld/pyworld.pyx", line 430, in pyworld.pyworld.synthesize
ValueError: Mismatched dimensionality (spec size) between spectrogram (1025) and aperiodicity (513)
```



### b.3.4 ModuleNotFoundError: No module named '_tkinter'
**原因**
tkinter がない
 
**対応**

```sh
sudo apt install python3-tk
```

それでダメなら、下記コマンド等で python を削除して最初から pip のインストールをやり直す

```sh
pyenv uninstall 3.6.X
pyenv install 3.6.X
```

**エラー文例**

```console
yoshikazuoota@localhost:~/Documents/voice/yukarin $ python scripts/voice_change_serial.py \
    --voice_changer_model_dir './dat/1st_models/zun_voice_set/zun_model' \
    --voice_changer_config './dat/1st_models/zun_voice_set/config.json' \
    --voice_changer_model_iteration 450000 \
    --super_resolution_model './dat/2nd_models/zun/predictor_140000.npz' \
    --super_resolution_config './dat/2nd_models/zun/config.json' \
    --input_statistics 'dat/1st_models/zun_voice_set/statistics/my.npy' \
    --target_statistics 'dat/1st_models/zun_voice_set/statistics/zun.npy' \
    --out_sampling_rate 41000 \
    --dataset_target_wave_dir 'dat/voice_src/zun_voice_set/in_zunVoice_44100' \
    --dataset_input_wave_dir 'dat/1st_models/zun_voice_set/out_myVoice_44100' \
    --test_wave_dir './test_my_voice' \
    --output_dir './output/'
Traceback (most recent call last):
  File "scripts/voice_change_sereal.py", line 9, in <module>
    import matplotlib.pyplot as plt
  File "/Users/yoshikazuoota/.pyenv/versions/3.6.8/lib/python3.6/site-packages/matplotlib/pyplot.py", line 2349, in <module>
    switch_backend(rcParams["backend"])
  File "/Users/yoshikazuoota/.pyenv/versions/3.6.8/lib/python3.6/site-packages/matplotlib/pyplot.py", line 215, in switch_backend
    backend_mod = importlib.import_module(backend_name)
  File "/Users/yoshikazuoota/.pyenv/versions/3.6.8/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/Users/yoshikazuoota/.pyenv/versions/3.6.8/lib/python3.6/site-packages/matplotlib/backends/backend_tkagg.py", line 1, in <module>
    from . import _backend_tk
  File "/Users/yoshikazuoota/.pyenv/versions/3.6.8/lib/python3.6/site-packages/matplotlib/backends/_backend_tk.py", line 6, in <module>
    import tkinter as tk
  File "/Users/yoshikazuoota/.pyenv/versions/3.6.8/lib/python3.6/tkinter/__init__.py", line 36, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'
```


### 最後に
他に発見したエラーがあれば、教えてください。
あと、自分にコメントくれれば、対応方法を調べてみます(解決できるとは言っていない)。

1人でも多くの人が、楽しい音質変換ライフを送れることを！