Skip to content

Commit 719a80a

Browse files
author
sanchit-gandhi
committed
finish
1 parent 0b6acfb commit 719a80a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/transformers/models/whisper/modeling_whisper.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,6 +1845,10 @@ def prepare_inputs_for_generation(
18451845
elif use_cache:
18461846
cache_position = cache_position[-decoder_input_ids.shape[1] :]
18471847

1848+
# The `contiguous()` here is necessary to have a static stride during decoding. torchdynamo otherwise
1849+
# recompiles graphs as the stride of the inputs is a guard. Ref: https://github.com/huggingface/transformers/pull/29114
1850+
decoder_input_ids = decoder_input_ids.contiguous()
1851+
18481852
return {
18491853
"encoder_outputs": encoder_outputs,
18501854
"past_key_values": past_key_values,

0 commit comments

Comments
 (0)