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 usingTokenizer.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
) – WhenTrue
, returns random samples of actions from thetop-k
logits. Otherwise, straightaway returns thetop-k
logits.top_k (
bool
) – The number of logits to consider for the returned actions.
- Return type:
- Returns:
The original context, concatenated with the next
n_steps
predicted token.