Skip to content

🚨🚨[Whisper Tok] Update integration test#29368

Merged
sanchit-gandhi merged 2 commits intohuggingface:mainfrom
sanchit-gandhi:whisper-tokenizer
Mar 1, 2024
Merged

🚨🚨[Whisper Tok] Update integration test#29368
sanchit-gandhi merged 2 commits intohuggingface:mainfrom
sanchit-gandhi:whisper-tokenizer

Conversation

@sanchit-gandhi
Copy link
Copy Markdown
Contributor

What does this PR do?

The merges for the Whisper tokenizers were updated on the Hub in this PR. While this is a breaking change, it is a required fix to ensure we have parity with the original OpenAI repo.

This PR updates the integration tests for the Whisper tokenizer to reflect the merge changes.

self.assertListEqual(
tokenizer.convert_tokens_to_ids(tokens),
[5723, 307, 257, 220, 31636],
[5723, 307, 257, 1500],
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now gives equivalent results to the original:

from whisper.tokenizer import get_tokenizer

tokenizer = get_tokenizer(True)
tokens = tokenizer.encode("This is a test")
print(tokens)

Print Output:

[5723, 307, 257, 1500]

self.assertEqual(output, [])

@require_jinja
def test_tokenization_for_chat(self):
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chat template doesn't make sense for Whisper (a speech recognition model) - have removed the test to keep the CI lightweight (cc @Rocketknight1)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me!

@sanchit-gandhi
Copy link
Copy Markdown
Contributor Author

Also cc @ydshieh as this PR will prevent a red CI on main

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Copy Markdown
Collaborator

@ArthurZucker ArthurZucker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the prompt fix, it's breaking so I'll probably update the PR tittle with ⚠️

@ArthurZucker ArthurZucker changed the title [Whisper Tok] Update integration test 🚨🚨[Whisper Tok] Update integration test Mar 1, 2024
@sanchit-gandhi
Copy link
Copy Markdown
Contributor Author

The GH PR itself is not strictly breaking (there's no change to the code), but rather it's the Hub PR which is breaking. Fine for me to leave the 🚨 in the title though to book-log this!

@sanchit-gandhi sanchit-gandhi merged commit 0a0a279 into huggingface:main Mar 1, 2024
@sanchit-gandhi sanchit-gandhi deleted the whisper-tokenizer branch March 1, 2024 09:22
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

Successfully merging this pull request may close these issues.

4 participants