# Beam search error

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fbeam-search-error%2F5773%3E%5C
**Category:** 🤗Transformers\
**Created:** [April 26, 2021, 1:30pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fbeam-search-error%2F5773 "2021-04-26T13:30:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Felipehonorato](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/felipehonorato/32/48418_2.png) [@Felipehonorato](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FFelipehonorato)%5C
**Post date:** [April 26, 2021, 1:30pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fbeam-search-error%2F5773%2F1 "2021-04-26T13:30:37Z")

</div>

Well, i’ve trained a new model on GPT2 and added some tokens to control my generation. It all worked fine while i was using greedy search algorithm, but when i tried to switch for beam search algorithm it started to mess up my tokens, mixing it with regular words. Does anyone have a clue about why is that happening? And how can i solve it?

---

<div class="post-metadata">

**Author:** ![brando](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/brando/32/30114_2.png) [@brando](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbrando)%5C
**Post date:** [May 12, 2024, 12:17am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fbeam-search-error%2F5773%2F2 "2024-05-12T00:17:27Z")

</div>

related: [How to generate multiple text completions per prompt (like vLLM) using HuggingFace Transformers Pipeline without triggering an error?](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-generate-multiple-text-completions-per-prompt-like-vllm-using-huggingface-transformers-pipeline-without-triggering-an-error%2F86297)

related: [machine learning - How to generate multiple text completions per prompt (like vLLM) using HuggingFace Transformers Pipeline without triggering an error? - Stack Overflow](https://stackoverflow.com/questions/78466376/how-to-generate-multiple-text-completions-per-prompt-like-vllm-using-huggingfa)

---

<div class="post-metadata">

**Author:** ![brando](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/brando/32/30114_2.png) [@brando](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fbrando)%5C
**Post date:** [May 12, 2024, 12:17am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fbeam-search-error%2F5773%2F3 "2024-05-12T00:17:34Z")

</div>

did you find an answer?
