lucidrains / audiolm-pytorch

Implementation of AudioLM, a SOTA Language Modeling Approach to Audio Generation out of Google Research, in Pytorch
MIT License
2.39k stars 255 forks source link

A problem with EncodecWrapper() #196

Closed Leezp99 closed 1 year ago

Leezp99 commented 1 year ago

Code: wav24k = wav24k.unsqueeze(0) codec.eval() codes, , = codec(wav24k, return_encoded = True)

Problem: File "preprocess.py", line 117, in processone codes, , _ = codec(wav24k, return_encoded = True) File "/home/lab-li.zhipeng/miniconda/enter/envs/ns2vc/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) File "/home/lab-li.zhipeng/miniconda/enter/envs/ns2vc/lib/python3.8/site-packages/audiolm_pytorch/encodec.py", line 103, in forward if emb: RuntimeError: Boolean value of Tensor with more than one value is ambiguous

How can i solve this problem? Input wav24k.shape = (1, 1, T)

LWprogramming commented 1 year ago

i think it was introduced in https://github.com/lucidrains/audiolm-pytorch/pull/195 based on the PR we could just check is None instead of truthiness, or probably better yet just put it inside the if return_encoded conditional. Want to make a PR?

lucidrains commented 1 year ago

whoops, my bad for merging it too quickly, should be good!

Leezp99 commented 1 year ago

it work correctly now? Thanks you for your work