From d99b69030cf59c8cf0841700297804fe0bfd0f73 Mon Sep 17 00:00:00 2001 From: Maxim Vafin Date: Thu, 12 Dec 2024 15:30:21 +0100 Subject: [PATCH 1/3] Reduce img size in dummy_inputs for FLUX --- optimum/exporters/openvino/model_configs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/optimum/exporters/openvino/model_configs.py b/optimum/exporters/openvino/model_configs.py index d9c0165d98..233ab29fb1 100644 --- a/optimum/exporters/openvino/model_configs.py +++ b/optimum/exporters/openvino/model_configs.py @@ -1808,7 +1808,8 @@ def __init__( height: int = DEFAULT_DUMMY_SHAPES["height"], **kwargs, ): - super().__init__(task, normalized_config, batch_size, num_channels, width, height, **kwargs) + # Reduce img shape by 4 for FLUX to reduce memory usage on conversion + super().__init__(task, normalized_config, batch_size, num_channels, width // 4, height // 4, **kwargs) if getattr(normalized_config, "in_channels", None): self.num_channels = normalized_config.in_channels // 4 From 0850f4c23589f59371aa8bcdac3cb9c865d8a77c Mon Sep 17 00:00:00 2001 From: Ilyas Moutawwakil <57442720+IlyasMoutawwakil@users.noreply.github.com> Date: Tue, 17 Dec 2024 10:56:40 +0100 Subject: [PATCH 2/3] change dims in function signature --- optimum/exporters/openvino/model_configs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/optimum/exporters/openvino/model_configs.py b/optimum/exporters/openvino/model_configs.py index 233ab29fb1..400eb13d7d 100644 --- a/optimum/exporters/openvino/model_configs.py +++ b/optimum/exporters/openvino/model_configs.py @@ -1804,12 +1804,12 @@ def __init__( normalized_config: NormalizedVisionConfig, batch_size: int = DEFAULT_DUMMY_SHAPES["batch_size"], num_channels: int = DEFAULT_DUMMY_SHAPES["num_channels"], - width: int = DEFAULT_DUMMY_SHAPES["width"], - height: int = DEFAULT_DUMMY_SHAPES["height"], + width: int = DEFAULT_DUMMY_SHAPES["width"] // 4, + height: int = DEFAULT_DUMMY_SHAPES["height"] // 4, **kwargs, ): # Reduce img shape by 4 for FLUX to reduce memory usage on conversion - super().__init__(task, normalized_config, batch_size, num_channels, width // 4, height // 4, **kwargs) + super().__init__(task, normalized_config, batch_size, num_channels, width, height, **kwargs) if getattr(normalized_config, "in_channels", None): self.num_channels = normalized_config.in_channels // 4 From adfdc68aa082576615b7c296bc88e3c80d2bd921 Mon Sep 17 00:00:00 2001 From: Ilyas Moutawwakil <57442720+IlyasMoutawwakil@users.noreply.github.com> Date: Tue, 17 Dec 2024 10:57:25 +0100 Subject: [PATCH 3/3] Update optimum/exporters/openvino/model_configs.py --- optimum/exporters/openvino/model_configs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/optimum/exporters/openvino/model_configs.py b/optimum/exporters/openvino/model_configs.py index 400eb13d7d..1ffcabb48b 100644 --- a/optimum/exporters/openvino/model_configs.py +++ b/optimum/exporters/openvino/model_configs.py @@ -1806,9 +1806,9 @@ def __init__( num_channels: int = DEFAULT_DUMMY_SHAPES["num_channels"], width: int = DEFAULT_DUMMY_SHAPES["width"] // 4, height: int = DEFAULT_DUMMY_SHAPES["height"] // 4, + # Reduce img shape by 4 for FLUX to reduce memory usage on conversion **kwargs, ): - # Reduce img shape by 4 for FLUX to reduce memory usage on conversion super().__init__(task, normalized_config, batch_size, num_channels, width, height, **kwargs) if getattr(normalized_config, "in_channels", None): self.num_channels = normalized_config.in_channels // 4