bshall / knn-vc

Voice Conversion With Just Nearest Neighbors
https://bshall.github.io/knn-vc/
Other
450 stars 65 forks source link

Error in quickstart #24

Closed lesept777 closed 1 year ago

lesept777 commented 1 year ago

Hi, I'd like to test the KNN-VC model, but I'm getting an error at the very beginning:

Python 3.8.10 (default, May 26 2023, 14:05:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'2.0.1+cu117'
>>> import torch, torchaudio
>>> knn_vc = torch.hub.load('bshall/knn-vc', 'knn_vc', prematched=True, trust_repo=True, pretrained=True)
Downloading: "https://github.com/bshall/knn-vc/zipball/master" to /local/home/fa125436/.cache/torch/hub/master.zip
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data1/is156025/fa125436/N2D2/env/lib/python3.8/site-packages/torch/hub.py", line 558, in load
    model = _load_local(repo_or_dir, model, *args, **kwargs)
  File "/data1/is156025/fa125436/N2D2/env/lib/python3.8/site-packages/torch/hub.py", line 584, in _load_local
    hub_module = _import_module(MODULE_HUBCONF, hubconf_path)
  File "/data1/is156025/fa125436/N2D2/env/lib/python3.8/site-packages/torch/hub.py", line 98, in _import_module
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 848, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/local/home/fa125436/.cache/torch/hub/bshall_knn-vc_master/hubconf.py", line 15, in <module>
    from matcher import KNeighborsVC
  File "/local/home/fa125436/.cache/torch/hub/bshall_knn-vc_master/matcher.py", line 32, in <module>
    class KNeighborsVC(nn.Module):
  File "/local/home/fa125436/.cache/torch/hub/bshall_knn-vc_master/matcher.py", line 58, in KNeighborsVC
    def get_matching_set(self, wavs: list[Path] | list[Tensor], weights=None, vad_trigger_level=7) -> Tensor:
TypeError: 'type' object is not subscriptable
>>>

Can you please help? Thanks a lot

lesept777 commented 1 year ago

I got it to work finally. I had to remove all | None in the matcher.py file, as well as change def get_matching_set(self, wavs: list[Path] | list[Tensor], weights=None, vad_trigger_level=7) -> Tensor: to def get_matching_set(self, wavs, weights=None, vad_trigger_level=7) -> Tensor:

RF5 commented 1 year ago

Hi @lesept777

This issue is caused when you are using an unsupported python version. As in the readme here, the repo needs python version >=3.10 to work out of the box. If you use python 3.10 or newer, you should not receive any bugs.

Hope that helps!