Skip to content

Checkpointing fixes - #9

Merged
SahilJain314 merged 1 commit into
mainfrom
ashors/ckpt-fixes
Mar 21, 2025
Merged

SahilJain314 merged 1 commit into
mainfrom
ashors/ckpt-fixes

Conversation

@ashors1

@ashors1 ashors1 commented Mar 21, 2025

Copy link
Copy Markdown
Contributor

What does this PR do ?

  • converts relative paths to absolute paths before checkpoint saving/loading. This works around the problem of ray workers having different relative dirs
  • adds LR scheduler state to the checkpoint

Changelog

  • Please update the CHANGELOG.md under next version with high level changes in this PR.

Usage

  • You can potentially add a usage example below
# Add a code snippet demonstrating how to use this 

Before your PR is "Ready for review"

Pre checks:

Checklist when contributing

  • TBD

Additional Information

  • Related to # (issue)

@SahilJain314
SahilJain314 merged commit c98ab97 into main Mar 21, 2025
@SahilJain314
SahilJain314 deleted the ashors/ckpt-fixes branch March 21, 2025 03:31
KiddoZhu pushed a commit that referenced this pull request May 6, 2025
copy-pr-bot Bot pushed a commit that referenced this pull request May 19, 2026
Update gemma4 recipe to use fusedAdam and update Automodel
avenkateshha added a commit to avenkateshha/RL that referenced this pull request May 20, 2026
Comments addressed: #3, #5, NVIDIA-NeMo#7, NVIDIA-NeMo#8, NVIDIA-NeMo#9, NVIDIA-NeMo#10, NVIDIA-NeMo#11.

- Rename _load_M -> _get_sparse_projection_matrix and
  _load_dense_projection -> _get_topk_projection (later removed in
  favor of module-level cache helpers below).
- Drop unused alignment_student_spans / alignment_teacher_spans
  from the cross-tokenizer batch payload.
- Remove NRL_XTOKEN_LOSS_DUMP_DIR debug-dump side effect.
- Move Fp32SparseMM, chunk_average_log_probs, valid_chunk_mask to a
  new shared module nemo_rl/algorithms/x_token/utils.py.
- Extract projection-file parsing into utils.parse_projection_file;
  tokenalign.py and loss_functions.py both go through it.
- Move per-instance projection-matrix caches to process-local caches
  in utils.get_sparse_projection_matrix / get_topk_projection. The
  driver no longer holds large CUDA tensors; each Ray worker fills
  its own cache on first loss call.

Signed-off-by: Adithya Hanasoge <[email protected]>
avenkateshha added a commit to avenkateshha/RL that referenced this pull request May 27, 2026
Comments addressed: #3, #5, NVIDIA-NeMo#7, NVIDIA-NeMo#8, NVIDIA-NeMo#9, NVIDIA-NeMo#10, NVIDIA-NeMo#11.

- Rename _load_M -> _get_sparse_projection_matrix and
  _load_dense_projection -> _get_topk_projection (later removed in
  favor of module-level cache helpers below).
- Drop unused alignment_student_spans / alignment_teacher_spans
  from the cross-tokenizer batch payload.
- Remove NRL_XTOKEN_LOSS_DUMP_DIR debug-dump side effect.
- Move Fp32SparseMM, chunk_average_log_probs, valid_chunk_mask to a
  new shared module nemo_rl/algorithms/x_token/utils.py.
- Extract projection-file parsing into utils.parse_projection_file;
  tokenalign.py and loss_functions.py both go through it.
- Move per-instance projection-matrix caches to process-local caches
  in utils.get_sparse_projection_matrix / get_topk_projection. The
  driver no longer holds large CUDA tensors; each Ray worker fills
  its own cache on first loss call.

Signed-off-by: Adithya Hanasoge <[email protected]>
copy-pr-bot Bot pushed a commit that referenced this pull request Jun 7, 2026
Comments addressed: #3, #5, #7, #8, #9, #10, #11.

- Rename _load_M -> _get_sparse_projection_matrix and
  _load_dense_projection -> _get_topk_projection (later removed in
  favor of module-level cache helpers below).
- Drop unused alignment_student_spans / alignment_teacher_spans
  from the cross-tokenizer batch payload.
- Remove NRL_XTOKEN_LOSS_DUMP_DIR debug-dump side effect.
- Move Fp32SparseMM, chunk_average_log_probs, valid_chunk_mask to a
  new shared module nemo_rl/algorithms/x_token/utils.py.
- Extract projection-file parsing into utils.parse_projection_file;
  tokenalign.py and loss_functions.py both go through it.
- Move per-instance projection-matrix caches to process-local caches
  in utils.get_sparse_projection_matrix / get_topk_projection. The
  driver no longer holds large CUDA tensors; each Ray worker fills
  its own cache on first loss call.

Signed-off-by: Adithya Hanasoge <[email protected]>
copy-pr-bot Bot pushed a commit that referenced this pull request Jun 7, 2026
Comments addressed: #3, #5, #7, #8, #9, #10, #11.

- Rename _load_M -> _get_sparse_projection_matrix and
  _load_dense_projection -> _get_topk_projection (later removed in
  favor of module-level cache helpers below).
- Drop unused alignment_student_spans / alignment_teacher_spans
  from the cross-tokenizer batch payload.
- Remove NRL_XTOKEN_LOSS_DUMP_DIR debug-dump side effect.
- Move Fp32SparseMM, chunk_average_log_probs, valid_chunk_mask to a
  new shared module nemo_rl/algorithms/x_token/utils.py.
- Extract projection-file parsing into utils.parse_projection_file;
  tokenalign.py and loss_functions.py both go through it.
- Move per-instance projection-matrix caches to process-local caches
  in utils.get_sparse_projection_matrix / get_topk_projection. The
  driver no longer holds large CUDA tensors; each Ray worker fills
  its own cache on first loss call.

Signed-off-by: Adithya Hanasoge <[email protected]>
NolenLiang added a commit that referenced this pull request Jun 14, 2026
- Remove default values from DPOSaveState fields (yuki-97 comment #7)
- Replace __annotations__.keys() with dataclasses.fields() (comment #9)
- Handle extra keys from checkpoint dicts when loading (comment #10)
- Merge _default_dpo_save_state() into load site, always return
  non-None DPOSaveState (comment #11)
- Remove redundant hasattr check in vars() loop (comment #13)
- Update tests to construct DPOSaveState explicitly

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Signed-off-by: nliang <[email protected]>
yuekaizhang added a commit to yuekaizhang/RL that referenced this pull request Sep 14, 2026
…config

Preemptively align policy.draft's config contract with seonjinn's
NVIDIA-NeMo#3701 (typed speculator configuration + registry, likely to
land first) so this PR can merge ahead of or alongside it with a small
rebase instead of a full schema rewrite:

- New nemo_rl/models/policy/draft_config.py: Eagle3DraftConfig/
  DSparkDraftConfig/DFlashDraftConfig pydantic BaseModels discriminated by
  speculator_type (replacing policy.draft.algo + nested dspark:/eagle3:
  sub-blocks with flat fields per family), plus coerce_draft_config()/
  draft_refit_enabled() following NVIDIA-NeMo#3701's normalize-once contract.
- lm_policy.py's Policy.__init__ now coerces config["draft"] into the
  validated model in place (mirroring NVIDIA-NeMo#3701's Policy.__init__), so every
  downstream reader gets a typed object instead of a raw dict. The
  DRAFT_ALGOS membership check this replaces was the seonjinn item NVIDIA-NeMo#9
  KeyError/ValueError fix from the previous commit -- pydantic's
  discriminated union now does that validation.
- All automodel/megatron call sites (automodel/setup.py,
  dtensor_policy_worker_v2.py, draft/integration.py, megatron/setup.py,
  megatron/train.py, megatron/draft/utils.py, megatron_policy_worker.py,
  teacher_worker_group.py, generation/__init__.py) updated from dict
  access (draft_cfg["enabled"], draft_cfg.get("algo")) to attribute access
  on the coerced model. teacher_worker_group.py handles both forms since
  its copied policy_config may or may not have gone through Policy.__init__
  yet.
- Renamed policy.draft.algo -> policy.draft.speculator_type and flattened
  policy.draft.dspark/eagle3 sub-blocks across the exemplar YAMLs
  (grpo_math_1B.yaml, ppo_math_1B_megatron_single_controller.yaml and
  their v1 reference-config twin) and every recipe/example YAML that sets
  a draft: block, including several upstream-main files (examples/nemo_gym/*,
  research/template_project/*) that predate policy.draft.algo entirely and
  needed speculator_type added for the discriminator to resolve.

Verified: 725 config-validation tests, config_v2 migration guard, the
draft guard/ratio-metric/collective unit suites, and a direct
Policy.__init__ smoke test across all three speculator_type values all
pass.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Signed-off-by: Yuekai Zhang <[email protected]>
zswerth added a commit to zswerth/RL that referenced this pull request Oct 31, 2026
- Restore the cuda-graph-trace=node default in the outer/policy nsight config
  (the key-set unit test passes unchanged); NRL_NSYS_EXTRA_OPTIONS now treats a
  JSON null as "remove this default" (review NVIDIA-NeMo#1, NVIDIA-NeMo#2).
- Remove the per-worker `nsys sessions list` / `nsys stop --session` sweep from
  VllmInternalWorkerExtension.stop_gpu_profiling and the 30 s post-stop sleep:
  the awaited cudaProfilerStop with capture-range-end=stop finalizes each inner
  report while the worker runs (review NVIDIA-NeMo#3, NVIDIA-NeMo#7, NVIDIA-NeMo#10).
- Build both inner TP-worker configs with one build_inner_nsight_config() in
  nemo_rl/utils/nsys.py (v1 keeps capture-range-end=repeat; the v2 plugin uses
  stop + wait=primary, documented), using the NRL_NSYS_PROFILE_STEP_RANGE
  constant and the validated NRL_NSYS_EXTRA_OPTIONS parser; the plugin imports
  the helper lazily and logs one line on install (review NVIDIA-NeMo#4, NVIDIA-NeMo#5).
- Import RayExecutorV2 directly in the plugin; drop the ImportError fallback so a
  moved executor fails loudly when profiling is requested (review NVIDIA-NeMo#11).
- Align the async start/stop_gpu_profiling with upstream NVIDIA-NeMo#4604 (already on main):
  await collective_rpc only, no outer cudaProfilerStart/Stop, so the outer async
  actor writes no near-empty report; adopt main's unit test verbatim (review NVIDIA-NeMo#8, NVIDIA-NeMo#9).
- Unit tests: plugin (entry point resolves, no-op, install once with one log line,
  call-through, overrides/null removal, fails loudly without RayExecutorV2, bad
  NRL_NSYS_EXTRA_OPTIONS raises at executor startup, vllm-marked contract test
  against the real RayExecutorV2), helper defaults/options, v1 call site, outer
  async profiler untouched; whitelist the plugin in pyrefly.toml (review NVIDIA-NeMo#6).
- Add an end-to-end nightly suite, grpo-llama3.2-1b-instruct-1n8g-megatron-nsys
  (Megatron recipe, vLLM TP=2, async engine): sets NRL_NSYS_*, passes a caller's
  NRL_NSYS_EXTRA_OPTIONS through, and asserts per-class report counts derived from
  the config (policy and inner vllm_tp_worker = engines x TP), no stock-config or
  unfinished captures, and CUDA activity in an inner report. The nightly GPU-hour
  cap is raised by this suite's budget (review NVIDIA-NeMo#12).
- Docs: null removal, the v2 plugin and when it is (not) loaded, failure modes.

Signed-off-by: zswerth <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants