Skip to main content

is_model_cached

Function is_model_cached 

Source
fn is_model_cached(
    cache_dir: &Path,
    repo_id: &str,
    revision: &str,
    onnx_filename: &str,
) -> bool
Expand description

Returns true when the primary ONNX model file already exists in the hf-hub snapshot cache, meaning repo.get() will return immediately without fetching from the network.

hf-hub 0.5.x layout when constructed with ApiBuilder::with_cache_dir(p): {p}/models--{owner}--{name}/snapshots/{revision}/{filename}

Note: this differs from Python huggingface_hub, which appends a hub/ segment when HF_HOME is set. The Rust crate treats with_cache_dir as HF_HUB_CACHE directly — no hub/ subdirectory is added.