Skip to content

Fix mypy issues#661

Merged
yutong-xiang-97 merged 1 commit intomainfrom
yutong-fix-mypy-lrscheduler-types
Mar 23, 2026
Merged

Fix mypy issues#661
yutong-xiang-97 merged 1 commit intomainfrom
yutong-fix-mypy-lrscheduler-types

Conversation

@yutong-xiang-97
Copy link
Copy Markdown
Contributor

@yutong-xiang-97 yutong-xiang-97 commented Mar 23, 2026

What has changed and why?

Fix new mypy issues with the newer mypy version by adding type: ignore

How has it been tested?

running make static-checks

Did you update CHANGELOG.md?

  • Yes
  • Not needed (internal change)

Did you update the documentation?

  • Yes
  • Not needed (internal change without effects for user)

Copilot AI review requested due to automatic review settings March 23, 2026 12:39
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (and lrs list annotation) to allow float | Tensor.
  • Adjust get_current_learning_rate() to safely handle schedulers that may return tensor learning rates by converting scalar tensors to float.

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.

@yutong-xiang-97 yutong-xiang-97 force-pushed the yutong-fix-mypy-lrscheduler-types branch 2 times, most recently from 36f296c to befad2a Compare March 23, 2026 13:06
@yutong-xiang-97 yutong-xiang-97 force-pushed the yutong-fix-mypy-lrscheduler-types branch from befad2a to 5bdd1a1 Compare March 23, 2026 13:27
@yutong-xiang-97 yutong-xiang-97 enabled auto-merge (squash) March 23, 2026 13:35
@yutong-xiang-97
Copy link
Copy Markdown
Contributor Author

/review

@yutong-xiang-97 yutong-xiang-97 merged commit f0fa23c into main Mar 23, 2026
16 checks passed
@yutong-xiang-97 yutong-xiang-97 deleted the yutong-fix-mypy-lrscheduler-types branch March 23, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants