Skip to content

Commit f335745

Browse files
[OpenVINO] Set dynamic sequence length for Flux.2 (#1846)
* Fix shapes for transformer * Apply code-formatting --------- Co-authored-by: Kazantsev, Roman <roman.kazantsev@intel.com>
1 parent 09d4c96 commit f335745

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎optimum/exporters/openvino/input_generators.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,6 @@ def generate(self, input_name: str, framework: str = "pt", int_dtype: str = "int
745745
if input_name == "img_ids":
746746
img_ids_height = self.height // 2
747747
img_ids_width = self.width // 2
748-
img_ids_shape = [self.batch_size, img_ids_height * img_ids_width, 3]
749748
img_ids_shape = (
750749
[self.batch_size, img_ids_height * img_ids_width, 3]
751750
if is_diffusers_version("<", "0.31.0")

‎optimum/exporters/openvino/model_configs.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2507,11 +2507,13 @@ def inputs(self):
25072507

25082508
common_inputs["hidden_states"] = {0: "batch_size", 1: "packed_height_width"}
25092509
common_inputs["txt_ids"] = (
2510-
{0: "batch_size", 1: "sequence_length"} if is_diffusers_version("<", "0.31.0") else {0: "sequence_length"}
2510+
{0: "batch_size", 1: "sequence_length"}
2511+
if is_diffusers_version("<", "0.31.0") or self.is_flux2
2512+
else {0: "sequence_length"}
25112513
)
25122514
common_inputs["img_ids"] = (
25132515
{0: "batch_size", 1: "packed_height_width"}
2514-
if is_diffusers_version("<", "0.31.0")
2516+
if is_diffusers_version("<", "0.31.0") or self.is_flux2
25152517
else {0: "packed_height_width"}
25162518
)
25172519
if getattr(self._normalized_config, "guidance_embeds", False):

0 commit comments

Comments
 (0)