Skip to content

Commit d642dde

Browse files
committed
Check for gptqmodel first when exporting a GPTQ model to openvino
1 parent 1d8cdca commit d642dde

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

optimum/exporters/openvino/__main__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
_infer_library_from_model_name_or_path,
4040
_OpenClipForZeroShotImageClassification,
4141
)
42+
from optimum.utils import is_auto_gptq_available, is_gptqmodel_available
4243

4344
from .utils import (
4445
_MAX_UNCOMPRESSED_SIZE,
@@ -344,7 +345,12 @@ def main_export(
344345
orig_post_init_model = GPTQQuantizer.post_init_model
345346

346347
def post_init_model(self, model):
347-
from auto_gptq import exllama_set_max_input_length
348+
if is_gptqmodel_available():
349+
from gptqmodel import exllama_set_max_input_length
350+
elif is_auto_gptq_available():
351+
from auto_gptq import exllama_set_max_input_length
352+
else:
353+
raise ValueError("neither auto_gptq nor gptqmodel is available")
348354

349355
class StoreAttr(object):
350356
pass

0 commit comments

Comments
 (0)