Skip to content

Commit

Permalink
Fix Whisper export for FP16 CUDA (microsoft#22410)
Browse files Browse the repository at this point in the history
### Description
This PR fixes a bug when the ONNX checker is called while exporting
Whisper for FP16 CUDA with optional flags.

### Motivation and Context
Sometimes, the ONNX checker raises an error depending on the optional
flags passed. By wrapping the ONNX checker in a try-except, the
conversion can continue even if the checker fails.
  • Loading branch information
kunal-vaishnavi authored Oct 12, 2024
1 parent 572e43c commit 18e81f8
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,7 @@ def chain_model(args):
convert_attribute=True,
location=f"{os.path.basename(args.beam_model_output_dir)}.data",
)
onnx.checker.check_model(args.beam_model_output_dir, full_check=True)
try:
onnx.checker.check_model(args.beam_model_output_dir, full_check=True)
except Exception as e:
logger.error(f"An error occurred while running the ONNX checker: {e}", exc_info=True) # noqa: G201

0 comments on commit 18e81f8

Please sign in to comment.