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

Method beam_search_decode

axlearn/common/decoder.py:845–859  ·  view source on GitHub ↗

See configured `decoding` implementation for details.

(
        self,
        *,
        input_batch: Nested[Tensor],
        max_sequence_length: int,
        num_decodes: int,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

843 # recursively search through potentials.
844 # They backtrace to some anchor time step after exploring for t steps.
845 # This requires tracking time_step separately from the attention time_step.
846 time_step=(cached_states["time_step"] + step_len),
847 )
848 if cfg.attention_mask is not None:
849 updated_states["input_ids"] = updated_inputs
850 return updated_states, outputs
851
852 def beam_search_decode(
853 self,
854 *,
855 input_batch: Nested[Tensor],
856 max_sequence_length: int,
857 num_decodes: int,
858 **kwargs,
859 ):
860 """See configured `decoding` implementation for details."""
861 return self._decoding.beam_search_decode(
862 input_batch=input_batch,

Calls

no outgoing calls