Skip to content

Commit bcf746f

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

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/lightning/pytorch/callbacks/weight_averaging.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -395,23 +395,19 @@ def should_update(self, step_idx: Optional[int] = None, epoch_idx: Optional[int]
395395
epoch_idx: The current epoch index.
396396
Returns:
397397
bool: True if the model weights should be updated, False otherwise.
398+
398399
"""
399400
if step_idx is not None:
400401
# Check step-based conditions only if we have a valid step_idx
401-
meets_step_requirement = (
402-
self.update_starting_at_step is None or step_idx >= self.update_starting_at_step
403-
)
404-
meets_step_frequency = (
405-
self.update_every_n_steps > 0 and step_idx % self.update_every_n_steps == 0
406-
)
402+
meets_step_requirement = self.update_starting_at_step is None or step_idx >= self.update_starting_at_step
403+
meets_step_frequency = self.update_every_n_steps > 0 and step_idx % self.update_every_n_steps == 0
407404
if meets_step_requirement and meets_step_frequency:
408405
return True
409406

410407
if epoch_idx is not None:
411408
# Check epoch-based condition only if we specify one
412409
meets_epoch_requirement = (
413-
self.update_starting_at_epoch is not None
414-
and epoch_idx >= self.update_starting_at_epoch
410+
self.update_starting_at_epoch is not None and epoch_idx >= self.update_starting_at_epoch
415411
)
416412
if meets_epoch_requirement:
417413
return True

0 commit comments

Comments
 (0)