Skip to main content

Crate tpt_hf_hub

Crate tpt_hf_hub 

Source
Expand description

Async Hugging Face Hub downloader and cache manager.

HubClient downloads files from a Hugging Face Hub compatible server into an XDG-style local cache (~/.cache/tpt/hub by default), with:

  • Resumable downloads via HTTP Range requests
  • SHA256 verification against the Hub’s linked ETag, when available
  • Atomic writes (download to *.tmp, rename on success)
  • A ProgressReporter trait so callers can plug in their own UI
use tpt_hf_hub::{HubClient, NoopProgressReporter};

let client = HubClient::new()?;
let path = client
    .download_file("gpt2", "config.json", &NoopProgressReporter)
    .await?;
println!("downloaded to {}", path.display());

Structs§

HubClient
Async client for downloading and caching files from a Hugging Face Hub compatible server.
NoopProgressReporter
A ProgressReporter that discards all events.

Enums§

HubError
Errors that can occur while resolving, downloading, or caching Hub files.

Traits§

ProgressReporter
Receives progress events for a download.

Functions§

default_cache_dir
Resolves the default cache root for tpt-hf-hub.