TranscriberSherpa¶
processing extra: transcriber-sherpa
Streaming speech recognition with sherpa-onnx, on CPU and without torch. One message is transmitted for each sentence, when the speaker stops talking.
- Node type:
TranscriberSherpa- Input:
AudioPayload- Output:
ObjectPayload- Extra:
transcriber-sherpa
$ pip install "juturna-nodes[transcriber-sherpa]"
The node downloads its default model on first use. The node README describes the model cache, the input and output messages, and the licenses of the code and the weights.
Model¶
By default the node downloads the English streaming zipformer (Apache-2.0)
on first use: the int8 encoder, decoder and joiner and tokens.txt, 73 MB,
from the Hugging Face repository
at a pinned revision. Each file is checked against its size and SHA-256 on
download. The files are kept in ~/.cache/juturna/models/<model>/ (or
under $XDG_CACHE_HOME), and later runs reuse them after checking their size
and SHA-256.
To use a model you already have, set model_dir to its folder; model is
then ignored. The folder must hold tokens.txt and one encoder*.onnx,
decoder*.onnx and joiner*.onnx file each; when both are present, the
.int8. files are used.
Arguments¶
Argument |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Model downloaded into the cache; the default is the only model this node supports |
|
|
|
Folder of a streaming transducer model, used instead of |
|
|
|
CPU threads used by the recognizer |
|
|
|
Seconds of silence after speech that close a sentence |
Input message¶
Field |
Use |
|---|---|
|
Mono |
|
Rate of |
meta is not read. The node keeps one recognition stream for all the
messages it receives, so it expects a single audio source. A sentence is
transmitted after enough silence, or when the node stops: when the pipeline
is stopped, the sentence still open is transmitted to the next nodes, which
are stopped after it. An audio source that stops sending while the pipeline
keeps running (a caller hanging up, for example) leaves the sentence open
until more audio comes.
Output message¶
Field |
Content |
|---|---|
|
The sentence, in lower case, without punctuation |
|
List of words, each |
The message keeps the version and the timers of the audio message that closed
the sentence. meta is empty.
License¶
Weights: the default model is downloaded from csukuangfj/sherpa-onnx-streaming-zipformer-en-2023-06-26, Apache-2.0 on its model card. With
model_dir, the license is the one of the model you use.Runtime: sherpa-onnx, Apache-2.0.
requests: Apache-2.0 (the license of requests on PyPI), to download the default model.
Pipeline usage¶
{
"name": "stt",
"type": "TranscriberSherpa",
"configuration": {}
}
Configuration¶
Default node arguments, as defined in the node config.toml file. Any of
them can be overridden in the node configuration of a pipeline.
[arguments]
model = "sherpa-onnx-streaming-zipformer-en-2023-06-26"
model_dir = ""
num_threads = 2
min_trailing_silence = 0.8
[meta]
Reference¶
- class TranscriberSherpa(
- model: str,
- model_dir: str,
- num_threads: int,
- min_trailing_silence: float,
- **kwargs,
Transcribe audio with a streaming sherpa-onnx transducer model