[Bugfix][HunyuanImage3.0] Fix KV reuse compatibility in SP scenarios (#3546)

Signed-off-by: dengyunyang <584797741@qq.com>
This commit is contained in:
dengyunyang authored and GitHub committed 2026-05-13 22:40:18 +08:00
1 parent 4d3eed152a
commit efd955674b
3 files changed
+24 -8

No files matched your search

@@ -316,6 +316,13 @@ class SequenceParallelSplitHook(ModelHook):
logger.warning_once(f"Expected tensor with {sp_input.expected_dims} dims, got {x.dim()}. Skipping split.")
return x
split_dim = (
sp_input.split_dim if isinstance(sp_input, (SequenceParallelInput, SequenceParallelPartialInput)) else None
)
if split_dim is not None and x.size(split_dim) == 0:
logger.warning_once("Skip sharding for zero-sized tensors.")
return x
def _raise_strict_divisibility_error(*, dim: int, seq_len: int, sp_size: int) -> None:
# Keep message actionable: strict mode must be evenly shardable at the split hook level.
msg = (