# Greedy sampling with the new branch

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgreedy-sampling-with-the-new-branch%2F96140%3E%5C
**Category:** 🤗Transformers\
**Created:** [July 8, 2024, 11:49am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgreedy-sampling-with-the-new-branch%2F96140 "2024-07-08T11:49:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lcpandia](https://avatars.discourse-cdn.com/v4/letter/l/c4cdca/32.png) [@lcpandia](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Flcpandia)%5C
**Post date:** [July 8, 2024, 11:49am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fgreedy-sampling-with-the-new-branch%2F96140%2F1 "2024-07-08T11:49:09Z")

</div>

With new version starting from 4.39, performing greedy search gives a warning:  
You should set `do_sample=True` or unset `temperature`.  
I am loading pretrained llama2-7b-chat-hf model. I understand that by default temperature is set to 0.6, so I explicitly set it to 0 while calling generate function.  
Something like this: model.generate(do\_sample=False, temperature=0)  
But I get a warning message that either set do\_sample to True or unset temperature  
Is the warning hampering the greedy decoding process or can I ignore it?  
(FYI I have tried with do\_sample=True and top\_k=1 which should ideally be same as greedy decoding. But just wanted to confirm if do\_sample=True really gives greedy decoding results)  
If we cannot ignore it, then how should I unset the temperature?
