Skip to content

Add a temperature argument to the base sampler class #947

@mattdangerw

Description

@mattdangerw

We would like our samplers to support a temperature argument that allows tightening or loosening the probability distribution.

We can add this pretty simply in the base class by dividing our logits by a temperature parameter here before applying the softmax.

Checklist:

  • Sampler takes in a temperature argument in __init__, adds it to self, and populates it in get_config().
  • In __call__, use self.temperature to scale the logits.
  • Beam sampler will need to do the same (as it overrides call).
  • Add unit tests. E.g. this test could be adapted to run with a very low temperature, and assert that all output ids are zero.

Metadata

Metadata

Labels

stat:contributions welcomeAdd this label to feature request issues so they are separated out from bug reporting issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions