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

"Input Type (torch.cuda.FloatTensor) and Weight Type (torch.cuda.HalfTensor) Mismatch" #1

Open
vladimiralbrekhtccr opened this issue Jun 29, 2023 · 7 comments

Comments

@vladimiralbrekhtccr
Copy link

vladimiralbrekhtccr commented Jun 29, 2023

Hello, when I start recording got this error. When model try to convert input.

Different types of input and weights.
Model, was trained on RVC version 1 not v2.

Console Logs

Recording has started.
Converting voice...
Traceback (most recent call last):
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\vc_infer_pipeline.py", line 284, in pipeline
    index = faiss.read_index(file_index)
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\runtime\lib\site-packages\faiss\swigfaiss.py", line 8261, in read_index
    return _swigfaiss.read_index(*args)
RuntimeError: Error in __cdecl faiss::FileIOReader::FileIOReader(const char *) at D:\a\faiss-wheels\faiss-wheels\faiss\faiss\impl\io.cpp:68: Error: 'f' failed: could not open G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\logs\mi-test\added_IVF778_Flat_nprobe_1.index for reading: No such file or directory
Exception in thread Thread-2:
Traceback (most recent call last):
  File "threading.py", line 980, in _bootstrap_inner
  File "threading.py", line 917, in run
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\runtime\lib\site-packages\keyboard\_generic.py", line 58, in process
    if self.pre_process_event(event):
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\runtime\lib\site-packages\keyboard\__init__.py", line 213, in pre_process_event
    key_hook(event)
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\runtime\lib\site-packages\keyboard\__init__.py", line 516, in <lambda>
    return hook_key(key, lambda e: e.event_type == KEY_DOWN or callback(e), suppress=suppress)
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\AniVoiceChanger\main_local.py", line 245, in on_release_key
    rvc_infer()
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\AniVoiceChanger\main_local.py", line 190, in rvc_infer
    audio_opt = vc.pipeline(hubert_model, net_g, 0, audio, INPUT_VOICE_PATH, times, PITCH_CHANGE, PITCH_EXTRACTION_ALGO, index_path, INDEX_RATE, if_f0, 3, tgt_sr, 0, VOLUME_ENVELOPE, version, 0.33, f0_file=None)
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\vc_infer_pipeline.py", line 384, in pipeline
    self.vc(
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\vc_infer_pipeline.py", line 185, in vc
    logits = model.extract_features(**inputs)
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\runtime\lib\site-packages\fairseq\models\hubert\hubert.py", line 535, in extract_features
    res = self.forward(
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\runtime\lib\site-packages\fairseq\models\hubert\hubert.py", line 437, in forward
    features = self.forward_features(source)
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\runtime\lib\site-packages\fairseq\models\hubert\hubert.py", line 392, in forward_features
    features = self.feature_extractor(source)
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\runtime\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\runtime\lib\site-packages\fairseq\models\wav2vec\wav2vec2.py", line 895, in forward
    x = conv(x)
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\runtime\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\runtime\lib\site-packages\torch\nn\modules\container.py", line 217, in forward
    input = module(input)
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\runtime\lib\site-packages\torch\nn\modules\module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\runtime\lib\site-packages\torch\nn\modules\conv.py", line 313, in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "G:\CCR\Рабочий стол\voice_AI\RVC-beta-v2-0618\runtime\lib\site-packages\torch\nn\modules\conv.py", line 309, in _conv_forward
    return F.conv1d(input, weight, bias, self.stride,
RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.cuda.HalfTensor) should be the same
@SociallyIneptWeeb
Copy link
Owner

Maybe you can try training using v2 and see if you still face the same error? I believe my script only works for v2 trained models.

@vladimiralbrekhtccr
Copy link
Author

Yeah, today want to do it. If it will work I will response here.

Maybe you can try training using v2 and see if you still face the same error? I believe my script only works for v2 trained models.

@vladimiralbrekhtccr
Copy link
Author

Tried with v2 model, same issue

@vladimiralbrekhtccr
Copy link
Author

This model work when use Google Collab, but not working locally, I have 1060, might be problem with it graphic card.

@Wizzarddude305
Copy link

I have a 1070 and I also get the same error, looking at the code it does an if statement declaring that if 1060,1070, or 1080 is in the GPU's name it'd be forced to "single precision". I'm assuming that's what kills the entire operation.

@SociallyIneptWeeb
Copy link
Owner

Could you maybe remove that line in the if and test it? So just delete line 37 in your case and see if it works without

@Wizzarddude305
Copy link

Wizzarddude305 commented Aug 15, 2023

I tried that and it doesn't work, but I did find a solution. Apparently, the real problem is that myinfer.py from the original file was outdated so that series 10 gpu's wouldn't work described in this forum "myinfer.py has not been updated #299". I implemented the code from the third post I believe to replace the rvc_infer and the get_vc and it fixed the problem for me. Edit: If you want me to, I can try implementing the code into the main local code by tomorrow (no promises) it's just that I'm not necessarily an expert on git, so I rather ask for permission first.

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

No branches or pull requests

4 participants
@SociallyIneptWeeb @vladimiralbrekhtccr @Wizzarddude305 and others