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

argument 'ids': 'float' object cannot be interpreted as an integer #379

Open
jhj0517 opened this issue Nov 4, 2024 · 2 comments
Open

argument 'ids': 'float' object cannot be interpreted as an integer #379

jhj0517 opened this issue Nov 4, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@jhj0517
Copy link
Owner

jhj0517 commented Nov 4, 2024

  File "C:\Whisper_Project\Whisper-WebUI\venv\Lib\site-packages\transformers\models\whisper\tokenization_whisper_fast.py", line 565, in _decode_asr
    return _decode_asr(
           ^^^^^^^^^^^^
  File "C:\Whisper_Project\Whisper-WebUI\venv\Lib\site-packages\transformers\models\whisper\tokenization_whisper.py", line 985, in _decode_asr
    text = tokenizer.decode([token])
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Whisper_Project\Whisper-WebUI\venv\Lib\site-packages\transformers\models\whisper\tokenization_whisper_fast.py", line 354, in decode
    text = super().decode(
           ^^^^^^^^^^^^^^^
  File "C:\Whisper_Project\Whisper-WebUI\venv\Lib\site-packages\transformers\tokenization_utils_base.py", line 4004, in decode
    return self._decode(
           ^^^^^^^^^^^^^
  File "C:\Whisper_Project\Whisper-WebUI\venv\Lib\site-packages\transformers\models\whisper\tokenization_whisper_fast.py", line 380, in _decode
    text = super()._decode(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Whisper_Project\Whisper-WebUI\venv\Lib\site-packages\transformers\tokenization_utils_fast.py", line 654, in _decode
    text = self._tokenizer.decode(token_ids, skip_special_tokens=skip_special_tokens)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument 'ids': 'float' object cannot be interpreted as an integer

This only happens for a few audio files when I use insanely_fast_whisper.
This probably happens when the transcription ends without a proper 'end token'.

@jhj0517 jhj0517 added the bug Something isn't working label Nov 4, 2024
@jhj0517 jhj0517 self-assigned this Nov 4, 2024
@kadmy
Copy link

kadmy commented Nov 8, 2024

I'm getting this error on any audio files when I use insanely_fast_whisper. What should I do to add a proper 'end token' to the transcription?

@jhj0517
Copy link
Owner Author

jhj0517 commented Nov 9, 2024

@kadmy This bug is related to transformers, somehow the token_ids is the list of float types sometimes.

Quick fix would be to follow line 654 of transformers\tokenization_utils_fast.py as the stack trace says,
and edit token_ids to cast to int:

token_ids = [int(_id) for _id in token_ids]
text = self._tokenizer.decode(token_ids, skip_special_tokens=skip_special_tokens)

I made a PR in transformers for this : huggingface/transformers#34663

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