w-okada / voice-changer

リアルタイムボイスチェンジャー Realtime Voice Changer
Other
15.28k stars 1.64k forks source link

[ISSUE]: High CPU-Usage in combination with Nvidia and AMD #1187

Open Inazumanotenshi opened 2 months ago

Inazumanotenshi commented 2 months ago

Voice Changer Version

MMVCServerSIO_win_onnxgpu-cuda_v.1.5.3.18a.zip

Operational System

Windows 11 Pro

GPU

GPU0: NVIDIA GeForce RTX 3070 Ti - GPU1: AMD Radeon RX 7800XT (order doesnt matter, tested also switched)

Read carefully and check the options

Model Type

RVC

Issue Description

I selected on GPU my RTX 3070ti(8GB). When I dont use the additional arguments "--device_id 0 ^" and "--CUDA_VISIBLE_DEVICES 1" it says after switching to fcpe that no CUDA-device is found. With it the issue still exists but the error doesnt show up.

Even when it says it it falls back to cpu its still using the gpu too (so GPU usage then at 50% and CPU at 100%).

Maybe its just a windows setting I need to change? Maybe its an argument thats not working? I've tried set all exe's in Windows graphic-settings to use the RTX 3070ti, also tried without it (no changes).

Is there a work around? (VR with already 100% CPU with it in Windows idle is extremely hard ^^")

Issue happens/visible in: Windows idle usage (CPU: 80-100%, GPU0: 50-70%, GPU1: 2% when voice changer used) Hardware: CPU: Ryzen 5 5600X GPU0: RTX 3070ti 8GB (MSI) GPU1: Radeon RX 7800XT 16GB (AMD) RAM: 32GB

I also tried some settings on Windows that takes more GPU usage, no changes.

Application Screenshot

No response

Logs on console

C:\Users[name]\Documents\TestAi\1\MMVCServerSIO>MMVCServerSIO.exe -p 18888 --https false --content_vec_500 pretrain/checkpoint_best_legacy_500.pt --content_vec_500_onnx pretrain/content_vec_500.onnx --content_vec_500_onnx_on true --hubert_base pretrain/hubert_base.pt --hubert_base_jp pretrain/rinna_hubert_base_jp.pt --hubert_soft pretrain/hubert/hubert-soft-0d54a1f4.pt --nsf_hifigan pretrain/nsf_hifigan/model --crepe_onnx_full pretrain/crepe_onnx_full.onnx --crepe_onnx_tiny pretrain/crepe_onnx_tiny.onnx --rmvpe pretrain/rmvpe.pt --model_dir model_dir --samples samples.json Booting PHASE :main PYTHON:3.10.11 (tags/v3.10.11:7d4cc5a, Apr 5 2023, 00:38:17) [MSC v.1929 64 bit (AMD64)] Activating the Voice Changer. [Voice Changer] download sample catalog. samples_0004_t.json [Voice Changer] download sample catalog. samples_0004_o.json [Voice Changer] download sample catalog. samples_0004_d.json [Voice Changer] model_dir is already exists. skip download samples. Internal_Port:18888 protocol: HTTP


Please open the following URL in your browser.
http://<IP>:<PORT>/
In many cases, it will launch when you access any of the following URLs.
http://127.0.0.1:18888/

[VCClient] Access http://127.0.0.1:18888/ [VCClient] wait web server...0 http://127.0.0.1:18888/ [Voice Changer] generate new embedder. (no embedder) [Voice Changer] Loading index... [Voice Changer] Index file is not found [VCClient] wait web server... done 200 [2024-04-15 10:33:06] connet sid : SVGj9DelaIwLI1NbAAAC [2024-04-15 10:33:06] connet sid : d_TKC3fbFrSqOaQaAAAD [Voice Changer] update configuration: modelSlotIndex 1713170002006 Pipeline has been deleted [Voice Changer] update configuration: modelSlotIndex 1713170002006 gin_channels: 256 self.spk_embed_dim: 109 [Voice Changer] generate new embedder. (anyway) [Voice Changer] Loading index... [Voice Changer] Index file is not found Pipeline has been deleted gin_channels: 256 self.spk_embed_dim: 109 [Voice Changer] generate new embedder. (anyway) [Voice Changer] Loading index... [Voice Changer] Index file is not found [Voice Changer] update configuration: f0Detector rmvpe [Voice Changer] update configuration: f0Detector fcpe [INFO]: device is not None, use cuda:0 [INFO] > call by:torchfcpe.tools.spawn_infer_cf_naive_mel_pe_from_pt [WARN] args.model.use_harmonic_emb is None; use default False [WARN] > call by:torchfcpe.tools.spawn_cf_naive_mel_pe [WARN] no cuda_visible device found; fallback to cpu

Inazumanotenshi commented 2 months ago

for others that may have the same issue: found a work around but not really a good way

Replace in the bat-file the first line from "MMVCServerSIO.exe ^" to "start /affinity 1 /low MMVCServerSIO.exe ^"

this will limit the program to use only one core with low priority when it comes to cpu usage (does only work if Nvidia is first GPU). !CPU as used render hardware - no really good results anymore!

My result: CPU-usage: 100% --> 50% Cores used: 8 cores --> 1 core GPU-usage: 50% --> 40% Voice-quality: Good --> Good (sound the same for me)

Works for start_http.bat and start_https.bat . Maybe there will be an update later that fixes also that issue.

kusogakinerd commented 2 months ago

for others that may have the same issue: found a work around but not really a good way

Replace in the bat-file the first line from "MMVCServerSIO.exe ^" to "start /affinity 1 /low MMVCServerSIO.exe ^"

this will limit the program to use only one core with low priority when it comes to cpu usage (does only work if Nvidia is first GPU). !CPU as used render hardware - no really good results anymore!

My result: CPU-usage: 100% --> 50% Cores used: 8 cores --> 1 core GPU-usage: 50% --> 40% Voice-quality: Good --> Good (sound the same for me)

Works for start_http.bat and start_https.bat . Maybe there will be an update later that fixes also that issue.

any other fix for AMD?

Inazumanotenshi commented 2 months ago

You can try also set as additional argument "device-id 1" (GPU0 = ID 1, GPU1 = ID 2)

deiteris commented 1 month ago

[WARN] args.model.use_harmonic_emb is None; use default False [WARN] > call by:torchfcpe.tools.spawn_cf_naive_mel_pe [WARN] no cuda_visible device found; fallback to cpu

Looks like fcpe does not work correctly and it works on CPU. So it could be one of the reasons you are getting more usage. Have you tried rmvpe? Also which settings do you use?

I could also suggest using my fork. I'm actively maintaining it right now and you can download a pre-built binary from Actions. https://github.com/deiteris/voice-changer

Inazumanotenshi commented 1 month ago

I tried with all. Everytime the same with extreme high cpu usage. With rmvpe_onnx I have the "less" cpu usage.

This are my settings image image

deiteris commented 1 month ago

Extra may cause very high CPU usage. You can try lower values and it should consume much less CPU

Inazumanotenshi commented 1 month ago

Also tried that. but doesnt really seam to bring that much without having bad voice. Didnt had that issue when I had Nvidia only.

deiteris commented 1 month ago

Wait, I just noticed that you use Index. Don't use it for real time, set it to 0. It also requires a lot of CPU since it's computed only on CPU.

Inazumanotenshi commented 1 month ago

okay, yeah when I set it to 0 I habe 95% CPU usage instead of 100%. But that makes me still wonder why it wasnt when I had 2 Nvidia (GTX 970 & RTX 3070ti). Also with it disabled the voice sadly sounds so monotone.

But if thats at the moment the only way I guess I need to accept it.

deiteris commented 1 month ago

That still doesn't sound good enough, I was expecting a bigger impact... Could you consider trying the fork version I linked? It could be that I've already addressed this issue since I did an overhaul of the inference code (however I haven't tested code related to index thoroughly yet)

KuukoShan commented 1 month ago

Your logs says that there is no index file found so, why using it? Also, did you convert your voice model into onnx?

Inazumanotenshi commented 1 month ago

Your logs says that there is no index file found so, why using it? Also, did you convert your voice model into onnx?

Idk to say why it sounds with index better when there is no index file... dont ask me that. Also with onnx I got the best results when it comes to quality. It all doesnt really make sence for me too, but I do Unity, so mostly I dont ask anymore xD

That still doesn't sound good enough, I was expecting a bigger impact... Could you consider trying the fork version I linked? It could be that I've already addressed this issue since I did an overhaul of the inference code (however I haven't tested code related to index thoroughly yet)

I didnt tested the version you send me at the moment cause I am currently using AMD only and not using the voice changer. When I am finished upgrading and fixing my pc ill try again and tell.

KuukoShan commented 1 month ago

If there is no index file, the index setting won't do absolutely anything.

The reason why I asked if you have converted your voice model to onnx it's because if the voice model it's not an onnx file and it's a pth file instead, setting the F0 detection to rnvpe_onnx may just not work and fall to the CPU mode which would explain the high CPU usage.

If your gpu it's nvidia then just use rnvep with a pth voice model. It's one of the highest quality ones that uses the GPU.

If your GPU is AMD then convert the pth file to onnx and try using the rnvpe_onnx F0 detection mode.

Not doing a proper configuration will always result into the software falling back to CPU mode which is your issue.

Also forget about using index setting without an index file. If you feel like it sounds better be sure that it's just a placebo effect.

Inazumanotenshi commented 1 month ago

I exported the model to onnx, used the rnvpe_onnx, removed index: Sound: bad CPU-usage with no other program: 100% when speeking Uses Nvidia too: yes

using old pth file, used rnvpe, also no index: Sound: okay, but not perfect CPU-usage with no other program: 85% when speeking Uses Nvidia too: yes

Tested with both versions, tested with different versions, tested with index file and without.

I dont really know if its an issue when the system has both drivers (cause it is since I got the RX 7800XT with my RTX 3070ti as second gpu now), but when I look at my server wich has an integrated intel graphics and a gtx 970 it has the same issue since I activated integrated graphics.

Maybe the selection of the gpu gets broke when there are different drivers, but if so there should be a way to fix it. Ill wait now until next month when I can afford a new mainboard for my new CPU and then see if the performance of the Ryzen 9 7900X3d will be enought to "hide that issue". For now I'll accept the problem and if I need to run many programs Ill use my server temporary.

Still thanks KitsuneShan for the help, which at least lowered the CPU load a bit.

KuukoShan commented 1 month ago

I am using it with an nvidia 3080Ti and I also have the Intel iGPU activated without any issue. But I would like to note few things. The F0 detection it's basically how "good" the software will "understand" what are you saying and how are you sounding. This setting mostly affects on "weird" distorted sounds coming from your voice. That said, it's extremely important that you set the pitch right. In other words, the closer it sounds to the original character without you forcing your voice, the better and more realistic will sound. If your voice it's of someone in particular that you know or if you bought it and included sample clips, try to say the same phrase and change the pitch until you sound as close as possible. You may need to interprete a bit here but it's very important. This won't reduce the cpu usage but it will have a huge impact on the quality since it seems to sound bad for you.

As a final note take into special account that final and main point for a voice to sound properly it's not the settings used but the voice model itself. I have several paid voices and the one that sounds the best it's ironically one of the cheapest ones that even allows me to whisper and sing (most voices fails the whispering test).

And one more thing. Have you tried a different version of the software? My friend have an AMD cpu with an nvidia card and she has no issues of high cpu usage but she has them at the whole first (probably due messing with settings).

Inazumanotenshi commented 1 month ago

It wasnt really an issue with only my Ryzen 5 5600X and the 3070ti. And yes I tried different versions (all that are available on the download site. But every time the same. I also tried with only using the defaults and a complete reinstallation of it: still same.

Whats also strange is that I cant really use every on the rmvpe on the Direct version. image

On GPU 0 it uses the 3070ti even when its not the first... image

And more funny when I select GPU 1 its never using my RX. I dont know if its a "me"-issue but if yes then I dont know where to start...

KuukoShan commented 1 month ago

Yeah it's like not actually detecting the GPU properly since it doesn't gives you all the F0 detection options. Have you tried swapping the GPUs? Unless the AMD one is integrated. You could also disable the AMD one just for the sake of testing then disable the nvidia one and do a comparison to see if the issue is when there are two detected. Disabling them on device manager should be enough, no need to uninstall. And you can bring it back to life easily just clicking the scan for hardware button on device manager or right clicking and enabling it again. Just a way to see if we can track this down. Because it could also be that windows is directly opening the software with the main device not allowing access to the second one.

Inazumanotenshi commented 1 month ago

Swapping the gpus wasnt helping in any way. I already tried that since I recogniced that issue.

When the new cpu is in I have an integrated one, but I guess I'll stay with the RX 7800XT as main and RTX 3070ti as AI/Render/Coding-gpu.

Disableing the devices doesnt helped too. Also is normaly not an option cause on my AMD I run my main monitor, my stearing wheel monitor and my vr headset and on my Nvidia I run my Discord and my Browser/Coding monitor.

So doing that everytime would be also a mess. Maybe there is an issue with the detection... idk... its just an idea. also cause using 2 dGPUs from different manufacturers is normaly not a daily scenario.

(Sorry if some things are hard to understand - google translate wasnt a great help)

KuukoShan commented 1 month ago

Have you tried setting RVC to certain gpu? And I do no mean selecting in the software itself but assigning it on windows. I am not sure if assigning the executable file may be enough since the bat one runs several files. Because your main issue is, seeing those screenshots, that your RVC is never using any GPU at all. You should see higher spikes of GPU usage than the one on the screenshots, specially when speaking.

You could also check if in the nvidia panel your CUDA gpu is set properly and not in cpu mode.

Also remember that there is a different version of the software for those using Intel or AMD gpus. I know you want to use the nvidia one but could be a good way to see if using the AMD one with the right version actually works.

For reference, when speaking, you should see GPU spikes of usage of no less than 16-20% approximately. Because that's what I get on a 3080Ti which have way more cuda cores.

Inazumanotenshi commented 1 month ago

Have you tried setting RVC to certain gpu? And I do no mean selecting in the software itself but assigning it on windows. I am not sure if assigning the executable file may be enough since the bat one runs several files. Because your main issue is, seeing those screenshots, that your RVC is never using any GPU at all. You should see higher spikes of GPU usage than the one on the screenshots, specially when speaking.

You could also check if in the nvidia panel your CUDA gpu is set properly and not in cpu mode.

Checked everything and tried everything already. Was also an idea that I had but it didnt changed anything.

Also remember that there is a different version of the software for those using Intel or AMD gpus. I know you want to use the nvidia one but could be a good way to see if using the AMD one with the right version actually works.

You mean the DirectML-version, right? Yeah, tried also that. Thats where the last picture is from. Strange there is that when I use GPU0 its using my gpu 1 (rtx 3070ti). When I use GPU1 it says no device found - fallback to cpu. But it can render something (doesnt use any gpu) On GPU2 it also says no device found and can also not render something.

For reference, when speaking, you should see GPU spikes of usage of no less than 16-20% approximately. Because that's what I get on a 3080Ti which have way more cuda cores.

When I use the CUDA or the DirectML version with GPU0 the 3070ti gets to 30-40% when speeking. Sometimes also up to 70%.

deiteris commented 1 month ago

I'd still recommend trying a forked version I linked. You can check out the videos that demonstrate the performance on AMD and Nvidia (and no high CPU utilization on either of them) and instructions in readme.

Just in case so you don't have to search the thread: https://github.com/deiteris/voice-changer

Inazumanotenshi commented 1 month ago

I used it know for a while and it runs on my server. sadly my current pc doesnt have the ram to run everything at the same time, but with the docker it only uses the gpu. And 12GB ram xD.