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
13297ac7
Unverified
Commit
13297ac7
authored
Feb 02, 2022
by
Sylvain Gugger
Committed by
GitHub
Feb 02, 2022
Browse files
Fic docstring of ASR pipeline (#15481)
parent
dd360d58
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
14 deletions
+11
-14
src/transformers/pipelines/automatic_speech_recognition.py
src/transformers/pipelines/automatic_speech_recognition.py
+11
-14
No files found.
src/transformers/pipelines/automatic_speech_recognition.py
View file @
13297ac7
...
@@ -154,23 +154,20 @@ class AutomaticSpeechRecognitionPipeline(ChunkPipeline):
...
@@ -154,23 +154,20 @@ class AutomaticSpeechRecognitionPipeline(ChunkPipeline):
Args:
Args:
inputs (`np.ndarray` or `bytes` or `str` or `dict`):
inputs (`np.ndarray` or `bytes` or `str` or `dict`):
The inputs is either :
The inputs is either :
- `str` that is the filename of the
- `str` that is the filename of the audio file, the file will be read at the correct sampling rate
audio file, the file will be read at the correct sampling rate to get the waveform using *ffmpeg*.
to get the waveform using *ffmpeg*. This requires *ffmpeg* to be installed on the system.
This
- `bytes` it is supposed to be the content of an audio file and is interpreted by *ffmpeg* in the
requires *ffmpeg* to be installed on the system.
same way.
- `bytes` it is supposed to be the
content of an audio file and is interpreted by *ffmpeg* in the same way.
- (`np.ndarray` of shape (n, ) of type `np.float32` or `np.float64`)
- (`np.ndarray` of shape (n, ) of type `np.float32` or `np.float64`)
Raw audio at the correct sampling rate (no further check will be done)
Raw audio at the correct sampling rate (no further check will be done)
- `dict` form can be used to pass raw audio sampled at arbirary `sampling_rate` and let
- `dict` form can be used to pass raw audio sampled at arbi
t
rary `sampling_rate` and let
this
this
pipeline do the resampling. The dict must be in the fomat `{"sampling_rate": int, "raw":
pipeline do the resampling. The dict must be in the fo
r
mat `{"sampling_rate": int, "raw":
np.array}` with optionally a `"stride": (left: int, right: int)` than can ask the pipeline to
treat the
np.array}` with optionally a `"stride": (left: int, right: int)` than can ask the pipeline to
first `left` samples and last `right` samples to be ignored in decoding (but used at
inference to
treat the
first `left` samples and last `right` samples to be ignored in decoding (but used at
provide more context to the model). Only use `stride` with CTC models.
inference to
provide more context to the model). Only use `stride` with CTC models.
Return:
Return:
A `dict` with the following keys:
`Dict`: A dictionary with the following keys:
- **text** (`str`) -- The recognized text.
- **text** (`str`) -- The recognized text.
"""
"""
return
super
().
__call__
(
inputs
,
**
kwargs
)
return
super
().
__call__
(
inputs
,
**
kwargs
)
...
...
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