-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
bugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already exists
Milestone
Description
🐛 Bug
The Lightning trainer holds references to the LightningModule/DataModule after fit/test complete. This can leads to different behavior in calls likeL
Please reproduce using the BoringModel and post here
def test_x(tmpdir):
# validation checks do not regularly since we don'tre-instantiate the trainer inside each loop
for i in range(2):
trainer = pl.Trainer(max_epochs=4, check_val_every_n_epoch=2, logger=False, checkpoint_callback=False)
test_module = BoringModel()
trainer.fit(test_module)
reuse_trainer = pl.Trainer(max_epochs=4, check_val_every_n_epoch=2, logger=False, checkpoint_callback=False)
def test_reuse(tmpdir):
# validation checks do not run on the second loop since we don't re-instantiate the trainer inside each loop
for i in range(2):
test_module = BoringModel()
reuse_trainer.fit(test_module)
To Reproduce
Expected behavior
The latter test_reuse should re-bind the model + hooks when calling fit again inside each loop
dkajtoch and jabertuhin
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingduplicateThis issue or pull request already existsThis issue or pull request already exists