neuralmonkey.trainers.generic_trainer module

class neuralmonkey.trainers.generic_trainer.GenericTrainer(objectives: List[neuralmonkey.trainers.generic_trainer.Objective], l1_weight: float = 0.0, l2_weight: float = 0.0, clip_norm: float = None, optimizer: tensorflow.python.training.optimizer.Optimizer = None, var_scopes: List[str] = None, var_collection: str = None) → None

Bases: object

__init__(objectives: List[neuralmonkey.trainers.generic_trainer.Objective], l1_weight: float = 0.0, l2_weight: float = 0.0, clip_norm: float = None, optimizer: tensorflow.python.training.optimizer.Optimizer = None, var_scopes: List[str] = None, var_collection: str = None) → None

Initialize self. See help(type(self)) for accurate signature.

get_executable(compute_losses=True, summaries=True, num_sessions=1) → neuralmonkey.runners.base_runner.Executable
class neuralmonkey.trainers.generic_trainer.Objective

Bases: neuralmonkey.trainers.generic_trainer.Objective

The training objective.

name

The name for the objective. Used in TensorBoard.

decoder

The decoder which generates the value to optimize.

loss

The loss tensor fetched by the trainer.

gradients

Manually specified gradients. Useful for reinforcement learning.

weight

The weight of this objective. The loss will be multiplied by this so the gradients can be controled in case of multiple objectives.

class neuralmonkey.trainers.generic_trainer.TrainExecutable(all_coders, num_sessions, train_op, losses, scalar_summaries, histogram_summaries)

Bases: neuralmonkey.runners.base_runner.Executable

__init__(all_coders, num_sessions, train_op, losses, scalar_summaries, histogram_summaries)

Initialize self. See help(type(self)) for accurate signature.

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