Skip to content

Commit 5d29d0f

Browse files
committed
Check for gptqmodel first when exporting a GPTQ model to openvino
1 parent 1de7f31 commit 5d29d0f

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
from optimum.utils.save_utils import maybe_load_preprocessors
4344

4445
from .utils import (
@@ -339,7 +340,12 @@ def main_export(
339340
orig_post_init_model = GPTQQuantizer.post_init_model
340341

341342
def post_init_model(self, model):
342-
from auto_gptq import exllama_set_max_input_length
343+
if is_gptqmodel_available():
344+
from gptqmodel import exllama_set_max_input_length
345+
elif is_auto_gptq_available():
346+
from auto_gptq import exllama_set_max_input_length
347+
else:
348+
raise ValueError("neither auto_gptq nor gptqmodel is available")
343349

344350
class StoreAttr(object):
345351
pass

0 commit comments

Comments
 (0)