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

**URL:** <https://discuss.huggingface.co/t/why-do-we-set-input-ids-decoder-input-ids-in-beam-search/10868>\
**Category:** 🤗Transformers\
**Created:** [October 18, 2021, 1:41pm UTC](https://discuss.huggingface.co/t/why-do-we-set-input-ids-decoder-input-ids-in-beam-search/10868 "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](https://discuss.huggingface.co/u/StackSmasher)\
**Post date:** [October 18, 2021, 1:41pm UTC](https://discuss.huggingface.co/t/why-do-we-set-input-ids-decoder-input-ids-in-beam-search/10868/1 "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
