onnxruntime
831fa2fe - Validate whisper beginning_timestamp_token_id bounds (#31636)

Commit
34 days ago
Validate whisper beginning_timestamp_token_id bounds (#31636) This pull request improves validation for the Whisper model's `beginning_timestamp_token_id` parameter in both runtime and test code. The main focus is to ensure that invalid values for this parameter are caught early, preventing out-of-range errors during inference and processing. **Validation improvements for Whisper timestamp token ID:** * Added a check in `BeamSearchParameters::SetSubgraphParameters` to enforce that `beginning_timestamp_token_id` is within the valid range `[0, vocab_size)` for Whisper models, throwing an error if not. * Added a similar runtime check in `TimestampLogitsProcessor` to ensure `beginning_timestamp_token_id_` is within bounds before processing logits. **Unit test enhancements:** * Introduced new tests in `beam_search_test.cc` to verify that `SetSubgraphParameters` correctly rejects negative or out-of-range `beginning_timestamp_token_id` values and accepts valid ones.
Author
Parents
Loading