Skip to content

Default setting of GenerationConfig #33427

Description

@jiangwangyi

System Info

- `transformers` version: 4.44.2
- Platform: Linux-5.15.0-91-generic-x86_64-with-glibc2.35
- Python version: 3.11.9

Who can help?

@gante @SunMarc

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

When creating a GenerationConfig instance with the following code:

>>> from transformers import GenerationConfig
>>> GenerationConfig(do_sample=False, temperature=0.0)

I encounter the following warning:

UserWarning: `do_sample` is set to `False`. However, `temperature` is set to `0.0` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `temperature`. This was detected when initializing the generation config instance, which means the corresponding file may hold incorrect parameterization and should be fixed.

I don't believe these two parameters conflict with each other. Additionally, I am curious why the default temperature value is set to 1.0 when do_sample is False by default, indicating that greedy sampling is the default setting.

Expected behavior

  1. No warning should be issued when do_sample=False and temperature=0.0.
  2. Clarification on why the default temperature is 1.0 when do_sample=False.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions