For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Python class
LogitsPostprocessMixin
LogitsPostprocessMixin
class max.nn.transformer.LogitsPostprocessMixin
Bases: object
Mixin providing logits postprocessing for single-device models.
Subclasses must define norm, lm_head, and
return_logits. The return_hidden_states and
logits_scaling attributes are optional and have defaults.
lm_head
lm_head: Callable[[TensorValue], TensorValue]
The language model head projection.
logits_scaling
logits_scaling: float = 1.0
A divisor applied to logits after projection. Logits are divided by
this value before returning. Defaults to 1.0 (no scaling).
norm
norm: Callable[[TensorValue], TensorValue]
The normalization function applied before the language model head.
return_hidden_states
return_hidden_states: ReturnHiddenStates = 'none'
Which hidden states to return. Defaults to ReturnHiddenStates.NONE.
return_logits
return_logits: ReturnLogits
Which logits to return.