bshall / knn-vc

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

Size mismatch error #25

Closed JBloodless closed 1 year ago

JBloodless commented 1 year ago

Hi! I'm trying to run basic quickstart script, but it gives me

Traceback (most recent call last):
  File "/data/code_jb/knn-vc/test_run.py", line 11, in <module>
    out_wav = knn_vc.match(query_seq, matching_set, topk=4)
  File "/data/SOFT/miniconda/envs/ml2/lib/python3.10/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/home/i.beskrovnyy/.cache/torch/hub/bshall_knn-vc_master/matcher.py", line 158, in match
    dists = fast_cosine_dist(query_seq, matching_set, device=device)
  File "/home/i.beskrovnyy/.cache/torch/hub/bshall_knn-vc_master/matcher.py", line 25, in fast_cosine_dist
    dotprod = -torch.cdist(source_feats[None].to(device), matching_pool[None], p=2)[0]**2 + source_norms[:, None]**2 + matching_norms[None]**2
RuntimeError: The size of tensor a (782) must match the size of tensor b (543) at non-singleton dimension 2

My src and target files are different in samplerate and length, can it be the problem?

JBloodless commented 1 year ago

Kinda resolved, stereo files are no-no for input :)

youhjjhhhjj commented 1 year ago

it's easy enough to do a torch.mean to make it mono, you can look at my fork for reference