Crates.io | sherpa-transducers |
lib.rs | sherpa-transducers |
version | |
source | src |
created_at | 2025-03-28 05:13:49.713145+00 |
updated_at | 2025-04-17 08:36:09.923759+00 |
description | low latency asr/tagging via sherpa-onnx streaming zipformer-transducer models |
homepage | |
repository | https://github.com/Cross-Product-Labs/sherpa-transducers |
max_upload_size | |
id | 1609193 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
A rust wrapper around streaming mode sherpa-onnx zipformer transducers.
It's very quicklike. Expect to be able to stay abreast of a realtime audio stream on 1-2 modest CPU cores.
For higher throughput applications (many streams served on the same machine), continuous batching is fully supported and significantly improves on per-stream compute utilization.
Add the dep:
cargo add sherpa-transducers
And use it:
use sherpa_transducers::asr;
async fn my_stream_handler() -> anyhow::Result<()> {
let t = asr::Model::from_pretrained("nytopop/zipformer-en-2023-06-21-320ms")
.await?
.num_threads(2)
.build()?;
let mut s = t.phased_stream(1)?;
loop {
// use the sample rate of _your_ audio, input will be resampled automatically
let sample_rate = 24_000;
let audio_samples = vec![0.; 512];
// buffer some samples to be decoded
s.accept_waveform(sample_rate, &audio_samples);
// actually do the decode
s.decode();
// get the transcript since last reset
let (epoch, transcript) = s.state()?;
if transcript.contains("DELETE THIS") {
s.reset();
}
}
}
Default features:
static
: Compile and link sherpa-onnx
staticallydownload-models
: Enable support for loading pretrained transducers from huggingfaceFeatures disabled by default:
cuda
: enable CUDA compute provider support (requires CUDA 11.8, 12.x will not bring you joy and happiness)directml
: enable DirectML compute provider support (entirely untested but theoretically works)download-binaries
: download sherpa-onnx
object files instead of building it