Skip to content

Update Whisper export with beam search - #19322

Merged
YUNQIUGUO merged 5 commits into
microsoft:mainfrom
kunal-vaishnavi:kvaishnavi/whisper-update-export
Jan 30, 2024
Merged

Update Whisper export with beam search#19322
YUNQIUGUO merged 5 commits into
microsoft:mainfrom
kunal-vaishnavi:kvaishnavi/whisper-update-export

Conversation

@kunal-vaishnavi

@kunal-vaishnavi kunal-vaishnavi commented Jan 30, 2024

Copy link
Copy Markdown
Contributor

Description

This PR updates the Whisper export with beam search by adding the following.

  • Fixes a bug when running DecoderMaskedMultiHeadAttention in the Whisper with beam search model
  • Sets the default PyTorch attention implementation to eager to allow existing attention fusions to continue working
  • Re-uses the cache directory when loading the PyTorch model to reduce memory used on disk
  • Adds --disable_auto_mixed_precision to the example FP16 export command

Motivation and Context

  • This PR added the is_unidirectional parameter to CheckInputs, but it was not provided when checking the inputs in DecoderMaskedMultiHeadAttention.
  • This PR explains the reasoning behind why eager is used to load the WhisperAttention class.
  • By re-using the cache directory for loading the PyTorch model, only one copy of the PyTorch model is saved on disk instead of two copies.
  • By providing this flag, there will be less Cast nodes in the Whisper with beam search model to switch between FP16 and FP32 precision.

petermcaughan
petermcaughan previously approved these changes Jan 30, 2024
@YUNQIUGUO
YUNQIUGUO merged commit febec1c into microsoft:main Jan 30, 2024
YUNQIUGUO pushed a commit that referenced this pull request Jan 30, 2024
### Description
This PR updates the Whisper export with beam search by adding the
following.

- Fixes a bug when running `DecoderMaskedMultiHeadAttention` in the
Whisper with beam search model
- Sets the default PyTorch attention implementation to `eager` to allow
existing attention fusions to continue working
- Re-uses the cache directory when loading the PyTorch model to reduce
memory used on disk
- Adds `--disable_auto_mixed_precision` to the example FP16 export
command

### Motivation and Context
- [This PR](#19112) added
the `is_unidirectional` parameter to `CheckInputs`, but it was not
provided when checking the inputs in `DecoderMaskedMultiHeadAttention`.
- [This PR](#19200)
explains the reasoning behind why `eager` is used to load the
`WhisperAttention` class.
- By re-using the cache directory for loading the PyTorch model, only
one copy of the PyTorch model is saved on disk instead of two copies.
- By providing this flag, there will be less Cast nodes in the Whisper
with beam search model to switch between FP16 and FP32 precision.
@snnn

snnn commented Sep 5, 2025

Copy link
Copy Markdown
Contributor

This PR has been cherry-picked into the rel-1.17.0 branch in PR #19327. Removing the release:1.17.0 label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants