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

Support CPU training, use CPU on macOS #761

Merged
merged 2 commits into from
Mar 13, 2024
Merged

Conversation

Lion-Wu
Copy link
Contributor

@Lion-Wu Lion-Wu commented Mar 13, 2024

Support CPU training.

In addition, according to #686, models trained with GPU on Macs result in lower quality, and I can also reproduce that.
This is the CPU model:

video_with_audio_2.mp4

And this is the mps model:

video_with_audio_1.mp4

Performance

batch size: 16
CPU:

  • So-VITS: about 8s/it
  • GPT: about 0.6 it/s

mps:

  • So-VITS: about 2s/it
  • GPT: about 4it/s

So I advise to use CPU training on Macs.
Using CPU also "fixes" the memory leak issues, and now all Macs (or almost every computer) can do training.

We can add mps support once the problem is solved.

I haven't tested it on other computers, but it should run on non-GPU devices.

@RVC-Boss RVC-Boss merged commit 3dfbcbc into RVC-Boss:main Mar 13, 2024
@RVC-Boss
Copy link
Owner

可以,虽然慢,但是好歹能听。目前都是m2有问题吗,还是所有m都有问题@Lion-Wu

@XXXXRT666
Copy link
Contributor

M2,我测试下来也是CPU训练好用

@XXXXRT666
Copy link
Contributor

M2 8G去测试了一下不同bs 以及不同精度的速度,sovits训练bs可以调大,bs8时仍在使用统一内存,但是速度受制于算力,跟bs4速度无差别,fp32速度和fp16无差别。GPT训练必须fp32,16-mixed和16会导致速度在0.01-0.03it/s上下波动,但比较奇怪的是性能也没吃满(下图),也许是精度特性,训练速度也受制于算力。
截屏2024-03-14 02 00 11

@Lion-Wu
Copy link
Contributor Author

Lion-Wu commented Mar 14, 2024

可以,虽然慢,但是好歹能听。目前都是m2有问题吗,还是所有m都有问题@Lion-Wu

应该是只要是mps就会出问题,我 M1 也是这样 @RVC-Boss

@Lion-Wu
Copy link
Contributor Author

Lion-Wu commented Mar 14, 2024

M2 8G去测试了一下不同bs 以及不同精度的速度,sovits训练bs可以调大,bs8时仍在使用统一内存,但是速度受制于算力,跟bs4速度无差别,fp32速度和fp16无差别。GPT训练必须fp32,16-mixed和16会导致速度在0.01-0.03it/s上下波动,但比较奇怪的是性能也没吃满(下图),也许是精度特性,训练速度也受制于算力。 截屏2024-03-14 02 00 11

所以现在先用全精度好了,等pytorch、mps优化好了再加上

XXXXRT666 pushed a commit to XXXXRT666/GPT-SoVITS that referenced this pull request Oct 17, 2024
Support CPU training, use CPU on macOS
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

Successfully merging this pull request may close these issues.

3 participants