Skip to content

Commit 75fec39

Browse files
fix(global_ptq): make MDBF detection tolerate a missing MDBF quantizer
detect_quantization_method() imported MultipathMDBFLinear unconditionally, so on an installation without onecomp.quantizer.mdbf *every* call raised ModuleNotFoundError -- including for plain GPTQ and DBF models. On this PR's base branch that broke the existing TestDetectQuantizationMethod tests (3 failures). Guard the import and treat MDBF as absent when it cannot be imported, so GPTQ/DBF detection keeps working without the MDBF quantizer. Verified both ways: without MDBF the global_ptq unit tests pass (69 passed, integration tests deselected), and with MDBF present (merged with feature/mdbf) detection still resolves MultipathMDBFLinear.
1 parent 311e102 commit 75fec39

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

  • global_ptq/onecomp_globalptq/global_ptq/_core

global_ptq/onecomp_globalptq/global_ptq/_core/helpers.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,18 @@ def detect_quantization_method(
8181
"""
8282
from onecomp.quantizer.dbf.dbf_layer import DoubleBinaryLinear
8383
from onecomp.quantizer.gptq.gptq_layer import GPTQLinear
84-
from onecomp.quantizer.mdbf.mdbf_layer import MultipathMDBFLinear
84+
85+
try:
86+
from onecomp.quantizer.mdbf.mdbf_layer import MultipathMDBFLinear
87+
except ImportError:
88+
# MDBF quantizer is optional; without it only GPTQ/DBF are detectable.
89+
MultipathMDBFLinear = None
8590

8691
gptq_modules = find_target_modules(model, GPTQLinear)
8792
dbf_modules = find_target_modules(model, DoubleBinaryLinear)
88-
mdbf_modules = find_target_modules(model, MultipathMDBFLinear)
93+
mdbf_modules = (
94+
find_target_modules(model, MultipathMDBFLinear) if MultipathMDBFLinear is not None else []
95+
)
8996

9097
if gptq_modules and (dbf_modules or mdbf_modules):
9198
logger.warning(

0 commit comments

Comments
 (0)