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
Rangerequests - SHA256 verification against the Hub’s linked ETag, when available
- Atomic writes (download to
*.tmp, rename on success) - A
ProgressReportertrait 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.
- Noop
Progress Reporter - A
ProgressReporterthat discards all events.
Enums§
- HubError
- Errors that can occur while resolving, downloading, or caching Hub files.
Traits§
- Progress
Reporter - Receives progress events for a download.
Functions§
- default_
cache_ dir - Resolves the default cache root for
tpt-hf-hub.