neuralmonkey.runners package

Submodules

neuralmonkey.runners.base_runner module

class neuralmonkey.runners.base_runner.BaseRunner(output_series: str, decoder: neuralmonkey.model.model_part.ModelPart) → None

Bases: object

decoder_data_id
get_executable(compute_losses: bool = False, summaries: bool = True) → neuralmonkey.runners.base_runner.Executable
loss_names
class neuralmonkey.runners.base_runner.Executable

Bases: object

collect_results(results: typing.List[typing.Dict]) → None
next_to_execute() → typing.Tuple[typing.Set[neuralmonkey.model.model_part.ModelPart], typing.Union[typing.Dict, typing.List], typing.Dict[tensorflow.python.framework.ops.Tensor, typing.Union[int, float, numpy.ndarray]]]
class neuralmonkey.runners.base_runner.ExecutionResult(outputs, losses, scalar_summaries, histogram_summaries, image_summaries)

Bases: tuple

histogram_summaries

Alias for field number 3

image_summaries

Alias for field number 4

losses

Alias for field number 1

outputs

Alias for field number 0

scalar_summaries

Alias for field number 2

neuralmonkey.runners.base_runner.reduce_execution_results(execution_results: typing.List[neuralmonkey.runners.base_runner.ExecutionResult]) → neuralmonkey.runners.base_runner.ExecutionResult

Aggregate execution results into one.

neuralmonkey.runners.beamsearch_runner module

class neuralmonkey.runners.beamsearch_runner.BeamSearchExecutable(rank: int, all_encoders: typing.Set[neuralmonkey.model.model_part.ModelPart], bs_outputs: neuralmonkey.decoders.beam_search_decoder.SearchStepOutput, vocabulary: neuralmonkey.vocabulary.Vocabulary, postprocess: typing.Union[typing.Callable, NoneType]) → None

Bases: neuralmonkey.runners.base_runner.Executable

collect_results(results: typing.List[typing.Dict]) → None
next_to_execute() → typing.Tuple[typing.Set[neuralmonkey.model.model_part.ModelPart], typing.Union[typing.Dict, typing.List], typing.Dict[tensorflow.python.framework.ops.Tensor, typing.Union[int, float, numpy.ndarray]]]
class neuralmonkey.runners.beamsearch_runner.BeamSearchRunner(output_series: str, decoder: neuralmonkey.decoders.beam_search_decoder.BeamSearchDecoder, rank: int = 1, postprocess: typing.Callable[[typing.List[str]], typing.List[str]] = None) → None

Bases: neuralmonkey.runners.base_runner.BaseRunner

decoder_data_id
get_executable(compute_losses: bool = False, summaries: bool = True) → neuralmonkey.runners.beamsearch_runner.BeamSearchExecutable
loss_names
neuralmonkey.runners.beamsearch_runner.beam_search_runner_range(output_series: str, decoder: neuralmonkey.decoders.beam_search_decoder.BeamSearchDecoder, max_rank: int = None, postprocess: typing.Callable[[typing.List[str]], typing.List[str]] = None) → typing.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.

neuralmonkey.runners.label_runner module

class neuralmonkey.runners.label_runner.LabelRunExecutable(all_coders, fetches, vocabulary, postprocess)

Bases: neuralmonkey.runners.base_runner.Executable

collect_results(results: typing.List[typing.Dict]) → None
next_to_execute() → typing.Tuple[typing.Set[neuralmonkey.model.model_part.ModelPart], typing.Union[typing.Dict, typing.List], typing.Dict[tensorflow.python.framework.ops.Tensor, typing.Union[int, float, numpy.ndarray]]]

Get the feedables and tensors to run.

class neuralmonkey.runners.label_runner.LabelRunner(output_series: str, decoder: typing.Any, postprocess: typing.Callable[[typing.List[str]], typing.List[str]] = None) → None

Bases: neuralmonkey.runners.base_runner.BaseRunner

get_executable(compute_losses=False, summaries=True)
loss_names

neuralmonkey.runners.logits_runner module

A runner outputing logits or normalized distriution from a decoder.

class neuralmonkey.runners.logits_runner.LogitsExecutable(all_coders: typing.Set[neuralmonkey.model.model_part.ModelPart], fetches: typing.Dict[tensorflow.python.framework.ops.Tensor, typing.Union[int, float, numpy.ndarray]], vocabulary: neuralmonkey.vocabulary.Vocabulary, normalize: bool = True, pick_index: int = None) → None

Bases: neuralmonkey.runners.base_runner.Executable

collect_results(results: typing.List[typing.Dict]) → None
next_to_execute() → typing.Tuple[typing.Set[neuralmonkey.model.model_part.ModelPart], typing.Union[typing.Dict, typing.List], typing.Dict[tensorflow.python.framework.ops.Tensor, typing.Union[int, float, numpy.ndarray]]]

Get the feedables and tensors to run.

class neuralmonkey.runners.logits_runner.LogitsRunner(output_series: str, decoder: typing.Any, normalize: bool = True, pick_index: int = None, pick_value: str = None) → None

Bases: neuralmonkey.runners.base_runner.BaseRunner

A runner which takes the output from decoder.decoded_logits.

The logits / normalized probabilities are outputted as tab-separates string values. If the decoder produces a list of logits (as the recurrent decoder), the tab separated arrays are separated with commas. Alternatively, we may be interested in a single distribution dimension.

get_executable(compute_losses: bool = False, summaries: bool = True) → neuralmonkey.runners.logits_runner.LogitsExecutable
loss_names

neuralmonkey.runners.perplexity_runner module

class neuralmonkey.runners.perplexity_runner.PerplexityExecutable(all_coders: typing.Set[neuralmonkey.model.model_part.ModelPart], xent_op: tensorflow.python.framework.ops.Tensor) → None

Bases: neuralmonkey.runners.base_runner.Executable

collect_results(results: typing.List[typing.Dict]) → None
next_to_execute() → typing.Tuple[typing.Set[neuralmonkey.model.model_part.ModelPart], typing.Union[typing.Dict, typing.List], typing.Dict[tensorflow.python.framework.ops.Tensor, typing.Union[int, float, numpy.ndarray]]]

Get the feedables and tensors to run.

class neuralmonkey.runners.perplexity_runner.PerplexityRunner(output_series: str, decoder: neuralmonkey.decoders.decoder.Decoder) → None

Bases: neuralmonkey.runners.base_runner.BaseRunner

get_executable(compute_losses=False, summaries=True) → neuralmonkey.runners.perplexity_runner.PerplexityExecutable
loss_names

neuralmonkey.runners.plain_runner module

class neuralmonkey.runners.plain_runner.PlainExecutable(all_coders, fetches, vocabulary, postprocess) → None

Bases: neuralmonkey.runners.base_runner.Executable

collect_results(results: typing.List[typing.Dict]) → None
next_to_execute() → typing.Tuple[typing.Set[neuralmonkey.model.model_part.ModelPart], typing.Union[typing.Dict, typing.List], typing.Dict[tensorflow.python.framework.ops.Tensor, typing.Union[int, float, numpy.ndarray]]]

Get the feedables and tensors to run.

class neuralmonkey.runners.plain_runner.PlainRunner(output_series: str, decoder: typing.Any, postprocess: typing.Callable[[typing.List[str]], typing.List[str]] = None) → None

Bases: neuralmonkey.runners.base_runner.BaseRunner

A runner which takes the output from decoder.decoded.

get_executable(compute_losses=False, summaries=True)
loss_names

neuralmonkey.runners.regression_runner module

class neuralmonkey.runners.regression_runner.RegressionRunExecutable(all_coders: typing.Set[neuralmonkey.model.model_part.ModelPart], fetches: typing.Dict[str, tensorflow.python.framework.ops.Tensor], postprocess: typing.Callable[[float], float] = None) → None

Bases: neuralmonkey.runners.base_runner.Executable

collect_results(results: typing.List[typing.Dict]) → None
next_to_execute() → typing.Tuple[typing.Set[neuralmonkey.model.model_part.ModelPart], typing.Union[typing.Dict, typing.List], typing.Dict[tensorflow.python.framework.ops.Tensor, typing.Union[int, float, numpy.ndarray]]]

Get the feedables and tensors to run.

class neuralmonkey.runners.regression_runner.RegressionRunner(output_series: str, decoder: neuralmonkey.decoders.sequence_regressor.SequenceRegressor, postprocess: typing.Callable[[float], float] = None) → None

Bases: neuralmonkey.runners.base_runner.BaseRunner

get_executable(compute_losses: bool = False, summaries: bool = True) → neuralmonkey.runners.base_runner.Executable
loss_names

neuralmonkey.runners.representation_runner module

A runner that prints out the input representation from an encoder.

class neuralmonkey.runners.representation_runner.RepresentationExecutable(prev_coders: typing.Set[neuralmonkey.model.model_part.ModelPart], encoded: tensorflow.python.framework.ops.Tensor, used_session: int) → None

Bases: neuralmonkey.runners.base_runner.Executable

collect_results(results: typing.List[typing.Dict]) → None
next_to_execute() → typing.Tuple[typing.Set[neuralmonkey.model.model_part.ModelPart], typing.Union[typing.Dict, typing.List], typing.Dict[tensorflow.python.framework.ops.Tensor, typing.Union[int, float, numpy.ndarray]]]
class neuralmonkey.runners.representation_runner.RepresentationRunner(output_series: str, encoder: neuralmonkey.model.stateful.Stateful, used_session: int = 0) → None

Bases: neuralmonkey.runners.base_runner.BaseRunner

Runner printing out representation from a encoder.

Using this runner is the way how to get input / other data representation out from Neural Monkey.

get_executable(compute_losses: bool = False, summaries: bool = True) → neuralmonkey.runners.representation_runner.RepresentationExecutable
loss_names

neuralmonkey.runners.runner module

class neuralmonkey.runners.runner.GreedyRunExecutable(all_coders, fetches, vocabulary, postprocess) → None

Bases: neuralmonkey.runners.base_runner.Executable

collect_results(results: typing.List[typing.Dict]) → None
next_to_execute() → typing.Tuple[typing.Set[neuralmonkey.model.model_part.ModelPart], typing.Union[typing.Dict, typing.List], typing.Dict[tensorflow.python.framework.ops.Tensor, typing.Union[int, float, numpy.ndarray]]]

Get the feedables and tensors to run.

class neuralmonkey.runners.runner.GreedyRunner(output_series: str, decoder: typing.Any, postprocess: typing.Callable[[typing.List[str]], typing.List[str]] = None) → None

Bases: neuralmonkey.runners.base_runner.BaseRunner

get_executable(compute_losses=False, summaries=True)
loss_names

neuralmonkey.runners.word_alignment_runner module

class neuralmonkey.runners.word_alignment_runner.WordAlignmentRunner(output_series: str, encoder: neuralmonkey.model.model_part.ModelPart, decoder: neuralmonkey.decoders.decoder.Decoder) → None

Bases: neuralmonkey.runners.base_runner.BaseRunner

get_executable(compute_losses=False, summaries=True)
loss_names
class neuralmonkey.runners.word_alignment_runner.WordAlignmentRunnerExecutable(all_coders, fetches)

Bases: neuralmonkey.runners.base_runner.Executable

collect_results(results: typing.List[typing.Dict]) → None
next_to_execute() → typing.Tuple[typing.Set[neuralmonkey.model.model_part.ModelPart], typing.Union[typing.Dict, typing.List], typing.Dict[tensorflow.python.framework.ops.Tensor, typing.Union[int, float, numpy.ndarray]]]

Get the feedables and tensors to run.

Module contents