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.
- Assistant
The failure is in the shared BSHD preprocessor: it derives sequence lengths correctly from the nested tensor, but allocates only
[batch, sequence]and also assumes that shape for padded CP chunks and position IDs. I’m generalizing it to preserve all trailing dimensions, while keeping masks and positions two-dimensional. - Assistant
The first test attempt selected Python 3.13 and hit an unrelated legacy dependency incompatibility (
pyextuses removedinspect.getargspec). I’m correcting the local test environment to the repository-required Python 3.12, then rerunning the focused regression tests. - Assistant
The regression now passes for both ordinary BSHD padding and zigzag context-parallel splitting with a trailing top-k dimension. I’m doing the final formatting/static checks and a nearby distillation test pass to ensure the generalized allocation does not affect existing two-dimensional inputs.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.