# Why do we set input\_ids = decoder\_input\_ids in beam search?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fwhy-do-we-set-input-ids-decoder-input-ids-in-beam-search%2F10868%3E%5C
**Category:** 🤗Transformers\
**Created:** [October 18, 2021, 1:41pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fwhy-do-we-set-input-ids-decoder-input-ids-in-beam-search%2F10868 "2021-10-18T13:41:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![StackSmasher](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@StackSmasher](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FStackSmasher)%5C
**Post date:** [October 18, 2021, 1:41pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fwhy-do-we-set-input-ids-decoder-input-ids-in-beam-search%2F10868%2F1 "2021-10-18T13:41:13Z")

</div>

Pretty much the title. Here’s the [reference to the code](https://github.com/huggingface/transformers/blob/7c6cd0ac28f1b760ccb4d6e4761f13185d05d90b/src/transformers/generation_utils.py#L908-L914)

I wanted to generate text using beam search when I have `inputs_embeds`, `attention_mask`, `decoder_input_ids` and `decoder_attention_mask`

Why is that code setting `input_ids` using `decoder_input_ids`, I also see no way to stop it from doing that. If there isn’t any way, can anyone please link a resource that shows how to do conditional generation (I’m using BART model) when I have the above parameters ? (`inputs_embeds`, `attention_mask`, `decoder_input_ids` and `decoder_attention_mask`)

Thanks
