Skip to content

Commit

Permalink
[ASR Pipe Test] Fix CTC timestamps error message (huggingface#25727)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchit-gandhi authored Aug 24, 2023
1 parent fd0b94f commit 0218876
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/transformers/pipelines/automatic_speech_recognition.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def _sanitize_parameters(
raise ValueError("CTC with LM can only predict word level timestamps, set `return_timestamps='word'`")
if self.type == "ctc" and return_timestamps not in ["char", "word"]:
raise ValueError(
"CTC can either predict character (char) level timestamps, or word level timestamps."
"CTC can either predict character level timestamps, or word level timestamps."
"Set `return_timestamps='char'` or `return_timestamps='word'` as required."
)
if self.type == "seq2seq_whisper" and return_timestamps == "char":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ def test_chunking_and_timestamps(self):
# CTC models must specify return_timestamps type - cannot set `return_timestamps=True` blindly
with self.assertRaisesRegex(
ValueError,
"^CTC can either predict character (char) level timestamps, or word level timestamps."
"^CTC can either predict character level timestamps, or word level timestamps."
"Set `return_timestamps='char'` or `return_timestamps='word'` as required.$",
):
_ = speech_recognizer(audio, return_timestamps=True)
Expand Down

0 comments on commit 0218876

Please sign in to comment.