# Greedy decoding produces empty output

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgreedy-decoding-produces-empty-output%2F3633%3E%5C
**Category:** 🤗Transformers\
**Created:** [February 14, 2021, 4:36am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgreedy-decoding-produces-empty-output%2F3633 "2021-02-14T04:36:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![prajjwal1](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/prajjwal1/32/2246_2.png) [@prajjwal1](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fprajjwal1)%5C
**Post date:** [February 14, 2021, 4:36am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgreedy-decoding-produces-empty-output%2F3633%2F1 "2021-02-14T04:36:46Z")

</div>

I’ve finetuned `ctrl`, and it seems that greedy decoding with `repetition_penalty=1.2` and `temperature=0` and top\_k sampling `('max_length': 64, 'do_sample':True, 'max_length':64, 'top_k':50, 'top_p':0.95`)  
produces empty sequences often when varied examples are provided as context. I wanted to know what is the reason for this usually ? I tried playing with parameters in `model.generate` , but they didn’t seem to help much directly. Also, some checkpoints in between are able to generate text for that sample. What is the reason usually ?

---

<div class="post-metadata">

**Author:** ![HYCTW](https://avatars.discourse-cdn.com/v4/letter/h/b77776/32.png) [@HYCTW](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FHYCTW)%5C
**Post date:** [June 29, 2022, 2:22am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgreedy-decoding-produces-empty-output%2F3633%2F2 "2022-06-29T02:22:33Z")

</div>

Hi I have same question  
Did you figure out why this problem occurs !?

---

<div class="post-metadata">

**Author:** ![v-xchen-v](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@v-xchen-v](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fv-xchen-v)%5C
**Post date:** [November 22, 2023, 4:09am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgreedy-decoding-produces-empty-output%2F3633%2F3 "2023-11-22T04:09:06Z")

</div>

Maybe need some format for prompt, such as decorate the context with question-answer format of f’Q:{context}\nA:’ to let finetuned model to generate the text you want.
