[model] make llama4 compatible with pure dense layers (#17315)

Signed-off-by: Lucia Fang <fanglu@fb.com>
This commit is contained in:
Lucia Fang
2025-04-28 19:22:22 -07:00
committed by GitHub
parent e136000595
commit b4ac4fa04d

View File

@ -273,8 +273,8 @@ class Llama4DecoderLayer(nn.Module):
cache_config=cache_config,
prefix=f"{prefix}.self_attn",
)
is_moe_layer = (self.layer_idx +
1) % config.interleave_moe_layer_step == 0
is_moe_layer = config.interleave_moe_layer_step > 0 and (
self.layer_idx + 1) % config.interleave_moe_layer_step == 0
if is_moe_layer:
self.feed_forward = Llama4MoE(
config=config,