Skip to content

feat: support tuple values in cyclical schedulers#3812

Open
nightcityblade wants to merge 1 commit into
pytorch:masterfrom
nightcityblade:fix/issue-438
Open

feat: support tuple values in cyclical schedulers#3812
nightcityblade wants to merge 1 commit into
pytorch:masterfrom
nightcityblade:fix/issue-438

Conversation

@nightcityblade

Copy link
Copy Markdown
Contributor

Fixes #438

Description:

Allow cyclical schedulers to interpolate tuple-valued optimizer parameters while preserving the tuple type written back to optimizer parameter groups. This enables schedules such as Adam's betas, including changing beta1 while keeping beta2 fixed. The regression test exercises five scheduled values and runs an Adam optimizer step after each update.

Tests:

  • python -m pytest -q tests/ignite/handlers/test_param_scheduler.py (58 passed, 4 xfailed, 2 xpassed)
  • python -m ruff check ignite/handlers/param_scheduler.py tests/ignite/handlers/test_param_scheduler.py

Check list:

  • New tests are added (if a new feature is added)
  • New doc strings: description and/or example code are in RST format
  • Documentation is updated (if required)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 extends Ignite’s cyclical parameter schedulers to support tuple-valued optimizer parameters (e.g., Adam’s betas) by interpolating tuple elements while ensuring the optimizer receives a tuple (not a tensor/list) after each scheduler update.

Changes:

  • Added tuple support to CyclicalScheduler by validating tuple inputs, interpolating via tensor math internally, and converting scheduled values back to Python tuples on write-back.
  • Added a regression test covering tuple scheduling on Adam betas, including running an optimizer step after each update.
  • Added new validation tests for tuple start/end value consistency (both tuples, same length).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
ignite/handlers/param_scheduler.py Enables tuple-valued interpolation in cyclical schedulers and preserves tuple type when setting optimizer param groups.
tests/ignite/handlers/test_param_scheduler.py Adds regression + validation tests to confirm tuple scheduling works and invalid tuple configurations raise expected errors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: handlers Core Handlers module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow tuple in param_scheduler

2 participants