Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 531fb16

Browse files
committedMar 18, 2025·
apply style
1 parent f2f827c commit 531fb16

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed
 

‎optimum/exporters/openvino/model_configs.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ def init_model_configs():
149149
"Gemma3ForConditionalGeneration",
150150
)
151151

152-
TasksManager._TRANSFORMERS_TASKS_TO_MODEL_LOADERS[
153-
"image-text-to-text"
154-
] = TasksManager._TRANSFORMERS_TASKS_TO_MODEL_LOADERS["text-generation"]
152+
TasksManager._TRANSFORMERS_TASKS_TO_MODEL_LOADERS["image-text-to-text"] = (
153+
TasksManager._TRANSFORMERS_TASKS_TO_MODEL_LOADERS["text-generation"]
154+
)
155155

156156
TasksManager._TRANSFORMERS_TASKS_TO_MODEL_LOADERS["video-text-to-text"] = "AutoModelForVision2Seq"
157157

‎optimum/exporters/openvino/model_patcher.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,9 @@ def _llama_gemma_update_causal_mask_legacy(self, attention_mask, input_tensor, c
430430
offset = 0
431431
mask_shape = attention_mask.shape
432432
mask_slice = (attention_mask.eq(0.0)).to(dtype=dtype) * min_dtype
433-
causal_mask[
434-
: mask_shape[0], : mask_shape[1], offset : mask_shape[2] + offset, : mask_shape[3]
435-
] = mask_slice
433+
causal_mask[: mask_shape[0], : mask_shape[1], offset : mask_shape[2] + offset, : mask_shape[3]] = (
434+
mask_slice
435+
)
436436

437437
if (
438438
self.config._attn_implementation == "sdpa"
@@ -2073,9 +2073,9 @@ def _dbrx_update_causal_mask_legacy(
20732073
offset = 0
20742074
mask_shape = attention_mask.shape
20752075
mask_slice = (attention_mask.eq(0.0)).to(dtype=dtype) * min_dtype
2076-
causal_mask[
2077-
: mask_shape[0], : mask_shape[1], offset : mask_shape[2] + offset, : mask_shape[3]
2078-
] = mask_slice
2076+
causal_mask[: mask_shape[0], : mask_shape[1], offset : mask_shape[2] + offset, : mask_shape[3]] = (
2077+
mask_slice
2078+
)
20792079

20802080
if (
20812081
self.config._attn_implementation == "sdpa"

‎optimum/intel/openvino/modeling_base.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ def __init__(
111111
for idx, key in enumerate(model.inputs):
112112
names = tuple(key.get_names())
113113
input_names[next((name for name in names if "/" not in name), names[0])] = idx
114-
input_dtypes[
115-
next((name for name in names if "/" not in name), names[0])
116-
] = key.get_element_type().get_type_name()
114+
input_dtypes[next((name for name in names if "/" not in name), names[0])] = (
115+
key.get_element_type().get_type_name()
116+
)
117117
self.input_names = input_names
118118
self.input_dtypes = input_dtypes
119119

@@ -122,9 +122,9 @@ def __init__(
122122
for idx, key in enumerate(model.outputs):
123123
names = tuple(key.get_names())
124124
output_names[next((name for name in names if "/" not in name), names[0])] = idx
125-
output_dtypes[
126-
next((name for name in names if "/" not in name), names[0])
127-
] = key.get_element_type().get_type_name()
125+
output_dtypes[next((name for name in names if "/" not in name), names[0])] = (
126+
key.get_element_type().get_type_name()
127+
)
128128

129129
self.output_names = output_names
130130
self.output_dtypes = output_dtypes

‎optimum/intel/openvino/modeling_diffusion.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -881,9 +881,11 @@ def reshape(
881881
self.text_encoder.model = self._reshape_text_encoder(
882882
self.text_encoder.model,
883883
batch_size,
884-
getattr(self.tokenizer, "model_max_length", -1)
885-
if "Gemma" not in self.tokenizer.__class__.__name__
886-
else -1,
884+
(
885+
getattr(self.tokenizer, "model_max_length", -1)
886+
if "Gemma" not in self.tokenizer.__class__.__name__
887+
else -1
888+
),
887889
)
888890

889891
if self.text_encoder_2 is not None:

0 commit comments

Comments
 (0)
Please sign in to comment.