Generate: fix generation with inputs_embeds when input_ids=None for llama and gemma#29821
Generate: fix generation with inputs_embeds when input_ids=None for llama and gemma#29821njhill wants to merge 2 commits intohuggingface:mainfrom
inputs_embeds when input_ids=None for llama and gemma#29821Conversation
The changes in huggingface#29467 break generation with inputs_embeds when input_ids is None since they expect input_ids to be non-None even for the prefill forward without past_key_values.
|
Thanks @gante, this is specifically when using |
inputs_embeds for llama and gemmainputs_embeds when input_ids=None for llama and gemma
|
@njhill uhmmm the test checks that combination as well 🤔 # input_ids is not a required input -- if we don't pass it, the newly generated tokens will be the same
outputs_from_embeds_wo_ids = model.generate(
inputs_embeds=inputs_embeds, max_new_tokens=20 - inputs_embeds.shape[1]
)
self.assertListEqual(
outputs_from_embeds[:, inputs_embeds.shape[1] :].tolist(),
outputs_from_embeds_wo_ids.tolist(),
)(you can run the test with This means that there is probably something else going on, which could be interesting to pin down :) |
|
@gante ah apologies for not looking at those closely enough, and thank you for the tip of how to run. Let me dig in deeper to see what's going on here. |
|
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
The changes in #29467 break generation with
inputs_embedswheninput_idsisNonesince they expectinput_idsto be non-Noneeven for the prefill forward withoutpast_key_values.@gante