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

Shorten the conversation tests for speed + fixing position overflows #26960

Merged
merged 11 commits into from
Oct 31, 2023

Conversation

Rocketknight1
Copy link
Member

Some of the conversation tests were still overflowing the maximum position embeddings for very short models like BlenderBotSmall. I reduced the limits a lot, which also speeds up those tests! cc @ydshieh

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Oct 20, 2023

The documentation is not available anymore as the PR was closed or merged.

@ydshieh
Copy link
Collaborator

ydshieh commented Oct 20, 2023

Hi @Rocketknight1 . Thanks a lot. I think it's probably better to simply skip this test for blenderbot small.

Could you remind me why the test was never failing before?

@Rocketknight1
Copy link
Member Author

@ydshieh the test never failed before because the ConversationalPipeline class wasn't working very well, and didn't actually generate any text in these tests!

@ydshieh
Copy link
Collaborator

ydshieh commented Oct 20, 2023

Thanks. Then let's just skip it for this model. You can search def is_pipeline_test_to_skip to see how to skip pipeline tests.

@Rocketknight1
Copy link
Member Author

@ydshieh are you sure? I think the test makes more sense with very short outputs anyway - we don't need 20 tokens to confirm the pipeline works!

@ydshieh
Copy link
Collaborator

ydshieh commented Oct 20, 2023

That's true, but making it this way also hide the fact of some models fail this test. Having a skip make it explicit. We can definitely use 2 instead of 20 if we do have a gain of running time (not that usually the model used for pipeline testing is very small, and not really obvious to say we will have a gain).

@Rocketknight1
Copy link
Member Author

BlenderBotSmall can pass the test! The problem only arises because the test BlenderBotSmallConfig has max_position_embeddings=20. Maybe I keep the test at a higher number, but increase the BlenderBotSmallConfig in the test to have more position embeddings, so it passes more easily?

@ArthurZucker
Copy link
Collaborator

Hey! Let's just skip it for now it's blocking a few prs!

@ArthurZucker
Copy link
Collaborator

I'll merge #27013 so you have time to work on the fix

@Rocketknight1
Copy link
Member Author

cc @ydshieh @ArthurZucker this should be ready to go now! I've skipped the test for BlenderBotSmall as @ydshieh suggested because the problem is in the hf-internal-testing checkpoint, and I don't think the model has much usage anymore. The model actually works fine - the test checkpoint just has a very low value for max_position_embeddings.

I also increased max_new_tokens back to 5 in the general test and removed the workarounds that @ArthurZucker added. I don't think it needs to go higher - it just makes the test slower, and doesn't tell us anything new!

@Rocketknight1
Copy link
Member Author

Quick ping again @ydshieh @ArthurZucker! This PR should be ready to go

@@ -85,7 +85,7 @@ def __init__(
hidden_act="gelu",
hidden_dropout_prob=0.1,
attention_probs_dropout_prob=0.1,
max_position_embeddings=20,
max_position_embeddings=50,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change won't be reflect on the tiny models uploaded to Hub (hf-internal-testing). So the pipeline testing will still use the previous value. We still skip the test, so it is fine, but the change here has no effect.

Copy link
Collaborator

Choose a reason for hiding this comment

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

(the above is just a comment, not a request to change)

Comment on lines 284 to 286
@unittest.skip("Tiny random model has too few position embeddings for this.")
def test_pipeline_conversational(self):
pass
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's put this back to is_pipeline_test_to_skip (above) and just remove # TODO @Rocketnight1 to fix with the comment Tiny random model has too few position embeddings for this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do!

Comment on lines 401 to 403
@unittest.skip("Tiny random model has too few position embeddings for this.")
def test_pipeline_conversational(self):
pass
Copy link
Collaborator

Choose a reason for hiding this comment

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

same

Comment on lines 212 to 214
@unittest.skip("Tiny random model has too few position embeddings for this.")
def test_pipeline_conversational(self):
pass
Copy link
Collaborator

Choose a reason for hiding this comment

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

same

@@ -77,14 +77,14 @@ def get_test_pipeline(self, model, tokenizer, processor):

def run_pipeline_test(self, conversation_agent, _):
# Simple
outputs = conversation_agent(Conversation("Hi there!"), max_new_tokens=20)
outputs = conversation_agent(Conversation("Hi there!"), max_new_tokens=5)
Copy link
Collaborator

Choose a reason for hiding this comment

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

ok

@ydshieh
Copy link
Collaborator

ydshieh commented Oct 27, 2023

Damm, I made review but forgot to commit the comments. Sorry

@Rocketknight1
Copy link
Member Author

@ydshieh Changes made as you suggested - I used is_pipeline_test_to_skip. I left the updated sequence lengths alone because even though they don't fix our tiny-random models, they do fix some other tests, especially for BlenderBot.

Copy link
Collaborator

@amyeroberts amyeroberts 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 fixing!

Rocketknight1 and others added 3 commits October 31, 2023 14:00
Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>
…all.py

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>
…l.py

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>
@Rocketknight1 Rocketknight1 merged commit 08fadc8 into main Oct 31, 2023
18 checks passed
@Rocketknight1 Rocketknight1 deleted the reduce_conversation_test_length branch October 31, 2023 14:20
EduardoPach pushed a commit to EduardoPach/transformers that referenced this pull request Nov 19, 2023
…uggingface#26960)

* Shorten the conversation tests for speed + fixing position overflows

* Put max_new_tokens back to 5

* Remove test skips

* Increase max_position_embeddings in blenderbot tests

* Add skips for blenderbot_small

* Correct TF test skip

* make fixup

* Reformat skips to use is_pipeline_test_to_skip

* Update tests/models/blenderbot_small/test_modeling_blenderbot_small.py

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

* Update tests/models/blenderbot_small/test_modeling_flax_blenderbot_small.py

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

* Update tests/models/blenderbot_small/test_modeling_tf_blenderbot_small.py

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

---------

Co-authored-by: amyeroberts <22614925+amyeroberts@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.

5 participants