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

Whisper AttributeError: 'tuple' object has no attribute 'flatten' #31

Closed
adriangalilea opened this issue Dec 7, 2023 · 2 comments
Closed

Comments

@adriangalilea
Copy link

As per the readme suggest I tried:

import whisper

speech_file = "test.mp3"

text = whisper.transcribe(speech_file)["text"]

print(text)

And got

(venv) (base) ➜  whisper git:(main) ✗ python app.py 
Traceback (most recent call last):
  File "/Users/adrian/Developer/mlx-examples/whisper/app.py", line 5, in <module>
    text = whisper.transcribe(speech_file)["text"]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/adrian/Developer/mlx-examples/whisper/whisper/transcribe.py", line 303, in transcribe
    timestamps = tokens[timestamp_tokens.nonzero().flatten()]
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'tuple' object has no attribute 'flatten'
@serinuntius
Copy link

I encountered the same error, but resolved it with this PR.

#12

@awni
Copy link
Member

awni commented Dec 7, 2023

Should be fixed with #12

@awni awni closed this as completed Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants