Unverified Commit 02188768 authored by Sanchit Gandhi's avatar Sanchit Gandhi Committed by GitHub
Browse files

[ASR Pipe Test] Fix CTC timestamps error message (#25727)

parent fd0b94fd
...@@ -402,7 +402,7 @@ class AutomaticSpeechRecognitionPipeline(ChunkPipeline): ...@@ -402,7 +402,7 @@ class AutomaticSpeechRecognitionPipeline(ChunkPipeline):
raise ValueError("CTC with LM can only predict word level timestamps, set `return_timestamps='word'`") 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"]: if self.type == "ctc" and return_timestamps not in ["char", "word"]:
raise ValueError( 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." "Set `return_timestamps='char'` or `return_timestamps='word'` as required."
) )
if self.type == "seq2seq_whisper" and return_timestamps == "char": if self.type == "seq2seq_whisper" and return_timestamps == "char":
......
...@@ -1150,7 +1150,7 @@ class AutomaticSpeechRecognitionPipelineTests(unittest.TestCase): ...@@ -1150,7 +1150,7 @@ class AutomaticSpeechRecognitionPipelineTests(unittest.TestCase):
# CTC models must specify return_timestamps type - cannot set `return_timestamps=True` blindly # CTC models must specify return_timestamps type - cannot set `return_timestamps=True` blindly
with self.assertRaisesRegex( with self.assertRaisesRegex(
ValueError, 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.$", "Set `return_timestamps='char'` or `return_timestamps='word'` as required.$",
): ):
_ = speech_recognizer(audio, return_timestamps=True) _ = speech_recognizer(audio, return_timestamps=True)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment