Skip to content

feat: super v3.5 posttraining joint mopd - #3830

Merged
yfw merged 51 commits into
super-v3.5-posttrainingfrom
adithyare/super_v3.5_posttraining_joint_mopd
Sep 9, 2026
Merged

yfw merged 51 commits into
super-v3.5-posttrainingfrom
adithyare/super_v3.5_posttraining_joint_mopd

Conversation

@arendu

@arendu arendu commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

What does this PR do ?

support for joint OPD

Issues

  1. OPD teachers inherit invalid model-architecture keys from the student config
  2. Partial teacher_overrides blocks are schema-filled and clobber default_teacher_cfg
  3. deduplicate_multimodal_data crashes on tool schemas with a parameter named "type"

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:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you run the unit tests and functional tests locally? Visit our Testing Guide for how to run tests
  • Did you add or update any necessary documentation? Visit our Document Development Guide for how to write, build and test the docs.

Additional Information

  • ...

arendu and others added 30 commits August 20, 2026 11:48
At GBS 512 the per-step metrics row exceeds W&B's ~10.38MB history-line
cap (hundreds of per-agent */histogram entries total >10MB) and the W&B
client silently drops the ENTIRE row, so no train/* curves appear
(observed on run zfhm8dc1 / job 6180005). Filter histogram and
full_result keys before log_metrics at the train and validation sites;
scalars (loss, KL, mtp_*, timings, per-agent stats) are untouched.
Same mitigation as nemo-rl-internal f5bafa107.

Co-Authored-By: Claude Fable 5 <[email protected]>
…om RL_omni_mopd_test_stacked

- launcher: reaper exemption comment, env-overridable SANDBOX_COMMAND, SLURM_EXTRA_DEPENDENCY hook
- v3-refmatch-mtp uses this branch's canonical MTP semantics (1 physical layer, non-repeated,
  bridge mtp export mapping fixed upstream -> no NRL_REFIT_SKIP_MTP workaround)
- container: branch-matched pipeline image (unvalidated for omni; fallback documented)

Co-Authored-By: Claude Fable 5 <[email protected]>
…mtp export fix incomplete on refit path — jobs 6296933/6371264 ALLGATHER hang)

Co-Authored-By: Claude Fable 5 <[email protected]>
…icit mtp values for text teacher

Co-Authored-By: Claude Fable 5 <[email protected]>
…e + warn); pin RADIO eval mode per vlm teacher; drop auto-drop

Co-Authored-By: Claude Fable 5 <[email protected]>
…ver can't import megatron-bridge)

Co-Authored-By: Claude Fable 5 <[email protected]>
…th schema-filled fields

Co-Authored-By: Claude Fable 5 <[email protected]>
…ill); launcher NO_SNAPSHOT=1 direct-run mode

Co-Authored-By: Claude Fable 5 <[email protected]>
…l schemas in text rows)

Co-Authored-By: Claude Fable 5 <[email protected]>

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

Adds joint OPD support by hardening teacher config resolution/overrides and making multimodal batching more robust, with accompanying unit tests and a launch-script quality-of-life update.

Changes:

  • Fix OPD teacher config merging so partial overrides don’t clobber defaults, and add a provider-override allowlist to prevent student architecture keys from leaking into teacher model providers.
  • Prevent multimodal sharing preparation from crashing when encountering tool/JSON-schema payloads with a dict-valued "type" field.
  • Add an env-flag to skip MTP params in refit conversion tasks, plus launch script options for faster iteration (NO_SNAPSHOT, overridable SANDBOX_COMMAND, extra Slurm dependency/comment).

Reviewed changes

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

Show a summary per file
File Description
tests/unit/models/policy/test_teacher_worker_group.py Adds regression tests for partial teacher overrides and explicit provider-override allowlisting.
tests/unit/distributed/test_batched_data_dict.py Adds regression test for dict-valued "type" key in tool/JSON schema rows.
nemo_rl/models/policy/workers/megatron_policy_worker.py Adds NRL_REFIT_SKIP_MTP to filter out MTP params from refit conversion tasks.
nemo_rl/models/policy/teacher_worker_group.py Builds _provider_override_allowlist for teacher configs and documents intended behavior.
nemo_rl/models/policy/init.py Introduces provider_override_allowed() helper for gating provider override application.
nemo_rl/models/megatron/setup.py Applies provider overrides only when allowed (VLM keys + MTP keys).
nemo_rl/models/megatron/community_import.py Applies provider overrides only when allowed during HF->Megatron import.
nemo_rl/distributed/batched_data_dict.py Avoids set-membership on unhashable dict "type" values.
nemo_rl/algorithms/opd.py Updates OPD schema handling for non-colocated teacher defaults/overrides.
examples/nemo_gym/nemotron-3-super-omni/super_omni_launch.sh Adds NO_SNAPSHOT mode, SANDBOX_COMMAND override, and improved Slurm dependency/comment handling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread nemo_rl/algorithms/opd.py Resolved
Comment thread nemo_rl/models/policy/__init__.py Resolved
…list docstring

Model default_teacher_cfg/teacher_overrides as TeacherResourceOverrides
(all-Optional partial of TeacherResourceConfig) instead of dict[str, Any];
the exclude_none dump in _opd_cfg strips unset fields so partial blocks
still cannot clobber defaults, while known fields regain schema typing.
Also fix the provider_override_allowlist docstring: the allowlist covers
keys set in default_teacher_cfg merged with the teacher's overrides, not
the per-teacher block alone. Adds a round-trip regression test.

Co-Authored-By: Claude Fable 5 <[email protected]>
@yfw yfw changed the title Adithyare/super v3.5 posttraining joint mopd feat: super v3.5 posttraining joint mopd Aug 26, 2026
With PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True, this torch build's
_cuda_emptyCache() stochastically raises 'RuntimeError: std::get: wrong
index for variant' from the caching allocator (observed post-checkpoint-save
in prepare_for_training and prepare_for_lp_inference, killing multi-hour
runs). empty_cache is hygiene, not correctness — and expandable segments
already return freed blocks to the segment pool — so when that allocator
mode is active, wrap torch.cuda.empty_cache at MegatronPolicyWorker init to
warn-and-continue on RuntimeError. No-op for runs without expandable
segments. Adds unit tests.

Co-Authored-By: Claude Fable 5 <[email protected]>

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

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

nemo_rl/models/policy/workers/megatron_policy_worker.py:2277

  • The MTP-skip filter uses a broad substring check ("mtp."), which is less specific than the existing MTP detection logic in this file (".mtp." or startswith("mtp.")). Using the same predicate here avoids accidentally skipping non-MTP parameters whose name happens to contain that substring.
        # NRL_REFIT_SKIP_MTP=1: drop MTP params from refit entirely. The
        # nemotron_omni bridge's megatron->HF mapping still misses MTP
        # layer-norm params on the refit-export path (jobs 6296933, 6371264:
        # "Unrecognized mapping type" -> TP ranks desync -> ALLGATHER hangs to
        # the 600s NCCL watchdog in prepare_refit_info). Generation engines
        # without speculative decoding never consume MTP weights, so skipping
        # them here (identically on every rank) is safe.
        skip_mtp = os.environ.get("NRL_REFIT_SKIP_MTP", "0") == "1"
        return [
            task
            for task in self.megatron_bridge.get_conversion_tasks([self.model])
            if task is not None
            and not (skip_mtp and "mtp." in task.global_param_name)
        ]

Comment thread nemo_rl/models/policy/utils.py Resolved
arendu and others added 6 commits September 1, 2026 13:22
applying suggest to warn only for the specific case.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Signed-off-by: Adi Renduchintala <[email protected]>
…a local untracked copy)

NO_SNAPSHOT mode, SANDBOX_COMMAND override, extra singleton dependency, and
--comment passthrough are submission-side conveniences, not framework changes;
they now live in an untracked super_omni_launch_local.sh used by local submit
scripts.

Co-Authored-By: Claude Fable 5 <[email protected]>
…stion

The GitHub-applied suggestion (298c2f1) dedented _best_effort_empty_cache
to module level, leaving the guard uninstalled (silent no-op) and the wrapper
referencing an out-of-scope original_empty_cache. Restore the nested
structure while keeping the suggestion's improvements (swallow only the
known 'wrong index for variant' allocator error, re-raise anything else,
stacklevel=2). Add a regression test that unrelated RuntimeErrors propagate.

Co-Authored-By: Claude Fable 5 <[email protected]>
…orruption)

Two production crashes (different nodes, identical signature) showed the
failing _cuda_emptyCache under expandable_segments does not merely raise
'std::get: wrong index for variant' — it leaves the caching allocator
corrupted, and the process dies of cudaErrorIllegalAddress in a later
kernel (observed in get_logprobs 1-2 steps after checkpoint saves, each
preceded by a burst of the guarded failures). Catch-and-continue hides
the exception but not the corruption, so the guard now makes
torch.cuda.empty_cache a warn-and-skip no-op whenever expandable
segments are active: the broken allocator path is never invoked, and ES
returns freed blocks to its segment pool anyway. Tests updated to assert
the real empty_cache is never called through under ES.

Co-Authored-By: Claude Fable 5 <[email protected]>
Patching the global torch.cuda.empty_cache is intrusive, so the
expandable-segments guard now activates only when
NRL_BEST_EFFORT_EMPTY_CACHE=1 is set (in addition to
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True). Default behavior is
unchanged torch semantics; deployments hitting the allocator bug opt in
explicitly. Adds a regression test for the default-off path.

Co-Authored-By: Claude Fable 5 <[email protected]>
@yfw
yfw merged commit ba6e973 into super-v3.5-posttraining Sep 9, 2026
9 of 10 checks passed
@yfw
yfw deleted the adithyare/super_v3.5_posttraining_joint_mopd branch September 9, 2026 06:24
arendu added a commit that referenced this pull request Oct 7, 2026
Port of super-v3.5-posttraining ba6e973 (#3830) onto main's multi-teacher
OPD infrastructure (teacher_model_by_agent_name / default_teacher_alias /
non_colocated_teachers already exist here; this adds what main lacks):

- TeacherResourceOverrides: default_teacher_cfg and teacher_overrides are
  now partial blocks (every field Optional), so a per-alias override that
  sets one key no longer resets the others to schema defaults.
- provider_override_allowed + megatron_cfg._provider_override_allowlist:
  a teacher's config is cloned from the student's, but only the keys the
  user wrote for that teacher may be applied onto its Megatron model
  provider. This is what lets a text NemotronH teacher be built under a
  Nemotron Omni student config (the student's vision-tower keys and
  mtp_num_layers=0 no longer leak onto the teacher). Consulted in
  setup.setup_model_config, setup._apply_mtp_config and
  community_import.import_model_from_hf_name; student configs carry no
  allowlist and behave as before.
- BatchedDataDict multimodal dedup visitor tolerates dict-valued "type"
  keys (tool / JSON-schema payloads) instead of crashing on an unhashable
  set-membership test.
- MegatronPolicyWorker: opt-in NRL_REFIT_SKIP_MTP=1 drops mtp.* params from
  refit (generation engines without speculative decoding never consume
  them) and opt-in NRL_BEST_EFFORT_EMPTY_CACHE=1 skips
  torch.cuda.empty_cache() under expandable_segments (allocator-corrupting
  torch bug observed after checkpoint saves).

Differences from the original: the refit filter is applied inside main's
draft_model_detached() block; the empty_cache guard is called at the top of
main's worker __init__ alongside is_refit_destination/refit_payload_mode.
Unit tests from the original are kept and appended to main's versions of
test_batched_data_dict.py and test_teacher_worker_group.py.

(cherry picked from commit ba6e973)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
(cherry picked from commit f551a4f)
arendu added a commit that referenced this pull request Oct 7, 2026
Port of super-v3.5-posttraining ba6e973 (#3830) onto main's multi-teacher
OPD infrastructure (teacher_model_by_agent_name / default_teacher_alias /
non_colocated_teachers already exist here; this adds what main lacks):

- TeacherResourceOverrides: default_teacher_cfg and teacher_overrides are
  now partial blocks (every field Optional), so a per-alias override that
  sets one key no longer resets the others to schema defaults.
- provider_override_allowed + megatron_cfg._provider_override_allowlist:
  a teacher's config is cloned from the student's, but only the keys the
  user wrote for that teacher may be applied onto its Megatron model
  provider. This is what lets a text NemotronH teacher be built under a
  Nemotron Omni student config (the student's vision-tower keys and
  mtp_num_layers=0 no longer leak onto the teacher). Consulted in
  setup.setup_model_config, setup._apply_mtp_config and
  community_import.import_model_from_hf_name; student configs carry no
  allowlist and behave as before.
- BatchedDataDict multimodal dedup visitor tolerates dict-valued "type"
  keys (tool / JSON-schema payloads) instead of crashing on an unhashable
  set-membership test.
- MegatronPolicyWorker: opt-in NRL_REFIT_SKIP_MTP=1 drops mtp.* params from
  refit (generation engines without speculative decoding never consume
  them) and opt-in NRL_BEST_EFFORT_EMPTY_CACHE=1 skips
  torch.cuda.empty_cache() under expandable_segments (allocator-corrupting
  torch bug observed after checkpoint saves).

Differences from the original: the refit filter is applied inside main's
draft_model_detached() block; the empty_cache guard is called at the top of
main's worker __init__ alongside is_refit_destination/refit_payload_mode.
Unit tests from the original are appended to main's versions of
test_batched_data_dict.py, test_teacher_worker_group.py and
tests/unit/models/policy/test_utils.py.

(cherry picked from commit ba6e973)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
(cherry picked from commit f551a4f)
arendu added a commit that referenced this pull request Oct 7, 2026
Port of super-v3.5-posttraining ba6e973 (#3830) onto main's multi-teacher
OPD infrastructure (teacher_model_by_agent_name / default_teacher_alias /
non_colocated_teachers already exist here; this adds what main lacks):

- TeacherResourceOverrides: default_teacher_cfg and teacher_overrides are
  now partial blocks (every field Optional), so a per-alias override that
  sets one key no longer resets the others to schema defaults.
- provider_override_allowed + megatron_cfg._provider_override_allowlist:
  a teacher's config is cloned from the student's, but only the keys the
  user wrote for that teacher may be applied onto its Megatron model
  provider. This is what lets a text NemotronH teacher be built under a
  Nemotron Omni student config (the student's vision-tower keys and
  mtp_num_layers=0 no longer leak onto the teacher). Consulted in
  setup.setup_model_config, setup._apply_mtp_config and
  community_import.import_model_from_hf_name; student configs carry no
  allowlist and behave as before.
- BatchedDataDict multimodal dedup visitor tolerates dict-valued "type"
  keys (tool / JSON-schema payloads) instead of crashing on an unhashable
  set-membership test.
- MegatronPolicyWorker: opt-in NRL_REFIT_SKIP_MTP=1 drops mtp.* params from
  refit (generation engines without speculative decoding never consume
  them) and opt-in NRL_BEST_EFFORT_EMPTY_CACHE=1 skips
  torch.cuda.empty_cache() under expandable_segments (allocator-corrupting
  torch bug observed after checkpoint saves).

Differences from the original: the refit filter is applied inside main's
draft_model_detached() block; the empty_cache guard is called at the top of
main's worker __init__ alongside is_refit_destination/refit_payload_mode.
Unit tests from the original are appended to main's versions of
test_batched_data_dict.py, test_teacher_worker_group.py and
tests/unit/models/policy/test_utils.py.

(cherry picked from commit ba6e973)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
(cherry picked from commit f551a4f)
Signed-off-by: adithyare <[email protected]>
arendu added a commit that referenced this pull request Oct 7, 2026
Port of super-v3.5-posttraining ba6e973 (#3830) onto main's multi-teacher
OPD infrastructure (teacher_model_by_agent_name / default_teacher_alias /
non_colocated_teachers already exist here; this adds what main lacks):

- TeacherResourceOverrides: default_teacher_cfg and teacher_overrides are
  now partial blocks (every field Optional), so a per-alias override that
  sets one key no longer resets the others to schema defaults.
- provider_override_allowed + megatron_cfg._provider_override_allowlist:
  a teacher's config is cloned from the student's, but only the keys the
  user wrote for that teacher may be applied onto its Megatron model
  provider. This is what lets a text NemotronH teacher be built under a
  Nemotron Omni student config (the student's vision-tower keys and
  mtp_num_layers=0 no longer leak onto the teacher). Consulted in
  setup.setup_model_config, setup._apply_mtp_config and
  community_import.import_model_from_hf_name; student configs carry no
  allowlist and behave as before.
- BatchedDataDict multimodal dedup visitor tolerates dict-valued "type"
  keys (tool / JSON-schema payloads) instead of crashing on an unhashable
  set-membership test.
- MegatronPolicyWorker: opt-in NRL_REFIT_SKIP_MTP=1 drops mtp.* params from
  refit (generation engines without speculative decoding never consume
  them) and opt-in NRL_BEST_EFFORT_EMPTY_CACHE=1 skips
  torch.cuda.empty_cache() under expandable_segments (allocator-corrupting
  torch bug observed after checkpoint saves).

Differences from the original: the refit filter is applied inside main's
draft_model_detached() block; the empty_cache guard is called at the top of
main's worker __init__ alongside is_refit_destination/refit_payload_mode.
Unit tests from the original are appended to main's versions of
test_batched_data_dict.py, test_teacher_worker_group.py and
tests/unit/models/policy/test_utils.py.

(cherry picked from commit ba6e973)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
(cherry picked from commit f551a4f)
Signed-off-by: adithyare <[email protected]>
arendu added a commit that referenced this pull request Oct 7, 2026
Port of super-v3.5-posttraining ba6e973 (#3830) onto main's multi-teacher
OPD infrastructure (teacher_model_by_agent_name / default_teacher_alias /
non_colocated_teachers already exist here; this adds what main lacks):

- TeacherResourceOverrides: default_teacher_cfg and teacher_overrides are
  now partial blocks (every field Optional), so a per-alias override that
  sets one key no longer resets the others to schema defaults.
- provider_override_allowed + megatron_cfg._provider_override_allowlist:
  a teacher's config is cloned from the student's, but only the keys the
  user wrote for that teacher may be applied onto its Megatron model
  provider. This is what lets a text NemotronH teacher be built under a
  Nemotron Omni student config (the student's vision-tower keys and
  mtp_num_layers=0 no longer leak onto the teacher). Consulted in
  setup.setup_model_config, setup._apply_mtp_config and
  community_import.import_model_from_hf_name; student configs carry no
  allowlist and behave as before.
- BatchedDataDict multimodal dedup visitor tolerates dict-valued "type"
  keys (tool / JSON-schema payloads) instead of crashing on an unhashable
  set-membership test.
- MegatronPolicyWorker: opt-in NRL_REFIT_SKIP_MTP=1 drops mtp.* params from
  refit (generation engines without speculative decoding never consume
  them) and opt-in NRL_BEST_EFFORT_EMPTY_CACHE=1 skips
  torch.cuda.empty_cache() under expandable_segments (allocator-corrupting
  torch bug observed after checkpoint saves).

Differences from the original: the refit filter is applied inside main's
draft_model_detached() block; the empty_cache guard is called at the top of
main's worker __init__ alongside is_refit_destination/refit_payload_mode.
Unit tests from the original are appended to main's versions of
test_batched_data_dict.py, test_teacher_worker_group.py and
tests/unit/models/policy/test_utils.py.

(cherry picked from commit ba6e973)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
(cherry picked from commit f551a4f)
Signed-off-by: adithyare <[email protected]>
pjin-nvidia added a commit that referenced this pull request Oct 8, 2026
With a VLM policy, the async trajectory collector repeats each prompt
batch with repeat_interleave(share_immutable_media=True), which walks
every row looking for typed media content. Agentic rows carry tool
schemas whose "type" can be a list (JSON-schema unions such as
["integer", "null"]) or a dict, and the set-membership test raised:

  TypeError: unhashable type: 'list'

The collector kept the batch as a leftover and retried it every 50 ms,
so a MOPD phase 1 run stopped making progress after its first step.

- Port the guard from the super v3.5 MOPD PR
  (#3830), as ported to main in
  #4554: only a string "type"
  can mark typed media.
- Tests: #4554's dict-valued case, plus the list-valued case through
  repeat_interleave.

Signed-off-by: Peter Jin <[email protected]>
aroshanghias-nvd pushed a commit that referenced this pull request Oct 17, 2026
Port of super-v3.5-posttraining ba6e973 (#3830) onto main's multi-teacher
OPD infrastructure (teacher_model_by_agent_name / default_teacher_alias /
non_colocated_teachers already exist here; this adds what main lacks):

- TeacherResourceOverrides: default_teacher_cfg and teacher_overrides are
  now partial blocks (every field Optional), so a per-alias override that
  sets one key no longer resets the others to schema defaults.
- provider_override_allowed + megatron_cfg._provider_override_allowlist:
  a teacher's config is cloned from the student's, but only the keys the
  user wrote for that teacher may be applied onto its Megatron model
  provider. This is what lets a text NemotronH teacher be built under a
  Nemotron Omni student config (the student's vision-tower keys and
  mtp_num_layers=0 no longer leak onto the teacher). Consulted in
  setup.setup_model_config, setup._apply_mtp_config and
  community_import.import_model_from_hf_name; student configs carry no
  allowlist and behave as before.
- BatchedDataDict multimodal dedup visitor tolerates dict-valued "type"
  keys (tool / JSON-schema payloads) instead of crashing on an unhashable
  set-membership test.
- MegatronPolicyWorker: opt-in NRL_REFIT_SKIP_MTP=1 drops mtp.* params from
  refit (generation engines without speculative decoding never consume
  them) and opt-in NRL_BEST_EFFORT_EMPTY_CACHE=1 skips
  torch.cuda.empty_cache() under expandable_segments (allocator-corrupting
  torch bug observed after checkpoint saves).

Differences from the original: the refit filter is applied inside main's
draft_model_detached() block; the empty_cache guard is called at the top of
main's worker __init__ alongside is_refit_destination/refit_payload_mode.
Unit tests from the original are appended to main's versions of
test_batched_data_dict.py, test_teacher_worker_group.py and
tests/unit/models/policy/test_utils.py.

(cherry picked from commit ba6e973)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
(cherry picked from commit f551a4f)
Signed-off-by: adithyare <[email protected]>
(cherry picked from commit 88b9994)
aroshanghias-nvd pushed a commit that referenced this pull request Oct 22, 2026
Port of super-v3.5-posttraining ba6e973 (#3830) onto main's multi-teacher
OPD infrastructure (teacher_model_by_agent_name / default_teacher_alias /
non_colocated_teachers already exist here; this adds what main lacks):

- TeacherResourceOverrides: default_teacher_cfg and teacher_overrides are
  now partial blocks (every field Optional), so a per-alias override that
  sets one key no longer resets the others to schema defaults.
- provider_override_allowed + megatron_cfg._provider_override_allowlist:
  a teacher's config is cloned from the student's, but only the keys the
  user wrote for that teacher may be applied onto its Megatron model
  provider. This is what lets a text NemotronH teacher be built under a
  Nemotron Omni student config (the student's vision-tower keys and
  mtp_num_layers=0 no longer leak onto the teacher). Consulted in
  setup.setup_model_config, setup._apply_mtp_config and
  community_import.import_model_from_hf_name; student configs carry no
  allowlist and behave as before.
- BatchedDataDict multimodal dedup visitor tolerates dict-valued "type"
  keys (tool / JSON-schema payloads) instead of crashing on an unhashable
  set-membership test.
- MegatronPolicyWorker: opt-in NRL_REFIT_SKIP_MTP=1 drops mtp.* params from
  refit (generation engines without speculative decoding never consume
  them) and opt-in NRL_BEST_EFFORT_EMPTY_CACHE=1 skips
  torch.cuda.empty_cache() under expandable_segments (allocator-corrupting
  torch bug observed after checkpoint saves).

Differences from the original: the refit filter is applied inside main's
draft_model_detached() block; the empty_cache guard is called at the top of
main's worker __init__ alongside is_refit_destination/refit_payload_mode.
Unit tests from the original are appended to main's versions of
test_batched_data_dict.py, test_teacher_worker_group.py and
tests/unit/models/policy/test_utils.py.

(cherry picked from commit ba6e973)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
(cherry picked from commit f551a4f)
Signed-off-by: adithyare <[email protected]>
(cherry picked from commit 88b9994)
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.

4 participants