Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

質問:recipes/tacotron実行の際のミニバッチサイズの変更方法 #25

Closed
mikapote opened this issue Oct 27, 2021 · 3 comments

Comments

@mikapote
Copy link

第10章第5節Tacotronの学習にてレシピのstage3を実行しているとCudaのメモリ不足のエラーが出たため、ミニバッチサイズを下げることで対応したいと考えたのですが、どのような変更をすればよいか教えていただけないでしょうか。
また、それ以外にもエラーに対処出来る方法があれば教えていただきたいです。

実行環境
wsl2を用いたLinux(Ubuntu)での自機環境
jupyter-labではなくシェル上でレシピを順々に実行
Windows11
Ubuntu 20.04.3 LTS
python3.8.8
GPU NVIDIA GeForce GTX 1650
GPUメモリ12GB
専用GPUメモリ4GB
共有GPUメモリ8GB

エラーメッセージ
RuntimeError: CUDA out of memory. Tried to allocate 12.00 MiB (GPU 0; 4.00 GiB total capacity; 2.31 GiB already allocated; 0 bytes free; 2.45 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

その他に必要な情報がありましたら、いっていただければ返答します。
よろしくお願いします。

@mikapote
Copy link
Author

mikapote commented Nov 1, 2021

シェル上で操作していたので気付かなかったのですが、GoogleColabで見ると設定している箇所がありました。
自分の調査不足でお騒がせしてすみませんでした。

@mikapote mikapote closed this as completed Nov 1, 2021
@r9y9
Copy link
Owner

r9y9 commented Nov 5, 2021

反応が遅くなってしまい申し訳ありません。おっしゃるとおり、https://r9y9.github.io/ttslearn/latest/notebooks/ch10_Recipe-Tacotron.html#%E3%83%AC%E3%82%B7%E3%83%94%E3%81%AE%E8%A8%AD%E5%AE%9A こちらのノートブックにメモリ不足の問題を解消するための設定が記述されています。メモリ不足を避けるための方法がいくつかありますので、以下に列挙します。

  • ミニバッチサイズを下げる (ノートブックに記載のとおりです)
  • reduction factor を大きくする
  • モデルのサイズを小さくする(例えば、PostNetのレイヤー数を小さくする、デコーダの隠れ層の次元数を小さくする、など)

ミニバッチサイズを下げることでもメモリ不足が解消しない場合、reduction factor を大きくすることを試していただくことを推奨します。reduction factorは、1 ~ 5 の間が経験的に問題なく動作することを確認しています。参考にしていただければ幸いです。

@mikapote
Copy link
Author

mikapote commented Nov 8, 2021

ありがとうございます。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants