Fix Quark mxfp4 quantized model loading issue under mtp (#46757)
Signed-off-by: Xiao Yu <xiao.yu.dc@outlook.com> Co-authored-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
co-authored by
Andreas Karatzas
parent
f61163e6c7
commit
02bf9c7907
@@ -27,10 +27,26 @@ def should_ignore_layer(
|
||||
layer_name: str | None,
|
||||
ignore: Iterable[str],
|
||||
fused_mapping: Mapping[str, list[str]] = MappingProxyType({}),
|
||||
*,
|
||||
check_children: bool = False,
|
||||
) -> bool:
|
||||
if layer_name is None:
|
||||
return False
|
||||
|
||||
# MoE layers are currently all-or-nothing: if any child is ignored,
|
||||
# the parent layer must be ignored as well. For example, the
|
||||
# amd/GLM-5.2-MXFP4 config ignores children like
|
||||
# model.layers.78.mlp.experts.*.down_proj, while the layer checked
|
||||
# here is the parent model.layers.N.mlp.experts.
|
||||
# See:
|
||||
# https://huggingface.co/amd/GLM-5.2-MXFP4/blob/main/config.json#L793-L795
|
||||
if check_children and any(
|
||||
target == layer_name or target.startswith(layer_name + ".")
|
||||
for target in ignore
|
||||
if not target.startswith("re:")
|
||||
):
|
||||
return True
|
||||
|
||||
# layer_name = model.layers.0.self_attn.qkv_proj
|
||||
# proj_name = qkv_proj
|
||||
proj_name = layer_name.split(".")[-1]
|
||||
|
||||
Reference in New Issue
Block a user