Skip to content

Commit fdbb496

Browse files
scoped GPTQModifier
Signed-off-by: Brian Dellabetta <[email protected]>
1 parent f790938 commit fdbb496

File tree

1 file changed

+6
-2
lines changed
  • src/llmcompressor/modifiers/quantization/gptq

1 file changed

+6
-2
lines changed

src/llmcompressor/modifiers/quantization/gptq/base.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
get_execution_device,
1111
getattr_chain,
1212
update_offload_parameter,
13+
match_named_modules,
1314
)
1415
from loguru import logger
1516
from pydantic import PrivateAttr, field_validator
@@ -165,7 +166,10 @@ def on_initialize(self, state: State, **kwargs) -> bool:
165166
QuantizationMixin.initialize_quantization(self, state.model)
166167

167168
# prepare module names
168-
self._module_names = {m: name for name, m in state.model.named_modules()}
169+
self._module_names = {
170+
m: name
171+
for name, m in match_named_modules(state.model, self.targets, self.ignore)
172+
}
169173

170174
return True
171175

@@ -178,7 +182,7 @@ def on_start(self, state: State, event: Event, **kwargs):
178182

179183
# register gptq hooks
180184
added_hook = False
181-
for module in state.model.modules():
185+
for _, module in match_named_modules(state.model, self.targets, self.ignore):
182186
if getattr_chain(module, "quantization_scheme.weights", None) is not None:
183187
# HACK: previously, embeddings were not quantized because they were not
184188
# accessible by the layer compressor. For now, we manually ignore it,

0 commit comments

Comments
 (0)