OPD losses error for Megatron when i use megatron for compute losses the code position…
- User
OPD losses error for Megatron when i use megatron for compute losses the code position is: /verl/trainer/distillation/megatron/losses.py Line 248 teacher_topk_log_probs_cp_split, *_ = preprocess_bshd_engine(teacher_topk_log_probs, pre_process=True)
the teacher_topk_log_probs is [b, length, 64] but preprocess_bshd_engine this function need [n, length] dim, so error happens
Interface
No new interfaces are introduced.
- Assistant
I’ll trace the Megatron OPD loss path and the sequence-parallel preprocessing contract, then patch the shape handling and run focused tests. No new interface will be added.
- Assistant
The failure is in the shared BSHD preprocessor: it derives lengths correctly from a jagged
[batch, sequence, topk]tensor, but allocates only[batch, sequence]outputs. I’m generalizing its payload handling so trailing dimensions (such as OPD’s top-k axis) are preserved while masks and position IDs remain two-dimensional. - Assistant
The implementation now preserves arbitrary trailing payload dimensions through padding and zigzag context-parallel splitting. I also added regression coverage for both ordinary BSHD preprocessing and context-parallel splitting; next I’m validating formatting and exercising the tests in the available environment.
- Assistant
Validation is clean: all repository pre-commit checks pass, and a standalone execution of the actual preprocessor confirms
[batch, sequence, 64]preservation plus correct context-parallel zigzag selection. The focused pytest is present but skips locally because this checkout does not havemegatron-coreinstalled.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- composer-2.5Compare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- gpt-5.6-solCompare side by side →
- fable-5Compare side by side →
- fable-5Compare side by side →