neuralmonkey.runners.beamsearch_runner module¶
-
class
neuralmonkey.runners.beamsearch_runner.
BeamSearchRunner
(output_series: str, decoder: neuralmonkey.decoders.beam_search_decoder.BeamSearchDecoder, rank: int = 1, postprocess: Callable[[List[str]], List[str]] = None) → None¶ Bases:
neuralmonkey.runners.base_runner.BaseRunner
A runner which takes the output from a beam search decoder.
The runner and the beam search decoder support ensembling.
-
class
Executable
(executor: neuralmonkey.runners.beamsearch_runner.BeamSearchRunner, compute_losses: bool, summaries: bool, num_sessions: int) → None¶ Bases:
neuralmonkey.runners.base_runner.Executable
-
__init__
(executor: neuralmonkey.runners.beamsearch_runner.BeamSearchRunner, compute_losses: bool, summaries: bool, num_sessions: int) → None¶ Initialize self. See help(type(self)) for accurate signature.
-
collect_results
(results: List[Dict]) → None¶
-
next_to_execute
() → Tuple[Union[Dict, List], List[Dict[tensorflow.python.framework.ops.Tensor, Union[int, float, numpy.ndarray]]]]¶ Get the tensors and additional feed dicts for execution.
-
prepare_results
(output)¶
-
-
__init__
(output_series: str, decoder: neuralmonkey.decoders.beam_search_decoder.BeamSearchDecoder, rank: int = 1, postprocess: Callable[[List[str]], List[str]] = None) → None¶ Initialize the beam search runner.
Parameters: - output_series – Name of the series produced by the runner.
- decoder – The beam search decoder to use.
- rank – The hypothesis from the beam to select. Setting rank to 1 selects the best hypothesis.
- postprocess – The postprocessor to apply to the output data.
-
fetches
¶
-
loss_names
¶
-
class
-
neuralmonkey.runners.beamsearch_runner.
beam_search_runner_range
(output_series: str, decoder: neuralmonkey.decoders.beam_search_decoder.BeamSearchDecoder, max_rank: int = None, postprocess: Callable[[List[str]], List[str]] = None) → List[neuralmonkey.runners.beamsearch_runner.BeamSearchRunner]¶ Return beam search runners for a range of ranks from 1 to max_rank.
This means there is max_rank output series where the n-th series contains the n-th best hypothesis from the beam search.
Parameters: - output_series – Prefix of output series.
- decoder – Beam search decoder shared by all runners.
- max_rank – Maximum rank of the hypotheses.
- postprocess – Series-level postprocess applied on output.
Returns: List of beam search runners getting hypotheses with rank from 1 to max_rank.