daswer123 / rvc-python

Using RVC via console or python scripts
MIT License
72 stars 21 forks source link

Using Index file pegs cpu #9

Closed RyanAlghamdi closed 7 months ago

RyanAlghamdi commented 7 months ago

Hi, just wanted to ask if there was a possibility to look into an issue I'm having.

I have been trying to use the my index file and it uses my cpu and not my gpu? Running the file in code, or in the terminal without the use of the index file is quick and runs on my gpu. But as soon as i add the index path it uses 100% of my cpu.

This is an example of the code to use the terminal: args = [ sys.executable, # path to the Python executable "-m" ,"rvc_python", "-i", "speech.mp3", # Replace "input_value" with your actual input value

"-ip", "voices/voices/added_IVF3286_Flat_nprobe_1_v2.index", # Replace "index_value" with your actual index value

    "-me", "rmvpe",  # Replace "harvest" with your desired method
    "-v", "v2",  # Replace "v1" with your desired version
    "-o", "out.wav",  # Replace "output_value" with your actual output value
    "-mp", "voices/voices/voice.pth",  # Replace "model_value" with your actual model value
    "-ir", "0.55",  # Replace "index_rate_value" with your actual index rate value
]
subprocess.run(args, shell=True)

This is an example of my code using it straight in python:

            result = infer_file(
            input_path="speech.mp3",
            model_path="voices/named_voices/newtest.pth",
            index_path="voices/named_voices/added_IVF256_Flat_nprobe_1newtest_v2.index", # Optional: specify path to index file if available
            device=device,  # Use cpu or cuda
            opt_path="out.wav",  # Output file path
            index_rate=0.5,
            filter_radius=3,
            resample_sr=0,  # Set to desired sample rate or 0 for no resampling.
            rms_mix_rate=0.25,
            protect=0.33,
            f0method="rmvpe",  # Choose between 'harvest', 'crepe', 'rmvpe', 'pm'
            version="v2"
        )

Only when I leave the Index_path uncommented does it do that, but when I dont, it generates it extremely fast.

Im using  a 3080, with a 14700k. 
torch                  2.1.1+cu118

torchaudio 2.1.1+cu118 torchcrepe 0.0.22 rvc-python 0.0.5

Please let me know if you need more information.
RyanAlghamdi commented 7 months ago

I have no idea why, but installing deepspeed fixed this issue for me.