-
Notifications
You must be signed in to change notification settings - Fork 30.7k
fix asr ut failures #41332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+6
−6
Merged
fix asr ut failures #41332
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1104,7 +1104,7 @@ def test_whisper_language(self): | |
def test_speculative_decoding_whisper_non_distil(self): | ||
# Load data: | ||
dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation[:1]") | ||
sample = dataset[0]["audio"] | ||
sample = dataset[0]["audio"].get_all_samples().data | ||
|
||
# Load model: | ||
model_id = "openai/whisper-large-v2" | ||
|
@@ -1133,8 +1133,8 @@ def test_speculative_decoding_whisper_non_distil(self): | |
num_beams=1, | ||
) | ||
|
||
transcription_non_ass = pipe(sample.copy(), generate_kwargs={"assistant_model": assistant_model})["text"] | ||
transcription_ass = pipe(sample)["text"] | ||
transcription_ass = pipe(sample.clone().detach(), generate_kwargs={"assistant_model": assistant_model})["text"] | ||
transcription_non_ass = pipe(sample)["text"] | ||
Comment on lines
+1136
to
+1137
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for catching the incorrect inversion here! |
||
|
||
self.assertEqual(transcription_ass, transcription_non_ass) | ||
self.assertEqual( | ||
|
@@ -1422,13 +1422,13 @@ def test_whisper_prompted(self): | |
) | ||
|
||
dataset = load_dataset("distil-whisper/librispeech_long", "clean", split="validation") | ||
sample = dataset[0]["audio"] | ||
sample = dataset[0]["audio"].get_all_samples().data | ||
|
||
# prompt the model to misspell "Mr Quilter" as "Mr Quillter" | ||
whisper_prompt = "Mr. Quillter." | ||
prompt_ids = pipe.tokenizer.get_prompt_ids(whisper_prompt, return_tensors="pt").to(torch_device) | ||
|
||
unprompted_result = pipe(sample.copy())["text"] | ||
unprompted_result = pipe(sample.clone().detach())["text"] | ||
prompted_result = pipe(sample, generate_kwargs={"prompt_ids": prompt_ids})["text"] | ||
|
||
# fmt: off | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In multi-device cases(like put 2 devices to run):
in current implementation, in assistant decoding case, assistant model will reuse main model's
SuppressTokensLogitsProcessor
, which place thesuppress_tokens
in the same device asinput_tensor
(which isdevice 0
). assistant model will ingestencoder_outputs
of the main model and do the decoder(in whisper case), whileencoder_outputs
may indevice 1
but main model'ssuppress_tokens
which is main model's is indevice 0
, so lead toRuntimeError
:So based on current implementation(that assistant model shares main model's
SuppressTokensLogitsProcessor
), I movesuppress_tokens
toscores.device
while doingisin
.