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 preprocessing path, correct the shape handling without changing interfaces, and add a focused regression test before running the relevant test set.
- Assistant
The failure is in the shared BSHD preprocessor: it preserves only batch and sequence dimensions when allocating padded or context-parallel tensors. I’m making it preserve arbitrary trailing feature dimensions (such as OPD’s top-k dimension), while keeping attention masks and position IDs two-dimensional.
- Assistant
The implementation and regression coverage are in place. Static checks pass; the repository’s Megatron test cannot run in this container because
megatron.coreis not installed, so I’m validating the tensor logic with a local dependency stub and running the repository formatting/lint hooks on the changed files.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.