docs: add warmup scheduler mixed-events example#3753
Open
nightcityblade wants to merge 1 commit into
Open
Conversation
TahaZahid05
reviewed
May 12, 2026
|
|
||
| epoch_length = 8 | ||
| combined_events = Events.ITERATION_STARTED( | ||
| event_filter=lambda engine, event: engine.state.iteration <= 5 |
Collaborator
There was a problem hiding this comment.
Suggested change
| event_filter=lambda engine, event: engine.state.iteration <= 5 | |
| event_filter=lambda engine, event: event <= 5 |
We already have the count inside event
Collaborator
|
@vfdev-5 This PR solves the documentation issue. However, I think I agree with #2441 pushback on maybe this needs an API fix. Currently, we are teaching the user to do the math on when to switch. It would be better if this logic can be internal to improve user experience. Something like: scheduler = create_lr_scheduler_with_warmup(
torch_lr_scheduler,
warmup_duration=5,
warmup_event=Events.ITERATION_STARTED,
post_warmup_event=Events.EPOCH_STARTED
)
# The scheduler would internally handle the event-switching logic.
trainer.add_event_handler(Events.ITERATION_STARTED | Events.EPOCH_STARTED, scheduler) |
Contributor
Author
|
Thanks for calling that out. I agree the more ergonomic long-term answer is probably an API improvement so users do not need to manually compute the switch point. I kept this PR narrowly scoped to the current docs issue because it only documents the behavior that exists today, but I’m happy for maintainers to treat the API direction separately if that’s preferred. |
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.
Fixes #2441
Description:
Adds a docstring example showing how to combine Ignite event filters so warm-up runs on iteration starts and the wrapped scheduler runs on later epoch starts.
Check list: