Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
02188768
Unverified
Commit
02188768
authored
Aug 24, 2023
by
Sanchit Gandhi
Committed by
GitHub
Aug 24, 2023
Browse files
[ASR Pipe Test] Fix CTC timestamps error message (#25727)
parent
fd0b94fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
src/transformers/pipelines/automatic_speech_recognition.py
src/transformers/pipelines/automatic_speech_recognition.py
+1
-1
tests/pipelines/test_pipelines_automatic_speech_recognition.py
.../pipelines/test_pipelines_automatic_speech_recognition.py
+1
-1
No files found.
src/transformers/pipelines/automatic_speech_recognition.py
View file @
02188768
...
...
@@ -402,7 +402,7 @@ class AutomaticSpeechRecognitionPipeline(ChunkPipeline):
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"
:
...
...
tests/pipelines/test_pipelines_automatic_speech_recognition.py
View file @
02188768
...
...
@@ -1150,7 +1150,7 @@ class AutomaticSpeechRecognitionPipelineTests(unittest.TestCase):
# 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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment