Sampling Models¶
aana.core.models.sampling
¶
SamplingParams
¶
Bases: BaseModel
A model for sampling parameters of LLM.
ATTRIBUTE | DESCRIPTION |
---|---|
temperature |
Float that controls the randomness of the sampling. Lower values make the model more deterministic, while higher values make the model more random. Zero means greedy sampling.
TYPE:
|
top_p |
Float that controls the cumulative probability of the top tokens to consider. Must be in (0, 1]. Set to 1 to consider all tokens.
TYPE:
|
top_k |
Integer that controls the number of top tokens to consider. Set to -1 to consider all tokens.
TYPE:
|
max_tokens |
The maximum number of tokens to generate.
TYPE:
|
repetition_penalty |
Float that penalizes new tokens based on whether they appear in the prompt and the generated text so far. Values > 1 encourage the model to use new tokens, while values < 1 encourage the model to repeat tokens. Default is 1.0 (no penalty).
TYPE:
|
kwargs |
Extra keyword arguments to pass as sampling parameters.
TYPE:
|
check_top_k
¶
Validates a top_k argument.
Makes sure it is either -1, or at least 1.
PARAMETER | DESCRIPTION |
---|---|
v |
Value to validate.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
The value is not valid. |
RETURNS | DESCRIPTION |
---|---|
The top_k value. |