[AMD] [GLM-5.3-Flash Day 0] Honor fused and per-expert names in quark exclude (#39317)

Co-authored-by: Yikai Zhang <ykzhang12@gmail.com>
Co-authored-by: Thomas Wang <thomawan@amd.com>
Co-authored-by: Kevin Mi <45493463+kevin-mii@users.noreply.github.com>
Co-authored-by: Kevin Mi <mikevin920@yahoo.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Raiden Makoto
2026-09-21 21:26:42 -07:00
committed by GitHub
co-authored by Yikai Zhang Thomas Wang Kevin Mi Kevin Mi Claude Fable 5.1
parent 018b73c7a0
commit e1daf68304
2 changed files with 56 additions and 5 deletions
@@ -55,6 +55,19 @@ def should_ignore_layer(
# proj_name = qkv_proj
proj_name = layer_name.split(".")[-1]
# a fused module can be excluded under its fused name, so match it before expanding
if check_equal_or_regex_match(layer_name=layer_name, targets=ignore):
return True
# excludes may name experts individually, so an excluded expert excludes the module
if layer_name.endswith(".experts"):
expert_prefix = layer_name + "."
if any(
isinstance(target, str) and target.startswith(expert_prefix)
for target in ignore
):
return True
# Fused layers like gate_up_proj or qkv_proj will not be fused
# in the safetensors checkpoint. So, we convert the name
# from the fused version to unfused + check to make sure that
@@ -87,12 +100,9 @@ def should_ignore_layer(
"requires all to use the same scheme."
)
# Unfused layers like down_proj and o_proj will match
# the safetensors checkpoint already.
# an unfused name was already tried by the direct check above
else:
should_ignore_layer = check_equal_or_regex_match(
layer_name=layer_name, targets=ignore
)
should_ignore_layer = False
assert should_ignore_layer is not None