Skip to content

[feat][checkpoint] Allow selective state restore on resume - #2010

Open
bvolpato wants to merge 5 commits into
NovaSky-AI:mainfrom
bvolpato:bvolpato/model-only-checkpoint-resume
Open

[feat][checkpoint] Allow selective state restore on resume#2010
bvolpato wants to merge 5 commits into
NovaSky-AI:mainfrom
bvolpato:bvolpato/model-only-checkpoint-resume

Conversation

@bvolpato

@bvolpato bvolpato commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Allow checkpoint weights to seed a new training phase while independently controlling global-step, dataloader, optimizer, and learning-rate scheduler restoration.

Exact resume remains unchanged because every option defaults to true.

Changes

  • Add trainer.resume_load_global_step, trainer.resume_load_dataloader_state, trainer.resume_load_optimizer_states, and trainer.resume_load_lr_scheduler_states.
  • Reset training to step zero when global-step restoration is disabled.
  • Skip stale fully-async UID and epoch state for a new training phase.
  • Preserve logical epoch progress and epoch-end saves in sync and fully-async trainers when global-step restoration skips the dataloader cursor.
  • Pass optimizer and scheduler restore options to policy and critic checkpoint loading.
  • Document selective-state resume and separate checkpoint output paths.
  • Add focused sync and fully-async regression coverage.

Testing

  • pytest tests/train/test_trainer.py -q (21 passed)
  • focused selective-resume regressions (6 passed)
  • pytest tests/train/test_config.py -q (145 passed)
  • pytest tests/train/test_fully_async_trainer.py -q (12 passed)
  • pre-commit run --all-files
  • documentation type check and production build (66 pages)
  • git diff --check upstream/main

@bvolpato
bvolpato force-pushed the bvolpato/model-only-checkpoint-resume branch from 08cf263 to adffbdf Compare August 10, 2026 21:49
@bvolpato bvolpato changed the title [feat][checkpoint] Allow fresh optimizer state on resume [feat][checkpoint] Allow selective state restore on resume Aug 10, 2026
@bvolpato
bvolpato force-pushed the bvolpato/model-only-checkpoint-resume branch from adffbdf to a2b3558 Compare August 13, 2026 01:20
@bvolpato
bvolpato marked this pull request as ready for review August 13, 2026 01:23

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces four new configuration parameters (resume_load_global_step, resume_load_dataloader_state, resume_load_optimizer_states, and resume_load_lr_scheduler_states) to allow users to selectively disable restoring specific states when resuming from a checkpoint. The trainer logic and documentation have been updated accordingly, and new unit tests have been added. Feedback suggests explicitly checking if self.train_dataloader is initialized before attempting to restore its state to avoid potential AttributeError warnings when no dataloader exists.

Comment thread skyrl/train/trainer.py Outdated
Comment thread skyrl/train/trainer.py
@bvolpato
bvolpato force-pushed the bvolpato/model-only-checkpoint-resume branch from 9b0aeb4 to 93a835b Compare August 14, 2026 04:36
Comment thread skyrl/train/fully_async_trainer.py Outdated
@bvolpato
bvolpato force-pushed the bvolpato/model-only-checkpoint-resume branch from 8e40852 to b2cde16 Compare August 16, 2026 15:14

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit b2cde16. Configure here.

Comment thread skyrl/train/trainer.py
Track whether the dataloader cursor restored successfully.

When global step is kept without that cursor, run only the logical remainder of the first resumed epoch.
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.

1 participant