From fc7ae0e942f5d366a2350bf174a850a16270ec70 Mon Sep 17 00:00:00 2001 From: Zhichenzzz Date: Thu, 18 Jun 2026 20:28:34 +0000 Subject: [PATCH] fix(gdn): only reject THD packed_seq_params, allow BSHD Megatron passes a bshd-format PackedSeqParams uniformly even when no real packing is happening, which GDN can safely ignore. Restrict the NotImplementedError to genuine THD packing instead of any packed_seq_params, so GDN runs under the default bshd path. --- megatron/core/ssm/gated_delta_net.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/megatron/core/ssm/gated_delta_net.py b/megatron/core/ssm/gated_delta_net.py index 601a72a4356..bc181dfaa12 100644 --- a/megatron/core/ssm/gated_delta_net.py +++ b/megatron/core/ssm/gated_delta_net.py @@ -295,9 +295,10 @@ def forward( # TODO: support inference raise NotImplementedError("GDN does not support inference for now.") - if packed_seq_params is not None: - # TODO: support packed sequence - raise NotImplementedError("GDN does not support packed sequence for now.") + if packed_seq_params is not None and packed_seq_params.qkv_format == "thd": + # GDN ignores the bshd PackedSeqParams Megatron passes uniformly; only genuine + # THD packing is unsupported (TODO: port THD support from upstream PR #2645). + raise NotImplementedError("GDN does not support THD packed sequence for now.") # Input projection nvtx_range_push(suffix="in_proj")