Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ repos:
- id: detect-private-key

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
additional_dependencies: [tomli]
Expand All @@ -70,7 +70,7 @@ repos:
- id: sphinx-lint

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
rev: v0.11.4
hooks:
# try to fix what is possible
- id: ruff
Expand All @@ -81,7 +81,7 @@ repos:
- id: ruff

- repo: https://github.com/executablebooks/mdformat
rev: 0.7.21
rev: 0.7.22
hooks:
- id: mdformat
additional_dependencies:
Expand Down
4 changes: 2 additions & 2 deletions src/lightning/pytorch/callbacks/timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ def __init__(
self._duration = duration.total_seconds() if duration is not None else None
self._interval = interval
self._verbose = verbose
self._start_time: dict[RunningStage, Optional[float]] = {stage: None for stage in RunningStage}
self._end_time: dict[RunningStage, Optional[float]] = {stage: None for stage in RunningStage}
self._start_time: dict[RunningStage, Optional[float]] = dict.fromkeys(RunningStage)
self._end_time: dict[RunningStage, Optional[float]] = dict.fromkeys(RunningStage)
self._offset = 0

def start_time(self, stage: str = RunningStage.TRAINING) -> Optional[float]:
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_pytorch/helpers/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def __init__(self, root: str, num_samples: int = 100, digits: Optional[Sequence]

@staticmethod
def _prepare_subset(full_data: Tensor, full_targets: Tensor, num_samples: int, digits: Sequence):
classes = {d: 0 for d in digits}
classes = dict.fromkeys(digits, 0)
indexes = []
for idx, target in enumerate(full_targets):
label = target.item()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ def test_dataloader_source_request_from_module():


@pytest.mark.parametrize(
"hook_name", ("on_before_batch_transfer", "transfer_batch_to_device", "on_after_batch_transfer")
"hook_name", ["on_before_batch_transfer", "transfer_batch_to_device", "on_after_batch_transfer"]
)
class TestDataHookSelector:
def overridden_func(self, batch, *args, **kwargs):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def test_fx_validator_integration(tmp_path):
})
trainer.test(model, verbose=False)

not_supported.update({k: "result collection is not registered yet" for k in not_supported})
not_supported.update(dict.fromkeys(not_supported, "result collection is not registered yet"))
not_supported.update({
"predict_dataloader": "result collection is not registered yet",
"on_predict_model_eval": "result collection is not registered yet",
Expand Down
Loading