From b2707c9b2ebeac03f19a3939df9432ac8859d894 Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Thu, 9 Apr 2020 21:01:08 +0200 Subject: [PATCH] fix retruning returns (#1431) * returns * changelog --- CHANGELOG.md | 1 + pytorch_lightning/trainer/training_io.py | 2 +- pytorch_lightning/trainer/training_loop.py | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb554aaa..4cb088e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - Fixed default `DistributedSampler` for DDP training ([#1425](https://github.com/PyTorchLightning/pytorch-lightning/pull/1425)) - Fixed workers warning not on windows ([#1430](https://github.com/PyTorchLightning/pytorch-lightning/pull/1430)) +- Fixed returning tuple from `run_training_batch` ([#1431](https://github.com/PyTorchLightning/pytorch-lightning/pull/1431)) ## [0.7.2] - 2020-04-07 diff --git a/pytorch_lightning/trainer/training_io.py b/pytorch_lightning/trainer/training_io.py index fd2d0600..ffcc1d16 100644 --- a/pytorch_lightning/trainer/training_io.py +++ b/pytorch_lightning/trainer/training_io.py @@ -322,7 +322,7 @@ class TrainerIOMixin(ABC): checkpoint['hparams_type'] = 'namespace' if is_namespace else 'dict' else: rank_zero_warn( - "Did not find hyperparameters at model.hparams. Saving checkpoint without hyperparameters." + "Did not find hyperparameters at model hparams. Saving checkpoint without hyperparameters." ) # give the model a chance to add a few things diff --git a/pytorch_lightning/trainer/training_loop.py b/pytorch_lightning/trainer/training_loop.py index 7dad6223..06ac7849 100644 --- a/pytorch_lightning/trainer/training_loop.py +++ b/pytorch_lightning/trainer/training_loop.py @@ -532,7 +532,7 @@ class TrainerTrainLoopMixin(ABC): all_log_metrics = [] if batch is None: - return 0, grad_norm_dic, {} + return 0, grad_norm_dic, {}, {} # Batch start events with self.profiler.profile('on_batch_start'): @@ -542,7 +542,7 @@ class TrainerTrainLoopMixin(ABC): if self.is_function_implemented('on_batch_start'): response = self.get_model().on_batch_start(batch) if response == -1: - return -1, grad_norm_dic, {} + return -1, grad_norm_dic, {}, {} splits = [batch] if self.truncated_bptt_steps is not None: