Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion tests/models/whisper/test_modeling_whisper.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ class WhisperModelTest(ModelTesterMixin, GenerationTesterMixin, PipelineTesterMi
fx_compatible = False
test_pruning = False
test_missing_keys = False
# Needs higher percentages after model tester's vocab_size is changed to 200 (PR #21222)
model_split_percents = [0.8, 0.9]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix test_model_parallelism


input_name = "input_features"

Expand Down Expand Up @@ -727,7 +729,17 @@ def _create_and_check_torchscript(self, config, inputs_dict):
input_features = inputs["input_features"]
decoder_input_ids = inputs["decoder_input_ids"]
decoder_attention_mask = inputs["decoder_attention_mask"]
traced_model = torch.jit.trace(model, (input_features, decoder_input_ids, decoder_attention_mask))
# prepare `attention_mask` with shape (batch_size, sequence_length)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to the change in #21298 (a new optional argument being added)

attention_mask = torch.ones(
input_features.shape[0],
input_features.shape[-1],
device=input_features.device,
dtype=input_features.dtype,
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit lazy, so I just prepare this argument here directly.

traced_model = torch.jit.trace(
model, (input_features, attention_mask, decoder_input_ids, decoder_attention_mask)
)

except RuntimeError:
self.fail("Couldn't trace module.")

Expand Down