Packages

Native Elixir bindings for whisper.cpp. Accepts 16 kHz mono f32 PCM and runs on CPU, CUDA, ROCm (hipBLAS), Metal, Vulkan, or CoreML.

Current section

Files

Jump to
whisper_cpp native whisper_cpp_native Cargo.toml
Raw

native/whisper_cpp_native/Cargo.toml

[package]
name = "whisper_cpp_native"
version = "0.1.0"
edition = "2024"
rust-version = "1.91"
[lib]
name = "whisper_cpp_native"
crate-type = ["cdylib"]
[dependencies]
rustler = "0.38.0"
# `whisper-rs` is the canonical Rust binding to whisper.cpp. It vendors
# whisper.cpp under `sys/whisper.cpp/` and exposes cargo features that
# toggle the upstream CMake build flags.
whisper-rs = { version = "0.16.0", default-features = false }
# Direct dependency only for the log hook (`whisper_log_set`/`ggml_log_set`);
# resolved from the same vendor branch as whisper-rs.
whisper-rs-sys = "0.15.0"
parking_lot = "0.12.5"
anyhow = "1.0.102"
[features]
# Pick exactly one acceleration backend per build via WHISPER_CPP_FEATURES.
# CPU is always available (bare `mix compile`); GPU backends are mutually
# exclusive at runtime.
default = []
cuda = ["whisper-rs/cuda"]
hipblas = ["whisper-rs/hipblas"]
vulkan = ["whisper-rs/vulkan"]
metal = ["whisper-rs/metal"]
coreml = ["whisper-rs/coreml"]
intel-sycl = ["whisper-rs/intel-sycl"]
openblas = ["whisper-rs/openblas"]
openmp = ["whisper-rs/openmp"]
[lints.rust]
unsafe_code = "deny"
missing_docs = "warn"
unreachable_pub = "warn"
[lints.clippy]
pedantic = { level = "warn", priority = -1 }
module_name_repetitions = "allow"
missing_errors_doc = "allow"
missing_panics_doc = "allow"
doc_markdown = "allow"
[profile.release]
opt-level = 3
lto = "thin"
codegen-units = 1
# Upstream whisper-rs 0.16.0 (latest release) has two open callback bugs
# (codeberg.org/tazz4843/whisper-rs issues 277/271, fix PR 278) and
# vendors whisper.cpp 1.8.3. The `vendor/whisper-rs-0.16.0-patched`
# branch of this repo carries the published 0.16.0 with the callback
# and CString-leak fixes plus the whisper.cpp submodule at v1.8.6. Drop
# both patches once a whisper-rs release lands the fixes and re-vendors
# (issue #26). Known upstream design holes left untouched (unreachable
# from this crate, which never clones FullParams): cloning a FullParams
# shares the installed closures and grammar pointers across clones.
[patch.crates-io]
whisper-rs = { git = "https://github.com/rubas/whisper_cpp.git", rev = "d5674fcf42bf09f38d880ccaf4084e5bcf769e47" }
whisper-rs-sys = { git = "https://github.com/rubas/whisper_cpp.git", rev = "d5674fcf42bf09f38d880ccaf4084e5bcf769e47" }