3578019be301ae9d8e9b7518daa5fb113d00d2db,open_seq2seq/utils/hooks.py,RunEvaluationHook,after_run,#RunEvaluationHook#Any#Any#,147

Before Change


      total_loss += loss

    total_loss /= (cnt + 1)
    deco_print("Validation loss: {:.4f}".format(total_loss), offset=4)
    dict_to_log = self._model.maybe_evaluate(
      inputs_per_batch,
      outputs_per_batch,
    )

After Change


      self._model, run_context.session, compute_loss=True,
    )

    if not self._model.on_horovod or self._model._hvd.rank() == 0:
      deco_print("Validation loss: {:.4f}".format(total_loss), offset=4)

      dict_to_log = self._model.maybe_evaluate(
        inputs_per_batch,
        outputs_per_batch,
      )
      dict_to_log["eval_loss"] = total_loss

      // saving the best validation model
      if total_loss < self._best_eval_loss:
        self._best_eval_loss = total_loss
        self._eval_saver.save(
          run_context.session,
          os.path.join(self._model.params["logdir"], "best_models",
                       "val_loss={:.4f}-step".format(total_loss)),
          global_step=step + 1,
        )

      // optionally logging to tensorboard any values
      // returned from maybe_print_logs
      if dict_to_log:
        log_summaries_from_dict(
          dict_to_log,
          self._model.params["logdir"],
          step,
        )
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 9

Instances


Project Name: NVIDIA/OpenSeq2Seq
Commit Name: 3578019be301ae9d8e9b7518daa5fb113d00d2db
Time: 2018-05-07
Author: igor.a.gitman@gmail.com
File Name: open_seq2seq/utils/hooks.py
Class Name: RunEvaluationHook
Method Name: after_run


Project Name: NVIDIA/OpenSeq2Seq
Commit Name: 3578019be301ae9d8e9b7518daa5fb113d00d2db
Time: 2018-05-07
Author: igor.a.gitman@gmail.com
File Name: open_seq2seq/utils/funcs.py
Class Name:
Method Name: evaluate


Project Name: NVIDIA/OpenSeq2Seq
Commit Name: f310d41373c2451a9556edcd8b47960d286035ee
Time: 2018-08-24
Author: okuchaiev@nvidia.com
File Name: open_seq2seq/utils/hooks.py
Class Name: PrintLossAndTimeHook
Method Name: after_run


Project Name: NVIDIA/OpenSeq2Seq
Commit Name: 3578019be301ae9d8e9b7518daa5fb113d00d2db
Time: 2018-05-07
Author: igor.a.gitman@gmail.com
File Name: open_seq2seq/utils/funcs.py
Class Name:
Method Name: infer