Skip to content

tinker_cookbook.completers.TinkerTokenCompleter

class tinker_cookbook.completers.TinkerTokenCompleter(TokenCompleter)

Token completer that uses a tinker.SamplingClient to sample actions.

Parameters:

  • sampling_client – Client used to sample from the model.
  • max_tokens – Maximum number of tokens to generate per call.
  • temperature – Sampling temperature. Default: 1.0.

Fields:

  • sampling_client (tinker.SamplingClient)
  • max_tokens (int)
  • temperature (float) – Default: 1.0

__call__(model_input, stop)

Sample an action from the policy given an observation.

Parameters:

  • model_input (tinker.ModelInput)
  • stop (StopCondition)