-
Notifications
You must be signed in to change notification settings - Fork 28.1k
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
Generation: fix test #34369
Generation: fix test #34369
Conversation
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
# code is up to date with our most recent standards | ||
if ( | ||
"inputs_embeds" in prepare_inputs_for_generation_args | ||
and "cache_positions" in prepare_inputs_for_generation_args |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this part was never executed, because of the typo in cache_positions
-- correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep :)
outputs_from_ids = model.generate( | ||
input_ids, max_new_tokens=5, return_dict_in_generate=True, output_scores=True | ||
) | ||
outputs_from_ids = model.generate(input_ids, max_new_tokens=5, **generation_kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: max_new_tokens
can be moved to generation_kwargs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
* fix test * fix copies
What does this PR do?
Fixes one part of the test that was not being triggered when we run it with
pytest
because it had typo incache_position(S)
. Fixing the typo resulted in a whole bunch of errors most of which are caused by apparently non-deterministic output when setting therepetition_penalty
. Thus I moved the test for beam-search + input-embeds to another placeThe main idea when writing this test was to make sure beam search works with inputs embeds for decoder-only models that now support new cache format, so I think the change should be fine