Closed kenko911 closed 3 months ago
The recent update to the training.py
file in the matgl
project includes importing the LRScheduler
from torch.optim
and modifying the type annotation for the scheduler
parameter in the MatglLightningModuleMixin
class. The scheduler
parameter now accepts an LRScheduler
or None
, enhancing type safety and clarity regarding the expected types for this parameter.
Files | Change Summary |
---|---|
src/matgl/utils/training.py | Updated imports to include LRScheduler ; modified type annotation of scheduler in MatglLightningModuleMixin class to LRScheduler \| None . |
Not applicable as the changes are primarily updates to imports and type annotations without affecting the control flow or introducing new features.
src/matgl/utils/training.py (3)
`19-19`: **Import statement change approved.** The import of `LRScheduler` is necessary for the type annotation update. --- `150-150`: **Type annotation change approved.** The type annotation for the `scheduler` parameter has been updated to `LRScheduler | None`, which ensures type safety and clarity. --- `273-273`: **Type annotation change approved.** The type annotation for the `scheduler` parameter has been updated to `LRScheduler | None`, which ensures type safety and clarity.
Summary
Type checking for scheduler is added
Checklist
ruff
.mypy
.duecredit
@due.dcite
decorators to reference relevant papers by DOI (example)Tip: Install
pre-commit
hooks to auto-check types and linting before every commit: