Skip to content

Commit caab6da

Browse files
committed
fix cache dynamic dimension in image-text-to-txt
1 parent 9af6f4f commit caab6da

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

onnx_diagnostic/tasks/image_text_to_text.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def _get_inputs_gemma3(
156156
},
157157
"position_ids": {0: batch, 1: seq_length},
158158
"cache_position": {0: seq_length},
159-
"past_key_values": [{0: batch} for _ in range(num_hidden_layers * 2)],
159+
"past_key_values": [{0: batch, 2: seq_length} for _ in range(num_hidden_layers * 2)],
160160
"pixel_values": {0: batch},
161161
"use_cache": None,
162162
}
@@ -280,7 +280,7 @@ def get_inputs_default(
280280
"past_key_values": list(
281281
itertools.chain.from_iterable(
282282
zip(
283-
[{0: batch} for _ in range(num_hidden_layers)],
283+
[{0: batch, 2: cache_length} for _ in range(num_hidden_layers)],
284284
[{0: batch, 2: cache_length} for _ in range(num_hidden_layers)],
285285
)
286286
)

0 commit comments

Comments
 (0)