w-okada / voice-changer

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

Really high CPU usage #511

Closed Happyman03 closed 1 year ago

Happyman03 commented 1 year ago

For context, my system: Ryzen 7 3700x, 32GB 3200mhz and a RTX 4090. Yes I am aware of a CPU bottleneck in some games

The problem lies in the usage of my CPU while running RVC, it's usage balances around 40% sometimes reaching 50%. This is an issue because if my CPU usage goes in the 90-100% usage range RVC becomes very unstable/laggy.

My settings: image image

w-okada commented 1 year ago

what is issue? If cpu usage is high, use dio.

Happyman03 commented 1 year ago

Doesn't that decrease the quality of the voice?

w-okada commented 1 year ago

Yes decrease. But it is your pc's limit.

SirBitesalot commented 1 year ago

Try to use crepe aswell maybe because that runs on GPU and you have 4090. If you dont use indexing and crepe CPU usage should be pretty low

Happyman03 commented 1 year ago

I'll give that a try, thank you!

Happyman03 commented 1 year ago

I updated from .6 to .10, seems to have more than halved the CPU usage!

MrFelt commented 1 year ago

I updated from .6 to .10, seems to have more than halved the CPU usage!

Also, going too high on extra can increase CPU usage as well.

Happyman03 commented 1 year ago

Is a Ryzen 3700x really that bad for something like this? I expected it to be more GPU heavy, it reaches 55% if it's being used in sentences. No matter what F0 I use.

The moment I go from 16384 chunks to 32768 my average usage goes up from 6% tot around 50%. Guessing the problem is somewhere in this setting.

MrFelt commented 1 year ago

IPC wise the 3700x is equivalent to 6th gen Intel imho. For this, no not really. You increase the chunk size if there are hard cutouts and repeats. And only increase the extra if there are tiny pops and hisses; from my experience.

I have a 10850K @ 5 GHz, and even that goes to 80% usage if I try using high extra.

Set a chunk size, if it cuts, increase it, if it pops, bump extra to 8192. If it still pops, then go to 16384. If it still does on 16384, then you will need to start back at 4096 extra, but increase your chunk by one step.

And Index isn't GPU accelerated afaik currently, so, that will add to the usage as well if you try using Index.

w-okada commented 1 year ago

I cannot reproduce it.

Happyman03 commented 1 year ago

Do you need anything from me to make you be able to?

w-okada commented 1 year ago

try @MrFelt's way,

Happyman03 commented 1 year ago

I tried what he said, it isn't dependent on chunks, only on the extra chunks. The moment I select more than 16384 extra chunks this happens.

w-okada commented 1 year ago

I used RTX4090 same as yours. But I cannot reproduced.

The performance of the CPU might not be keeping up. Since 'harvest' is quite heavy, why not try switching 'f0 det' to 'crepe' or 'rmvpe'?

Happyman03 commented 1 year ago

Do you think this is a bug or simply a hardware issue? My CPU is overclocked and runs at 95th percentile for a Ryzen 7 3700x.

Changing to crepe or rmvpe doesn't change a thing

w-okada commented 1 year ago

how about dio as f0 det?

w-okada commented 1 year ago

decrese extra to 4096 your cpu is not good.

MrFelt commented 1 year ago

I tried what he said, it isn't dependent on chunks, only on the extra chunks. The moment I select more than 16384 extra chunks this happens.

Set a chunk size, if it cuts, increase it, if it pops, bump extra to 8192. If it still pops, then go to 16384. If it still does on 16384, then you will need to start back at 4096 extra, but increase your chunk by one step.

I stated that you generally can only go so far on extra, until you just need to instead increase chunk. CPU is irrelevant for the most part when you are not using index, provided you are using sane chunk/extra.

MrFelt commented 1 year ago

As currently, those are just the limits.

MrFelt commented 1 year ago

Oh, and don't use the in/out volume scaling. I've noticed that can sometimes increase CPU usage, but cannot figure out what causes.

w-okada commented 1 year ago

Even with your suggested settings, There will be some usage of the CPU.. @Happyman03's GPU performance is so high that the GPU's relatively large processing finishes almost instantly. As a result, I believe the usage is high because the CPU's smaller processing tasks are being performed at a high frequency. In other words, the GPU performance is too high, and the CPU side processing can't keep up. Ideally, you should increase the Chunksize.

w-okada commented 1 year ago

And CPU Bench

https://www.cpu-monkey.com/ja/compare_cpu-amd_ryzen_7_3700x-vs-intel_core_i7_13700k

Please be aware that it only has about half the performance of the current generation.

Happyman03 commented 1 year ago

I am not using index, nor is it using it my intention at all.

at 131072 extra chunks harvest = 57% crepe = 45% rmvpe = 43% dio = 39%

at 16384 extra chunks harvest = 45% crepe = 41% rmvpe = 38% dio = 37%

at 4096 extra chunks harvest = 4% crepe = 3% rmvpe = 3% dio = 3%

Happyman03 commented 1 year ago

I am aware of the CPU bottleneck, but haven't found a single program trying to convince me to get an upgrade.

I do believe there is something going on in the CPU usage with extra chunk sizes that isn't matching with the amounts of work needed for those chunks.

MrFelt commented 1 year ago

Yes, it is working as intended. Extra only helps with small pops, you can increase it, but once you start getting tons of CPU usage, you must go back to 4096, and instead, increase your chunk size. Which I stated in the beginning.

You have solved your problem with my original answer.

w-okada commented 1 year ago

I don't intend to explain the minute details of the code, but due to optimization, what's processed on the CPU and GPU differs. Therefore, the CPU's load doesn't increase linearly. If you want more details, you should read the source code. Of course, I can't guarantee that it's 100% bug-free.

Happyman03 commented 1 year ago

I understand, it's a shame that I hear a noticable difference with the extra chunks decreased :/

MrFelt commented 1 year ago

As for the "CPU not good" aspect, that applies to 98% of people. Including me. As it currently stands, you will not have flawless realtime, sub 2 second delay. This is still a heavily WIP field, and is lesser fledged as a whole vs others, like language or image related fields.

MrFelt commented 1 year ago

I understand, it's a shame that I hear a noticable difference with the extra chunks decreased :/

And no, you are supposed to increase chunks once you cannot use extra efficiently. Technically, higher chunks will have less issues with sound quality, just at a higher delay.

Happyman03 commented 1 year ago

As for the "CPU not good" aspect, that applies to 98% of people. Including me. As it currently stands, you will not have flawless realtime, sub 2 second delay. This is still a heavily WIP field, and is lesser fledged as a whole vs others, like language or image related fields.

Which is expected, the reason why I went to ask about this, as I was unsure about the demand from the CPU

Happyman03 commented 1 year ago

I understand, it's a shame that I hear a noticable difference with the extra chunks decreased :/

And no, you are supposed to increase chunks once you cannot use extra efficiently. Technically, higher chunks will have less issues with sound quality, just at a higher delay.

You're saying extra chunks don't correlate to the quality of the output?

MrFelt commented 1 year ago

So once again, if you cut out, INCREASE chunk. If you lightly crackle, increase extra. If you get high CPU usage, decrease extra, increase chunk, decrease index, etc.

If need be you can try setting strict affinities to prevent windows from scheduling conflicts between the two running processes.

You're saying extra chunks don't correlate to the quality of the output?

They do, but chunks in this terminology is moreso of a "buffer length" as in, you run out of buffer, or can't keep it full, you cut out.

Happyman03 commented 1 year ago

So once again, if you cut out, INCREASE chunk. If you lightly crackle, increase extra. If you get high CPU usage, decrease extra, increase chunk, decrease index, etc.

If need be you can try setting strict affinities to prevent windows from scheduling conflicts between the two running processes.

You're saying extra chunks don't correlate to the quality of the output?

They do, but chunks in this terminology is moreso of a "buffer length" as in, you run out of buffer, or can't keep it full, you cut out.

Okay gotcha, so essentially it's about balancing the two to work well with your specs at the lowest possible working chunk.

Happyman03 commented 1 year ago

Okay thank you both for clarifying that, I'll either have to wait for a less intensive CPU version or make an upgrade if I plan on using this.

Thank you Okada for this great tool! Much appreciated