Skip to content

Commit c85b8fd

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 82edacb commit c85b8fd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/tests_pytorch/loops/test_training_epoch_loop.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
from unittest.mock import Mock, patch
1616

1717
import pytest
18+
from lightning.pytorch.callbacks import EarlyStopping
1819
from lightning.pytorch.demos.boring_classes import BoringModel
1920
from lightning.pytorch.trainer.trainer import Trainer
20-
from lightning.pytorch.callbacks import EarlyStopping
21+
2122

2223
def test_no_val_on_train_epoch_loop_restart(tmpdir):
2324
"""Test that training validation loop doesn't get triggered at the beginning of a restart."""
@@ -86,17 +87,16 @@ def test_should_stop_triggers_validation_once(min_epochs, min_steps, val_count,
8687
(min_epochs/steps is satisfied).
8788
8889
"""
90+
8991
class NewBoring(BoringModel):
9092
def training_step(self, batch, batch_idx):
91-
self.log('loss', self.step(batch))
93+
self.log("loss", self.step(batch))
9294
return {"loss": self.step(batch)}
9395

9496
model = NewBoring()
9597
# create a stopping condition with a high threshold so it triggers immediately
9698
# check the condition before validation so the count is unaffected
97-
stopping = EarlyStopping(monitor='loss',
98-
check_on_train_epoch_end=True,
99-
stopping_threshold=100)
99+
stopping = EarlyStopping(monitor="loss", check_on_train_epoch_end=True, stopping_threshold=100)
100100
trainer = Trainer(
101101
default_root_dir=tmp_path,
102102
num_sanity_val_steps=0,
@@ -107,7 +107,7 @@ def training_step(self, batch, batch_idx):
107107
min_steps=min_steps,
108108
enable_model_summary=False,
109109
enable_checkpointing=False,
110-
callbacks=[stopping]
110+
callbacks=[stopping],
111111
)
112112
trainer.fit_loop.epoch_loop.val_loop.run = Mock()
113113
trainer.fit(model)

0 commit comments

Comments
 (0)