Fix mypy issues#661
Merged
yutong-xiang-97 merged 1 commit intomainfrom Mar 23, 2026
Merged
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates type annotations to resolve new mypy failures introduced by a newer mypy version, primarily around learning-rate scheduler return types and downstream learning-rate computations.
Changes:
- Update the custom
TwoStageWarmupPolySchedule.get_lr()return type (andlrslist annotation) to allowfloat | Tensor. - Adjust
get_current_learning_rate()to safely handle schedulers that may return tensor learning rates by converting scalar tensors tofloat.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/lightly_train/_task_models/dinov3_eomt_semantic_segmentation/scheduler.py |
Broaden scheduler get_lr() typing to `float |
src/lightly_train/_task_models/dinov3_eomt_panoptic_segmentation/scheduler.py |
Same typing adjustment for the panoptic variant scheduler. |
src/lightly_train/_task_models/dinov3_eomt_instance_segmentation/scheduler.py |
Same typing adjustment for the instance variant scheduler. |
src/lightly_train/_task_models/dinov2_eomt_semantic_segmentation/scheduler.py |
Same typing adjustment for the DINOv2 semantic scheduler. |
src/lightly_train/_task_models/dinov2_eomt_panoptic_segmentation/scheduler.py |
Same typing adjustment for the DINOv2 panoptic scheduler. |
src/lightly_train/_task_models/dinov2_eomt_instance_segmentation/scheduler.py |
Same typing adjustment for the DINOv2 instance scheduler. |
src/lightly_train/_commands/train_task_helpers.py |
Convert potential tensor LR values to float before computing/logging the current LR. |
36f296c to
befad2a
Compare
befad2a to
5bdd1a1
Compare
Contributor
Author
|
/review |
guarin
approved these changes
Mar 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What has changed and why?
Fix new
mypyissues with the newer mypy version by addingtype: ignoreHow has it been tested?
running
make static-checksDid you update CHANGELOG.md?
Did you update the documentation?