[Bugfix] Fix layer skip logic with bitsandbytes (#9887)

Signed-off-by: mgoin <michael@neuralmagic.com>
This commit is contained in:
Michael Goin 2024-11-01 01:12:44 -04:00 committed by GitHub
parent 96e0c9cbbd
commit 37a4947dcd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -119,7 +119,12 @@ class BitsAndBytesConfig(QuantizationConfig):
def is_layer_skipped_bnb(prefix: str, llm_int8_skip_modules: List[str]):
return any(module_name in prefix for module_name in llm_int8_skip_modules)
# Split the prefix into its dot-separated components
components = prefix.split('.')
# Check if any of the skip modules exactly matches any component
return any(module_name in components
for module_name in llm_int8_skip_modules)
class BitsAndBytesLinearMethod(LinearMethodBase):