Skip to content

Commit 3de4112

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

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/lightning/pytorch/callbacks/pruning.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ def _deepcopy_for_pruning(module: nn.Module) -> nn.Module:
288288
This helper temporarily replaces every non-leaf parameter with a
289289
detached clone, performs the deep-copy, then restores the originals so
290290
the live model is unchanged.
291+
291292
"""
292293
non_leaf: dict[str, Tensor] = {}
293294
for param_name, param in list(module._parameters.items()):

tests/tests_pytorch/callbacks/test_pruning.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -554,10 +554,11 @@ def forward(self, x):
554554

555555

556556
def test_iterative_pruning_no_runtime_error(tmp_path):
557-
"""Reusing a ModelPruning callback with use_lottery_ticket_hypothesis across multiple trainer.fit()
558-
calls must not raise RuntimeError due to non-leaf tensors.
557+
"""Reusing a ModelPruning callback with use_lottery_ticket_hypothesis across multiple trainer.fit() calls must not
558+
raise RuntimeError due to non-leaf tensors.
559559
560560
Regression test for https://github.com/Lightning-AI/pytorch-lightning/issues/8542
561+
561562
"""
562563
seed_everything(42)
563564

0 commit comments

Comments
 (0)