fix(qwen3_5): broadcast per-tensor scale in _make_packed_weight_loader for FP8 models (#23062)

This commit is contained in:
kkyyxhll
2026-04-30 14:16:57 +08:00
committed by GitHub
parent bcb34da9f9
commit 936c9c2355
2 changed files with 220 additions and 7 deletions
+4 -7
View File
@@ -320,13 +320,10 @@ class Qwen3_5GatedDeltaNet(nn.Module):
module, param, loaded_shard_id
)
if len(loaded_weight.shape) == 0:
# Scalar only makes sense for a single logical shard.
assert len(split_sizes) == 1 and split_sizes[0] == 1, (
f"Unexpected scalar for tuple shard load: "
f"{loaded_shard_id=}, {split_sizes=}"
)
chunks = [loaded_weight.reshape(1)]
if loaded_weight.numel() == 1:
# Single-element tensor (scalar or [1]):
# broadcast to each logical shard.
chunks = [loaded_weight.view(-1)] * len(loaded_shard_id)
else:
split_dim = getattr(param, "output_dim", 0)
if _is_cpu: