Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support minicpmv #928

Closed
wants to merge 15 commits into from
10 changes: 8 additions & 2 deletions optimum/exporters/openvino/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
_get_open_clip_submodels_fn_and_export_configs,
clear_class_registry,
remove_none_from_dummy_inputs,
save_config,
)


Expand Down Expand Up @@ -379,7 +380,9 @@ def ts_patched_forward(*args, **kwargs):
if patch_16bit_model:
from openvino.frontend.pytorch.patch_model import __make_16bit_traceable

logging.disable(logging.WARNING)
__make_16bit_traceable(model)
logging.disable(logging.NOTSET)
check_dummy_inputs_are_allowed(model, dummy_inputs)
input_info = _get_input_info(model, config, dummy_inputs)
ov_model = convert_model(
Expand Down Expand Up @@ -644,7 +647,10 @@ def export_from_model(
files_subpaths = ["openvino_" + model_name + ".xml" for model_name in models_and_export_configs.keys()]
elif library_name != "diffusers":
if is_transformers_version(">=", "4.44.99"):
misplaced_generation_parameters = model.config._get_non_default_generation_parameters()
try:
misplaced_generation_parameters = model.config._get_non_default_generation_parameters()
except Exception:
misplaced_generation_parameters = {}
if isinstance(model, GenerationMixin) and len(misplaced_generation_parameters) > 0:
logger.warning(
"Moving the following attributes in the config to the generation config: "
Expand All @@ -656,7 +662,7 @@ def export_from_model(
setattr(model.config, param_name, None)

# Saving the model config and preprocessor as this is needed sometimes.
model.config.save_pretrained(output)
save_config(output, model.config)
generation_config = getattr(model, "generation_config", None)
if generation_config is not None:
try:
Expand Down
Loading
Loading