Skip to content

Commit 074818d

Browse files
committed
Update training_loop.py
1 parent 1ba38ea commit 074818d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pytorch_lightning/trainer/training_loop.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -884,9 +884,10 @@ def build_train_args(self, batch, batch_idx, opt_idx, hiddens):
884884

885885
def _truncated_bptt_enabled(self) -> bool:
886886
""" Temporary tbptt utilities until this flag is fully migrated to the lightning module. """
887-
lm = self.trainer.lightning_module
887+
module = self.trainer.lightning_module
888+
module_tbptt_enabled = module.truncated_bptt_steps is not None and module.truncated_bptt_steps > 0
889+
888890
trainer = self.trainer
889-
module_tbptt_enabled = lm.truncated_bptt_steps is not None and module.truncated_bptt_steps > 0
890891
trainer_tbptt_enabled = trainer.truncated_bptt_steps is not None and trainer.truncated_bptt_steps > 0
891892
return module_tbptt_enabled or trainer_tbptt_enabled
892893

0 commit comments

Comments
 (0)