w-okada / voice-changer

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

[ISSUE]: Frequent errors occur. Please check if the model of the framework being targeted is loaded. Google Colab Pro #1184

Open Andgame1290 opened 2 months ago

Andgame1290 commented 2 months ago

Voice Changer Version

Google Colab Version

Operational System

Google Colab

GPU

none

Read carefully and check the options

Model Type

RVC

Issue Description

Hi! i use the colab button on this page to be able to use it. After several videos i saw only RVC works with Colab Pro and proceed to get it, after trying is still this same error... can someone explain me how to do this with colab? Not even a model is charging and press start just pop this message "Frequent errors occur. Please check if the model of the framework being targeted is loaded." I try running again all the colab but nop imagen_2024-04-11_111839940

Application Screenshot

imagen_2024-04-11_111847623

Logs on console

Booting PHASE :main PYTHON:3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] 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:8000 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.

Booting PHASE :__mp_main__
The server process is starting up.
Booting PHASE :MMVCServerSIO

[Voice Changer] VoiceChangerManager initializing... [Voice Changer] VoiceChangerManager initializing... done. [Voice Changer] MMVC_Rest initializing... [Voice Changer] MMVC_Rest initializing... done. [Voice Changer] MMVC_SocketIOApp initializing... [Voice Changer] MMVC_SocketIOApp initializing... done. --------- SERVER READY! --------- Your server is available at:


is not an accepted origin. (further occurrences of this error will be logged with level INFO)

deiteris commented 2 months ago

Hey, sorry for inconvenience. This issue is caused by this change: https://github.com/w-okada/voice-changer/pull/1153.

Currently, you are required to specify the URL of your server in order to make requests to voice changer (i.e., --allowed-origin https://your-domain.com. But since you're most likely using ngrok without static domain, this is impossible to do beforehand.

I've made a PR https://github.com/w-okada/voice-changer/pull/1186 that would allow you to specify any origin with --allowed-origin *. You can either clone directly from my fork or wait until it's merged.

Isaakkamau commented 2 months ago

@deiteris I see your PR has merged but I'm still running into the same error. I'm also using google colab

Isaakkamau commented 2 months ago

Sorry, I see it’s not yet merged. Let me try to use your fork

Hkoup commented 2 months ago

Hi @deiteris I have tried with your fork adding the "--allowed-origin *" argument in google collab but i'm still getting an error when the url it's generated, i handle this just removing the assertion part on origins.py, but, when i load the page the "Please check if the model of the framework being targeted is loaded" its persistent, is there something im missing?

BadKiko commented 2 months ago

Hey, sorry for inconvenience. This issue is caused by this change: #1153.

Currently, you are required to specify the URL of your server in order to make requests to voice changer (i.e., --allowed-origin https://your-domain.com. But since you're most likely using ngrok without static domain, this is impossible to do beforehand.

I've made a PR #1186 that would allow you to specify any origin with --allowed-origin *. You can either clone directly from my fork or wait until it's merged.

Thx it works for me, i created new google collab - https://colab.research.google.com/drive/1zDgkFd6cHQfPzxr52tD7uk9sepsRhsM1?usp=sharing

deiteris commented 2 months ago

Hi @deiteris I have tried with your fork adding the "--allowed-origin *" argument in google collab but i'm still getting an error when the url it's generated, i handle this just removing the assertion part on origins.py, but, when i load the page the "Please check if the model of the framework being targeted is loaded" its persistent, is there something im missing?

@Hkoup, this could be caused by other different factors (model fails to load due to some other issues). Could you share the log?

Thx it works for me, i created new google collab - https://colab.research.google.com/drive/1zDgkFd6cHQfPzxr52tD7uk9sepsRhsM1?usp=sharing

@BadKiko, I've just noticed that you're using master branch that was before these changes (I forgot to sync my fork). Could you pull the changes and try again to see if it actually works? I also see that run command doesn't have --allowed-origins * in your Google Colab. image

Should be like:

!python3 MMVCServerSIO.py \
  -p {PORT} \
  --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 \
  --allowed-origins "*"
BadKiko commented 2 months ago

Hi @deiteris I have tried with your fork adding the "--allowed-origin *" argument in google collab but i'm still getting an error when the url it's generated, i handle this just removing the assertion part on origins.py, but, when i load the page the "Please check if the model of the framework being targeted is loaded" its persistent, is there something im missing?

@Hkoup, this could be caused by other different factors (model fails to load due to some other issues). Could you share the log?

Thx it works for me, i created new google collab - https://colab.research.google.com/drive/1zDgkFd6cHQfPzxr52tD7uk9sepsRhsM1?usp=sharing

@BadKiko, I've just noticed that you're using master branch that was before these changes (I forgot to sync my fork). Could you pull the changes and try again to see if it actually works? I also see that run command doesn't have --allowed-origins * in your Google Colab. image

Should be like:

!python3 MMVCServerSIO.py \
  -p {PORT} \
  --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 \
  --allowed-origins "*"

I forked your repo to my needs, and change the name of MMVCServerSIO.py, because google throws warning to this line, and after ~1 minute blocking my collab session (I think the name of this py file in the google ban list).

This is my current version of collab file https://colab.research.google.com/drive/1lvy8kkbVYyD9F1HwMZuZwF7bYvmJar37

And forked repo https://github.com/BadKiko/voice-changer-collab

sunday-HAMA commented 1 month ago

Hi @deiteris I also have tried with adding the "--allowed-origin *" argument in google colab and additionally, I modified the code using your instructions https://github.com/w-okada/voice-changer/pull/1186/commits/a85dbd77935723142b7a3fee0345ef9337c6662f and loaded it in Colab. https://github.com/sunday-HAMA/voice-changer However, the URL was not generated by ngrok, as shown below. this is my google colab. https://colab.research.google.com/drive/1m1mz0Ewcjkh4VHcPuiHsdOtVzKOPBOPB?usp=sharing

I subscribed to Google Colab Pro. Is there something I'm wrong?

[Voice Changer] Generating metadata...
[Voice Changer] ONNX Model: Official v2 like
SlotInfo::: RVCModelSlot(slotIndex=0, voiceChangerType='RVC', name='つくよみちゃん(onnx)', description='', credit='つくよみちゃん', termsOfUseUrl='https://huggingface.co/wok000/vcclient_model/raw/main/rvc_v2_alpha/tsukuyomi-chan/terms_of_use.txt', iconFile='tsukuyomi-chan.png', speakers={'0': 'target'}, modelFile='tsukuyomi_v2_40k_e100_simple.onnx', indexFile='', defaultTune=0, defaultIndexRatio=0, defaultProtect=0.5, isONNX=True, modelType='onnxRVC', samplingRate=40000, f0=True, embChannels=768, embOutputLayer=12, useFinalProj=False, deprecated=False, embedder='hubert_base', sampleId='Tsukuyomi-chan_o', version='v2')
[Voice Changer] ONNX Model: Official v2 like
SlotInfo::: RVCModelSlot(slotIndex=1, voiceChangerType='RVC', name='あみたろ(onnx)', description='', credit='あみたろ', termsOfUseUrl='https://huggingface.co/wok000/vcclient_model/raw/main/rvc_v2_alpha/amitaro/terms_of_use.txt', iconFile='amitaro.png', speakers={'0': 'target'}, modelFile='amitaro_v2_40k_e100_simple.onnx', indexFile='', defaultTune=0, defaultIndexRatio=0, defaultProtect=0.5, isONNX=True, modelType='onnxRVC', samplingRate=40000, f0=True, embChannels=768, embOutputLayer=12, useFinalProj=False, deprecated=False, embedder='hubert_base', sampleId='Amitaro_o', version='v2')
[Voice Changer] ONNX Model: Official v2 like
SlotInfo::: RVCModelSlot(slotIndex=2, voiceChangerType='RVC', name='黄琴まひろ(onnx)', description='', credit='黄琴まひろ', termsOfUseUrl='https://huggingface.co/wok000/vcclient_model/raw/main/rvc_v2_alpha/kikoto_mahiro/terms_of_use.txt', iconFile='kikoto_mahiro.png', speakers={'0': 'target'}, modelFile='kikoto_mahiro_v2_40k_simple.onnx', indexFile='', defaultTune=0, defaultIndexRatio=0, defaultProtect=0.5, isONNX=True, modelType='onnxRVC', samplingRate=40000, f0=True, embChannels=768, embOutputLayer=12, useFinalProj=False, deprecated=False, embedder='hubert_base', sampleId='KikotoMahiro_o', version='v2')
[Voice Changer] ONNX Model: Official v2 like
SlotInfo::: RVCModelSlot(slotIndex=3, voiceChangerType='RVC', name='刻鳴時雨(onnx)', description='', credit='刻鳴時雨', termsOfUseUrl='https://huggingface.co/wok000/vcclient_model/raw/main/rvc_v2_alpha/tokina_shigure/terms_of_use.txt', iconFile='tokina_shigure.png', speakers={'0': 'target'}, modelFile='tokina_shigure_v2_40k_e100_simple.onnx', indexFile='', defaultTune=0, defaultIndexRatio=0, defaultProtect=0.5, isONNX=True, modelType='onnxRVC', samplingRate=40000, f0=True, embChannels=768, embOutputLayer=12, useFinalProj=False, deprecated=False, embedder='hubert_base', sampleId='TokinaShigure_o', version='v2')
    Internal_Port:8000
    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://localhost:8000/
    Booting PHASE :__mp_main__
    The server process is starting up.
    Booting PHASE :MMVCServerSIO
[Voice Changer] VoiceChangerManager initializing...
[Voice Changer] VoiceChangerManager initializing... done.
[Voice Changer] MMVC_Rest initializing...
[Voice Changer] MMVC_Rest initializing... done.
[Voice Changer] MMVC_SocketIOApp initializing...
Process SpawnProcess-1:1:
Traceback (most recent call last):
  File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/_subprocess.py", line 76, in subprocess_started
    target(sockets=sockets)
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/server.py", line 59, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/server.py", line 66, in serve
    config.load()
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/config.py", line 471, in load
    self.loaded_app = import_from_string(self.app)
  File "/usr/local/lib/python3.10/dist-packages/uvicorn/importer.py", line 21, in import_from_string
    module = importlib.import_module(module_str)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/content/voice-changer/server/MMVCServerSIO.py", line 144, in <module>
    app_socketio = MMVC_SocketIOApp.get_instance(app_fastapi, voiceChangerManager, args.allowed_origins, PORT)
  File "/content/voice-changer/server/sio/MMVC_SocketIOApp.py", line 31, in get_instance
    normalized_origins = normalize_origins(allowedOrigins)
  File "/content/voice-changer/server/mods/origins.py", line 19, in normalize_origins
    assert url.scheme, ENFORCE_URL_ORIGIN_FORMAT
AssertionError: Input origins must be well-formed URLs, i.e. https://google.com/ or https://www.google.com/.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
Exception ignored in atexit callback: <function _exit_function at 0x7fac494a7d90>Exception ignored in sys.unraisablehook: <built-in function unraisablehook>
deiteris commented 1 month ago

@sunday-HAMA, you need to also apply the following changes: https://github.com/w-okada/voice-changer/pull/1186/commits/00b1d4e32f8c5c13b522279002ac494e4271fb63

sunday-HAMA commented 1 month ago

@deiteris thank you! it works. and I am grateful for all the work you have done and will continue to do. Thank you so much.

Aryaman-Pachori commented 1 month ago

@sunday-HAMA can you please upload the updated colab? I am not a coder and don't know exactly what you guys are talking about, but i would really appreciate if you could send me the doc so I can use it straight away. Thanks.

sunday-HAMA commented 1 month ago

hi @Aryaman-Pachori give this a try. https://colab.research.google.com/drive/1m1mz0Ewcjkh4VHcPuiHsdOtVzKOPBOPB

KuukoShan commented 1 month ago

hi @Aryaman-Pachori give this a try. https://colab.research.google.com/drive/1m1mz0Ewcjkh4VHcPuiHsdOtVzKOPBOPB

I gave it a try and, after a few issues and errors, I managed to it working. Thank you! I just get disconnected after some time, I guess because Google does not allow the usage of the resources for free for more than a certain time.

I have a little question. How many "compute units" are necessary to run RVC in Google Colab? The starting price gives you 100 compute units per month but I have no idea how much it's that at the time of using RVC. Like, how many hours of use is that?

sunday-HAMA commented 1 month ago

That’s great! I think you need to subscribe to the Pro plan to do that.

According to the website, depending on the GPU you specify, here are the approximate limits for 100 computing units:

https://atmarkit.itmedia.co.jp/ait/spv/2106/07/news025.html

KuukoShan commented 1 month ago

That’s great! I think you need to subscribe to the Pro plan to do that.

According to the website, depending on the GPU you specify, here are the approximate limits for 100 computing units:

  • CPU: 0.08 (equivalent to 1250 hours or about 52 days)
  • Standard GPU (T4): 1.96 (equivalent to about 51 hours or about 2 days)
  • Premium GPU (V100): 5.36 (equivalent to about 18 hours and 30 minutes)
  • Premium GPU (A100): 13.08 (equivalent to about 7 hours and 30 minutes)
  • TPU: 1.96 (equivalent to about 51 hours or about 2 days)

https://atmarkit.itmedia.co.jp/ait/spv/2106/07/news025.html

Hey, thank you for the reply! But there is something that doesn't make much sense to me so I think the data may be a bit misleading or maybe you didn't understand what I exactly meant.

I get that those are the limits if you divide the 100 compute units according to the performance offered by each type of GPU/CPU. But I also understand that the faster the GPU, the less performance would be used by RVC. So I guess my question it's more like, if using the regular settings of like 128 chunk, 16K extra, and T4 (similar to how you would use it locally after all), how much time would 100 compute units give to use RVC with it? And yeah I know T4 goes for 1.96 but I'd guess that you would use more or less compute units the more performance it's required, am I right on this or completely wrong? What I mean is, not every application running on T4 GPU would use the same resources and hence not the same amount of compute units?

Sorry if my questions sounds weird but I really don't understand how to measure compute units but I will assume that you use more compute units the higher the resources usage besides using a different type of GPU.

sunday-HAMA commented 1 month ago

I think it just takes more time as performance requirements increase, and the units might not be related. Not all applications running on a T4 GPU use the same resources, but they use the same amount of compute units per unit time.

tajikage commented 3 weeks ago

I'm getting the same problem. I launch the server and then i get this message "servername is not an accepted origin. (further occurrences of this error will be logged with level INFO)" in the logs. And the models don't load and nothing happens when i click on them, only this message pops up: Frequent errors occur. Please check if the model of the framework being targeted is loaded.

tajikage commented 3 weeks ago

I've made a PR #1186 that would allow you to specify any origin with --allowed-origin *. You can either clone directly from my fork or wait until it's merged.

It seems your fork wasn't merged. Is there a way of implementing these changes myself? I need this thing running to prank my friend on his b-day but i'm a total newbie when it comes to coding & using github