3 releases

0.1.3 Dec 5, 2023
0.1.2 Nov 26, 2023
0.1.1 Nov 25, 2023
0.1.0 Nov 24, 2023

#555 in Machine learning

30 downloads per month

MIT license

23KB
559 lines

rusty-whisper

Rust implementation of Whisper. More information about model: https://github.com/openai/whisper

This crate is based on tract.

Quick start

Download weights and example audio file and run simple inference code:

use rusty_whisper::Whisper;

fn main() {
    let whisper = Whisper::new(
        "weights/encoder.onnx",
        "weights/decoder.onnx",
        "weights/multilingual.tiktoken",
        "weights/positional_embedding.npz",
        "weights/mel_filters.npz",
    );
    let result = whisper.recognize_from_audio("data/audio.wav");
    println!("{}", result);
}

The model works only with 16-bit WAV files, so make sure to convert your input before running the tool. For example, you can use ffmpeg like this:

ffmpeg -i input.mp3 -ar 16000 -ac 1 -c:a pcm_s16le output.wav

Dependencies

~30–41MB
~558K SLoC