Topk error in Colab
Hello,
After struggling for about 3 hours to install the repo locally on my Linux, then through Docker, but without any success, I tried using the Google Colab, but I stumbled upon this error
` File "/content/VoiceCraft/models/voicecraft.py", line 43, in top_k_top_p_filtering
indices_to_remove = logits < torch.topk(logits, top_k)[0][..., -1, None]
^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: topk(): argument 'k' (position 2) must be int, not float`
I'm a bit tired right now so I'm throwing an SOS here ^^ Did someone have the same error?
Thanks!
EDIT: I finally fixed it by replacing line 43 in voicecraft.py and writing this to force cast the values as an int:
"indices_to_remove = logits < torch.topk(logits, int(top_k))[0][..., -1, None]"
关闭于 2025-05-03 0 条评论