Skip to content

Commit fe47a9c

Browse files
committed
formatting
1 parent 2401027 commit fe47a9c

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

pytorch_lightning/callbacks/gradient_accumulation_scheduler.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ class GradientAccumulationScheduler(Callback):
99
1010
Args:
1111
scheduling (dict): scheduling in format {epoch: accumulation_factor}
12-
.. warning:: Epochs indexing starts from "1" until v0.6.x, but will start from "0" in v0.8.0.
12+
.. warning:: Epochs indexing starts from "1" until v0.6.x, but will start from "0" in
13+
v0.8.0.
1314
1415
Example::
1516

pytorch_lightning/callbacks/model_checkpoint.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ def __init__(self, filepath, monitor='val_loss', verbose=0,
6262
mode='auto', period=1, prefix=''):
6363
super(ModelCheckpoint, self).__init__()
6464
if (
65-
save_top_k
66-
and os.path.isdir(filepath)
67-
and len(os.listdir(filepath)) > 0
65+
save_top_k and
66+
os.path.isdir(filepath) and
67+
len(os.listdir(filepath)) > 0
6868
):
6969
warnings.warn(
7070
f"Checkpoint directory {filepath} exists and is not empty with save_top_k != 0."
@@ -175,9 +175,11 @@ def on_validation_end(self):
175175
if len(self.best_k_models.keys()) == self.save_top_k:
176176
# monitor dict has reached k elements
177177
if self.mode == 'min':
178-
self.kth_best_model = max(self.best_k_models, key=self.best_k_models.get)
178+
self.kth_best_model = max(
179+
self.best_k_models, key=self.best_k_models.get)
179180
else:
180-
self.kth_best_model = min(self.best_k_models, key=self.best_k_models.get)
181+
self.kth_best_model = min(
182+
self.best_k_models, key=self.best_k_models.get)
181183
self.kth_value = self.best_k_models[self.kth_best_model]
182184

183185
if self.mode == 'min':

0 commit comments

Comments
 (0)