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

RuntimeError: Failed to load checkpoint #792

Open
2 tasks done
sonhm3029 opened this issue Jun 25, 2023 · 1 comment
Open
2 tasks done

RuntimeError: Failed to load checkpoint #792

sonhm3029 opened this issue Jun 25, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@sonhm3029
Copy link

sonhm3029 commented Jun 25, 2023

Describe the bug

Traceback (most recent call last):
  File "/home/edabk/anaconda3/envs/sovits_3_9/lib/python3.9/site-packages/so_vits_svc_fork/train.py", line 347, in load
    _, _, _, epoch = utils.load_checkpoint(
  File "/home/edabk/anaconda3/envs/sovits_3_9/lib/python3.9/site-packages/so_vits_svc_fork/utils.py", line 264, in load_checkpoint
    checkpoint_dict = torch.load(f, map_location="cpu", weights_only=False)
  File "/home/edabk/anaconda3/envs/sovits_3_9/lib/python3.9/site-packages/torch/serialization.py", line 712, in load
    return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
  File "/home/edabk/anaconda3/envs/sovits_3_9/lib/python3.9/site-packages/torch/serialization.py", line 1047, in _load
    unpickler = UnpicklerWrapper(data_file, **pickle_load_args)
TypeError: __init__() got an unexpected keyword argument 'weights_only'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/edabk/anaconda3/envs/sovits_3_9/bin/svc", line 8, in <module>
    sys.exit(cli())
  File "/home/edabk/anaconda3/envs/sovits_3_9/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/edabk/anaconda3/envs/sovits_3_9/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/edabk/anaconda3/envs/sovits_3_9/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/edabk/anaconda3/envs/sovits_3_9/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/edabk/anaconda3/envs/sovits_3_9/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/edabk/anaconda3/envs/sovits_3_9/lib/python3.9/site-packages/so_vits_svc_fork/__main__.py", line 128, in train
    train(
  File "/home/edabk/anaconda3/envs/sovits_3_9/lib/python3.9/site-packages/so_vits_svc_fork/train.py", line 119, in train
    model = VitsLightning(reset_optimizer=reset_optimizer, **hparams)
  File "/home/edabk/anaconda3/envs/sovits_3_9/lib/python3.9/site-packages/so_vits_svc_fork/train.py", line 186, in __init__
    self.load(reset_optimizer)
  File "/home/edabk/anaconda3/envs/sovits_3_9/lib/python3.9/site-packages/so_vits_svc_fork/train.py", line 363, in load
    raise RuntimeError("Failed to load checkpoint") from e
RuntimeError: Failed to load checkpoint

I receive this error while running python=3.9.13 with torch version 1.12.1 and cuda-toolkit 11.3.

It seem like my pytorch version not have weight_only param in torch.load.

I've use torch+cu118 like in the guideline but receive the error that No computation device found ( I think that because of my cuda version not matching) so i 've to use torch=1.12.1 with cuda version 11.3

To Reproduce

conda create -n sovits python=3.9.13
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch
pip install so-vits-svc-fork

train svc

Additional context

No response

Version

lastest

Platform

Ubuntu 20.04

Code of Conduct

  • I agree to follow this project's Code of Conduct.

No Duplicate

  • I have checked existing issues to avoid duplicates.
@sonhm3029 sonhm3029 added the bug Something isn't working label Jun 25, 2023
@sbersier
Copy link

sbersier commented Jul 1, 2023

The weights_only parameter was indeed added in torch==1.13

Personally, I would install it like this:

mkdir MySovitsFolder
cd MySovitsFolder
python -m venv venv
source venv/bin/activate  # to activate the venv environnment
pip install -U torch torchaudio

In principle, it should install torch==2.0 with everything needed.
You can check that everything is fine with:
python -c "import torch; print(torch.__version__)"

Then:

pip install -U so-vits-svc-fork
svcg

And:
deactivate # to deactivate the environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants