SociallyIneptWeeb / AniVoiceChanger

An RVC "extension" for Voice-Chat
MIT License
140 stars 14 forks source link

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

Open CCRss opened 1 year ago

CCRss commented 1 year ago

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 commented 1 year ago

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.

CCRss commented 1 year ago

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.

CCRss commented 1 year ago

Tried with v2 model, same issue

CCRss commented 1 year ago

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

Wizzarddude305 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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.