lingvo.trainer_impl module

Trainer.

To run locally:

$ bazel build -c opt //lingvo:trainer
$ bazel-bin/lingvo/trainer --logtostderr \
    --model=image.mnist.LeNet5 --mode=sync --logdir=/tmp/lenet5 \
    --run_locally=cpu

To use GPU, add --config=cuda to build command and set --run_locally=gpu.

class lingvo.trainer_impl.Trainer(*args, **kwargs)[source]

Bases: lingvo.base_runner.BaseRunner

Trainer on non-TPU.

_SummarizeValue(steps, tag, value, writer=None)[source]
Start()[source]
StartEnqueueOp(op)[source]
_LoopEnqueue(op)[source]

Runs the enqueue op in a loop.

_Loop()[source]
lingvo.trainer_impl.GetDecoderDir(logdir, decoder_type, model_task_name)[source]
lingvo.trainer_impl._GetCheckpointIdForDecodeOut(ckpt_id_from_file, global_step)[source]

Retrieve the checkpoint id for the decoder out file.

Compares the checkpoint id found in the checkpoint file name to global step. If they diverge, uses the retrieved id and prints a warning.

Parameters
  • ckpt_id_from_file – Checkpoint Id from the checkpoint file path.

  • global_step – int specifying the global step of the model.

Returns

Checkpoint id as int.

class lingvo.trainer_impl.Decoder(decoder_type, *args, **kwargs)[source]

Bases: lingvo.base_runner.BaseRunner

Decoder.

_CreateCheckpointer(train_dir, model)[source]

Wrapper method for override purposes.

Start()[source]
_Loop()[source]
classmethod GetDecodeOutPath(decoder_dir, checkpoint_id)[source]

Gets the path to decode out file.

GetCkptIdFromFile(checkpoint_path)[source]
_RemoveScalarSummaries(summaries)[source]
DecodeCheckpoint(sess, checkpoint_path)[source]

Decodes samples_per_summary examples using checkpoint_path.

DecodeLatestCheckpoint(last_path=None)[source]

Runs decoder on the latest checkpoint.