MCPcopy Create free account
hub / github.com/apple/axlearn / DecodingState

Class DecodingState

axlearn/common/decoding.py:731–745  ·  view source on GitHub ↗

Holds sample decoding state data.

Source from the content-addressed store, hash-verified

729
730
731class DecodingState(NamedTuple):
732 """Holds sample decoding state data."""
733
734 # The position of the decoding loop in the length dimension.
735 cur_index: Tensor # scalar int32: current decoded length index.
736 # The active sequences.
737 sequences: Tensor # int32: [batch_size, num_decodes, max_decode_len].
738 # The sequence token log probabilities.
739 token_scores: Tensor # float32: [batch_size, num_decodes, max_decode_len].
740 # Whether a stop decoding condition has been reached.
741 stop_decoding: Tensor # bool: [batch_size, num_decodes].
742 # The current state of the autoregressive decoding caches.
743 cache: NestedTensor
744 # Random generator state.
745 prng_key: Tensor
746
747
748def _decode_init(

Callers 2

_decode_initFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected