Skip to content

fix: match layer names ending with a digit in ignore_layers - #2435

Open
kwy404 wants to merge 1 commit into
intel:mainfrom
kwy404:fix/ignore-layers-digit-ending-names
Open

kwy404 wants to merge 1 commit into
intel:mainfrom
kwy404:fix/ignore-layers-digit-ending-names

Conversation

@kwy404

@kwy404 kwy404 commented Oct 1, 2026

Copy link
Copy Markdown

Description

Root cause: _resolve_layer_config_presets appends a "." to every ignore_layers entry that ends with a digit, so that layers.1 does not also match layers.10. Layer names can end with a digit too, for example fc1 / fc2 in OPT and Phi, or a full name such as model.decoder.layers.0.fc1. Those entries become fc1. / model.decoder.layers.0.fc1., match no layer, and the layers are quantized anyway. The only hint is the warning "Layer name or regex 'fc1.' in layer_config does not match any supported layers". Full names like model.decoder.layers.0.fc1 worked before #1553, which moved the suffix ahead of the exact name check.

Fix: only append the "." when some module actually sits under that name (name + "." occurs in a module name). Block names such as layers.1 keep the current behavior, and a layer whose own name ends with a digit is matched like any other name.

Test: test_layer_name_ending_with_digit in test/unit/common/utils/test_set_layer_config.py passes ignore_layers="fc1,layers.0.fc2" on the existing 12 block test model.

  • Before the fix: fails with assert 4 == 16 for layers.11.fc1, and the warning above is logged for fc1. and layers.0.fc2..
  • After the fix: the whole file passes (5 passed) with no warning.

Type of Change

Bug fix

Related Issues

Follow up to #1553

Checklist Before Submitting

  • My code has been tested locally.
  • Documentation has been updated as needed.
  • New or updated tests are included where applicable.
  • The CUDA CI has passed. You can trigger it by commenting /azp run Unit-Test-CUDA-AutoRound.

The "." suffix that keeps "layers.1" from matching "layers.10" was also
added to layer names such as "fc1" or "model.decoder.layers.0.fc1", so
those entries matched nothing and the layers were quantized anyway.
Only add the suffix when modules sit under the name.

Signed-off-by: kwy404 <thekaway404@gmail.com>
@AutoRoundBot

Copy link
Copy Markdown
Collaborator

/azp run Unit-Test-CUDA-AutoRound

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants