Skip to content

[WHISPER] Update modeling tests#20162

Merged
ArthurZucker merged 9 commits into
huggingface:mainfrom
ArthurZucker:fix-whisper-tok-update
Nov 15, 2022
Merged

[WHISPER] Update modeling tests#20162
ArthurZucker merged 9 commits into
huggingface:mainfrom
ArthurZucker:fix-whisper-tok-update

Conversation

@ArthurZucker

Copy link
Copy Markdown
Collaborator

What does this PR do?

Fixes the test after the update of the tokenizer, which added sufix and prefix tokens.

@ArthurZucker ArthurZucker self-assigned this Nov 10, 2022
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

@ArthurZucker ArthurZucker requested a review from ydshieh November 10, 2022 14:19
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

@ydshieh ydshieh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you @ArthurZucker . LGTM, but let @sanchit-gandhi have a review too, as he is better whisper than me!

@ydshieh ydshieh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sorry, I have a question now 🙏 !

Comment thread tests/models/whisper/test_modeling_tf_whisper.py Outdated

@sanchit-gandhi sanchit-gandhi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the fix @ArthurZucker! The slow tokenizer integration test looks good - have some comments regarding the logits test (see below).

Comment thread tests/models/whisper/test_modeling_whisper.py Outdated
Comment thread tests/models/whisper/test_modeling_tf_whisper.py Outdated
Comment thread tests/models/whisper/test_modeling_tf_whisper.py Outdated
@ArthurZucker

Copy link
Copy Markdown
Collaborator Author

I agree, it is indeed better to just use add_special_tokens=False! Slipped my mind 😉

Co-authored-by: Sanchit Gandhi <93869735+sanchit-gandhi@users.noreply.github.com>
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

@ydshieh

ydshieh commented Nov 14, 2022

Copy link
Copy Markdown
Collaborator

Ping me again once when you think it's ready :)

@sanchit-gandhi

sanchit-gandhi commented Nov 14, 2022

Copy link
Copy Markdown
Contributor

Looks like we still need to add add_special_tokens=False to the tf test @ArthurZucker!

@ArthurZucker

Copy link
Copy Markdown
Collaborator Author

Yeah on it 🤗

Co-authored-by: Sanchit Gandhi <93869735+sanchit-gandhi@users.noreply.github.com>
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

@ArthurZucker

Copy link
Copy Markdown
Collaborator Author

Ah there's small bug with this, the kwargs is passed to self.pad in the feature extractor. Gonna fix that

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

@sanchit-gandhi sanchit-gandhi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for iterating @ArthurZucker! Just one question about the removal of the kwargs in the feature extractor call method (see below).

max_length=max_length if max_length else self.n_samples,
truncation=truncation,
pad_to_multiple_of=pad_to_multiple_of,
**kwargs,

@sanchit-gandhi sanchit-gandhi Nov 14, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't see the kwargs being used at all now. If we don't use the kwargs we can remove them from the call in L288:

Are we certain the kwargs were erroneous here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yes, the add_special_tokens was passed down until here. Checked that wav2vec2 does not use kwargs for padding, plus the call is similar and kwargs are not popped out, so appears as the good solution.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We might have to keep them for pipeline compatibility, will check that thanks 👍🏻

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay brill - sounds good in that case (pop from here, not in L228).

Comment thread tests/models/whisper/test_modeling_tf_whisper.py

@ydshieh ydshieh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM now! Thank you for your patience. Will leave @sanchit-gandhi and you to final the PR regarding the kwargs

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

@ArthurZucker ArthurZucker merged commit 11b2e45 into huggingface:main Nov 15, 2022
@ArthurZucker ArthurZucker deleted the fix-whisper-tok-update branch November 15, 2022 10:05
mpierrau pushed a commit to mpierrau/transformers that referenced this pull request Dec 15, 2022
* Update modeling tests

* update tokenization test

* typo

* nit

* fix expected attention outputs

* Apply suggestions from code review

Co-authored-by: Sanchit Gandhi <93869735+sanchit-gandhi@users.noreply.github.com>

* Update tests from review

Co-authored-by: Sanchit Gandhi <93869735+sanchit-gandhi@users.noreply.github.com>
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>

* remove problematics kwargs passed to the padding function

Co-authored-by: Sanchit Gandhi <93869735+sanchit-gandhi@users.noreply.github.com>
Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
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