-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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
[generate
] fix breaking change for patch
#29976
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.
Thank you for the fix 👍
tests/generation/test_utils.py
Outdated
input_embeds = model.get_input_embeddings()(input_ids) | ||
beam_kwargs.update({"inputs_embeds": input_embeds}) | ||
output_generate2 = self._beam_sample_generate( | ||
model=model, | ||
input_ids=None, | ||
attention_mask=attention_mask, | ||
max_length=max_length, | ||
beam_kwargs=beam_kwargs, | ||
logits_warper_kwargs=logits_warper_kwargs, | ||
) | ||
|
||
torch.testing.assert_close(output_generate[:, input_embeds.shape[1] :], output_generate2) |
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.
This can't be tested in the mixin -- the vast majority of the models don't support passing inputs_embeds
to generate
, they need would some changes in prepare_inputs_for_generate
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.
Alright I'll check the signature
Failing test is unrelated |
* fix bug and add tests * nit * otherway to get the cur len instead of attention mask * more places where this might have been broken * nit * oups * inputs_embeds vs input_embeds * test generated outptus * style * nit * fix * skip failing biogpt
What does this PR do?
A bug was introduced by #29467 pretty much unrelated to cache positions.
This fixes #29968
cc @gante and @zucchini-nlp. The testing suite is missing this particular test for all generation strategies