Expand description
Local-directory voxora_traits::ModelSource for the voxora
model-agnostic ASR bridge.
This crate ships two voxora_traits::ModelSource
implementations targeted at offline-friendly consumer flows:
LocalSource— resolves a model id (e.g."some-org/some-repo/model.bin") against an already-vendored directory on disk. No network, no tokio, no reqwest, novoxora-config. Reads only what the caller asks for.ChainedSource— first-hit-wins adapter that tries a primary source and falls back to a secondary source onvoxora_traits::AsrError::ModelNotFound. Useful for the “local first, Hugging Face on miss” composition.
§Use cases
- Vendored weights — operators who ship model artefacts
with their binary can resolve them via
LocalSourcewithout a HF token, a cache directory, or outbound network. The matching engine (e.g.voxora_whisper::WhisperEngineorvoxora_qwen3asr::QwenAsrEngine) loads the result ofLocalSource::resolvedirectly fromModelDir::entry— no registry needed. Neither engine crate is re-exported fromvoxora-local; reference them directly from yourCargo.tomlwhen you wire an engine against aLocalSource. - Hermetic CI — every test lane that wants a deterministic
ModelSourcecan wire aLocalSourceagainst atempdirpre-populated bycargobuild scripts. No wiremock, no live HF download, no flake. - Local-first registry — wrap
ChainedSource::new(LocalSource::new("/srv/models"), HuggingFaceSource::new()?)and hand the result tovoxora_registry::Registry::new. Local artefacts win; only misses go on the wire.
§Example
use voxora_local::LocalSource;
use voxora_traits::{ModelSource, ResolveOptions};
let source = LocalSource::new("/srv/models");
let dir = source
.resolve("some-org/some-repo/model.bin", &ResolveOptions::default())
.await?;
println!("model at {}", dir.entry.expect("entry").display());§Engine integration
Engines consume voxora_traits::ModelDir directly:
voxora_whisper::WhisperEngine::loadreadsModelDir::entry(or falls back to lex-sortingModelDir::pathifentryisNone). ALocalSource-resolved dir works unchanged.voxora_qwen3asr::QwenAsrEngine::loadreadsModelDir::pathand looks for the canonical Qwen3-ASR file trio inside it; pass the resolvedpathstraight through. Neither crate is re-exported fromvoxora-local; reference them directly from yourCargo.tomlif you wire an engine against aLocalSource.
§Limitations
- No recursive walker.
LocalSource::resolvejoinsmodel_idagainstrootwith a singlePathBuf::joincall and checksis_file(). Vendored trees that spread weights across nested directories are out of scope; callers wanting that should compose their own walker. voxora-registrySourceKind::Localarm is a follow-up.voxora-registry’s built-in descriptors only match HF ids today. TheChainedSourceadapter in this crate is the pattern that honours “local first” without forcing a registry refactor; pass it toRegistry::newand the chain is transparent. A future “registry: extend built-in descriptors to acceptSourceKind::Localids” change would close the loop.
§Cargo features
This crate has no Cargo features. The whole point of the
voxora-local crate is to stay minimal — adding a feature would
re-introduce the HF-token / cache-root cascade that
voxora-hf already owns.
Structs§
- Chained
Source - A
voxora_traits::ModelSourceadapter that triesprimaryfirst and falls back tofallbackwhenprimaryreports a model miss. - Local
Source - A
voxora_traits::ModelSourcethat resolves model ids against a directory already on disk.