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

Simple CLI Implementation #41

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

stu00608
Copy link

First, appreciate the great work of this fork by @Mangio621 :D

The CLI interface is great! But somehow it's a little bit hard to invoke those functions from the other application. So I made a fork which added a new --simple_cli mode. It's basically the same way as the original cli do, but this allows you do a single step by one command.
The main idea is to add more arguments to parse in Config(), accept params for each steps. But it's awkward that now the usage will show a bunch of arguments, which makes it become confusing maybe.
image

For example, I can do pre-process step by python infer-web.py --pycmd python --simple_cli pre-process --exp_name Example-Exp --trainset_dir /path/to/dataset/ --sample_rate 40k.

To summarize, I did:

  1. Implement simple cli mode.
  2. Made a fix to get_vc() argument missing in cli_infer()

Still working on the help messasge for simple cli mode. If user added a --cmd_help argument, it will only show the help message and then quit.

I would like to ask for some suggestions if the approach can be done in a better way :) Thank you!

@VertofChest
Copy link

God bless your work.

@scooth
Copy link

scooth commented Jul 27, 2023

Hi,
Im trying infer with your change! I copy our CONFIG.PY and INFER.WEB.PY
CLI command is: python infer-web.py --pycmd python --simple_cli infer --model_file_name lula.pth --source_audio_path teste.wav --output_file_name myTest2.wav --feature_index_path logs/Lula/added_IVF502_Flat_nprobe_1_Lula_v2.index --transposition -2 --infer_f0_method harvest

But i have this error : ImportError: cannot import name 'get_folder_name' from 'my_utils'

If i infer true Menu, with original INFER.WEB.PY work perfect! But if i put your INFER.WEB, i see this error!

what i making wrong?

thanks

@stu00608
Copy link
Author

Hi, Im trying infer with your change! I copy our CONFIG.PY and INFER.WEB.PY CLI command is: python infer-web.py --pycmd python --simple_cli infer --model_file_name lula.pth --source_audio_path teste.wav --output_file_name myTest2.wav --feature_index_path logs/Lula/added_IVF502_Flat_nprobe_1_Lula_v2.index --transposition -2 --infer_f0_method harvest

But i have this error : ImportError: cannot import name 'get_folder_name' from 'my_utils'

If i infer true Menu, with original INFER.WEB.PY work perfect! But if i put your INFER.WEB, i see this error!

what i making wrong?

thanks

Are you running the command in the root folder where infer-web.py is? The error seems not finding the helper function I added in my_utils.py.
Check if you have the function 'get_folder_name' in my_utils.py (your version). If not, just see my fork and copy that I think will be fine.

@scooth
Copy link

scooth commented Jul 27, 2023

Hi, Im trying infer with your change! I copy our CONFIG.PY and INFER.WEB.PY CLI command is: python infer-web.py --pycmd python --simple_cli infer --model_file_name lula.pth --source_audio_path teste.wav --output_file_name myTest2.wav --feature_index_path logs/Lula/added_IVF502_Flat_nprobe_1_Lula_v2.index --transposition -2 --infer_f0_method harvest
But i have this error : ImportError: cannot import name 'get_folder_name' from 'my_utils'
If i infer true Menu, with original INFER.WEB.PY work perfect! But if i put your INFER.WEB, i see this error!
what i making wrong?
thanks

Are you running the command in the root folder where infer-web.py is? The error seems not finding the helper function I added in my_utils.py. Check if you have the function 'get_folder_name' in my_utils.py (your version). If not, just see my fork and copy that I think will be fine.

Yes. I make some changes, and now im getting this:

zzz107910

@scooth
Copy link

scooth commented Jul 27, 2023

I donwloaded your fork, and dosent work!

this is my files im using to receive erro above

my_utils.py.txt
config.py.txt
infer-web.py.txt

@stu00608
Copy link
Author

I donwloaded your fork, and dosent work!

this is my files im using to receive erro above

my_utils.py.txt config.py.txt infer-web.py.txt

My fork isn't updated to current main branch now, I see there are many difference between the files you provide and my fork, notice that you need to run my fork in simple_cli_dev branch. I hope this fix your problem.
I tried my fork in Windows 11, works fine :)

@justinjohn0306
Copy link

@stu00608 can you add an argument for logs_dir for your simple cli implementation so users are able to change the default logs directory?

@stu00608
Copy link
Author

@stu00608 can you add an argument for logs_dir for your simple cli implementation so users are able to change the default logs directory?

As the logs folder is hardcoded in infer-web.py, so in this PR I won't do this feature.
But I agree that the logs folder should be customizable 😄

@stu00608 stu00608 marked this pull request as ready for review August 19, 2023 04:55
@Maverick1983
Copy link

Maverick1983 commented Oct 21, 2023

@stu00608 can you add simple guide or screen for your cli command?

@stu00608
Copy link
Author

Sure!

  • Preprocessing
    python infer-web.py --pycmd python --simple_cli pre-process --exp_name Your-Exp-1 --trainset_dir /path/to/your/dataset --sample_rate 40k
  • Feature Extraction
    python infer-web.py --pycmd python --simple_cli extract-feature --exp_name Your-Exp-1 --gpu 0 --n_workers 8 --f0_method crepe --sample_rate 40k
  • Training
    python infer-web.py --pycmd python --simple_cli train --exp_name Your-Exp-1 --gpu 0 --epochs 1000 --save_epoch_iter 10 --batch_size 12 --save_small_model True
  • Train Feature
    python infer-web.py --pycmd python --simple_cli train-feature --exp_name Your-Exp-1

I hope this help~

@Maverick1983
Copy link

Maverick1983 commented Oct 24, 2023 via email

@alexlnkp
Copy link

i'd personally make a separate script for CLI usage.
first of all this mitigates any user confusion and also serves as a better structure for the project.
we don't want users to be forced to deal with a single basket full of eggs, we want users to have multiple baskets depending on their needs.

also, probably should've mentioned this prior: this repository seems to be stagnant and probably won't be updated in the conceivable future.
however, your efforts are admirable!

@Varjasiteodor
Copy link

Hi,
When I try to run CLI command:
runtime\python.exe infer-web.py --pycmd runtime\python.exe --simple_cli infer --model_file_name Teodor.pth --source_audio_path rollercoaster.wav --output_file_name test2.wav --feature_index_path logs/Lula/added_IVF502_Flat_nprobe_1_Lula_v2.index --transposition -12 --infer_f0_method rmvpe
The following error occurs:
`You're now in infer mode.
['Teodor.pth', 'rollercoaster.wav', 'test2.wav', 'logs/Lula/added_IVF502_Flat_nprobe_1_Lula_v2.index', '0', '-12', 'rmvpe', '128', '3', '0', '0.25', '0.33', '0.33', '0.45', 'False', '8.0', '1.2']
Mangio-RVC-Fork Infer-CLI: Starting the inference...
loading weights/Teodor.pth
gin_channels: 256 self.spk_embed_dim: 109

({'visible': True, 'maximum': 109, 'type': 'update'}, {'visible': True, 'value': 0.33, 'type': 'update'}, {'visible': True, 'value': 0.5, 'type': 'update'})
Mangio-RVC-Fork Infer-CLI: Performing inference...
Mangio-RVC-Fork Infer-CLI: Detected file. Using vc_single...
Traceback (most recent call last):
File "C:\Atuomatic video upluoading\Mangio-RVC-v23.7.0\my_utils.py", line 135, in load_audio
ffmpeg.input(file, threads=0)
File "C:\Atuomatic video upluoading\Mangio-RVC-v23.7.0\runtime\lib\site-packages\ffmpeg_run.py", line 325, in run
raise Error('ffmpeg', out, err)
ffmpeg._run.Error: ffmpeg error (see stderr output for detail)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Atuomatic video upluoading\Mangio-RVC-v23.7.0\infer-web.py", line 264, in vc_single
audio = load_audio(input_audio_path0, 16000, DoFormant, Quefrency, Timbre)
File "C:\Atuomatic video upluoading\Mangio-RVC-v23.7.0\my_utils.py", line 142, in load_audio
raise RuntimeError(f"Failed to load audio: {e}")
RuntimeError: Failed to load audio: ffmpeg error (see stderr output for detail)

Mangio-RVC-Fork Infer-CLI: Inference failed. Here's the traceback:
Traceback (most recent call last):
File "C:\Atuomatic video upluoading\Mangio-RVC-v23.7.0\my_utils.py", line 135, in load_audio
ffmpeg.input(file, threads=0)
File "C:\Atuomatic video upluoading\Mangio-RVC-v23.7.0\runtime\lib\site-packages\ffmpeg_run.py", line 325, in run
raise Error('ffmpeg', out, err)
ffmpeg._run.Error: ffmpeg error (see stderr output for detail)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Atuomatic video upluoading\Mangio-RVC-v23.7.0\infer-web.py", line 264, in vc_single
audio = load_audio(input_audio_path0, 16000, DoFormant, Quefrency, Timbre)
File "C:\Atuomatic video upluoading\Mangio-RVC-v23.7.0\my_utils.py", line 142, in load_audio
raise RuntimeError(f"Failed to load audio: {e}")
RuntimeError: Failed to load audio: ffmpeg error (see stderr output for detail)`

I am running this on Windows 10
Could you please help me understand what i am making wrong?
Thanks in advance.

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.

7 participants