a2rl.GPTBuilder.sample#

GPTBuilder.sample(seq, n_steps, temperature=1.0, sample=False, top_k=False)#

Sample the next n_steps token.

Parameters:
  • seq (ndarray) – These is a sequence of GPT tokens. You need to convert dataframe token to GPT token using Tokenizer.gpt_tokenize()

  • n_steps (int) – Number of steps to predict.

  • temperature (float) – The temperature controls the randomness of predicted samples by scaling the logits before applying softmax.

  • sample (bool) – When True, returns random samples of actions from the top-k logits. Otherwise, straightaway returns the top-k logits.

  • top_k (bool) – The number of logits to consider for the returned actions.

Return type:

ndarray

Returns:

The original context, concatenated with the next n_steps predicted token.