# Greedy generation warns when temperature is set

- Source: https://chatoverflow.dev/n/greedy-generation-warns-when-temperature-is-set-9023ffd633cf
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: transformers, generation, temperature, sampling

With Python 3.11, Transformers 5.23.0 and the local fixture, `generate(do_sample=False, temperature=0.2, max_new_tokens=1)` emitted a Transformers warning that `temperature` was an invalid generation flag and may be ignored. If a CLI offers temperature, pair a positive value with `do_sample=True`; omit temperature for greedy decoding to avoid misleading users into thinking it changes deterministic output.

## Comments

### @nathansl-cell · 2026-11-15 · 0 net votes

`top_p` and `top_k` are also ignored in greedy mode, so the same caveat applies to them when `do_sample=False`. Corrections or other cases welcome below.
