pub struct Hub { /* private fields */ }Expand description
A Hub client: the base URL and this node’s token.
Implementations§
Source§impl Hub
impl Hub
Sourcepub fn new(url: impl Into<String>) -> Self
pub fn new(url: impl Into<String>) -> Self
The Hub at url (such as HUB or a mirror), without a token.
Sourcepub fn with_token(self, token: Option<HfToken>) -> Self
pub fn with_token(self, token: Option<HfToken>) -> Self
Sends token with requests (gated and private repos).
pub fn url(&self) -> &str
pub fn has_token(&self) -> bool
Sourcepub fn search(&self, search: &Search) -> Result<Vec<SearchHit>>
pub fn search(&self, search: &Search) -> Result<Vec<SearchHit>>
Repos matching the search, most downloaded first.
Sourcepub fn repo_files(&self, repo: &str) -> Result<Vec<RepoFile>>
pub fn repo_files(&self, repo: &str) -> Result<Vec<RepoFile>>
The GGUF model files of repo (see repo_files). Adapters are still in this list;
Hub::models leaves them out.
Sourcepub fn models(&self, repo: &str) -> Result<Vec<RepoModel>>
pub fn models(&self, repo: &str) -> Result<Vec<RepoModel>>
The downloadable models of repo, split files grouped (group_files). Adapters are
left out: a file whose name hints at one (adapter_hint) has its header read, and is
dropped when the header says general.type = adapter.
Sourcepub fn gguf_info(&self, repo: &str, file: &str) -> Result<GgufInfo>
pub fn gguf_info(&self, repo: &str, file: &str) -> Result<GgufInfo>
The header of file in repo (its first gguf::HEADER_LIMIT bytes at most, through a
Range request), for KV sizing. For a split model pass its first part. Fails on adapters;
see Hub::gguf_header.
Sourcepub fn gguf_header(&self, repo: &str, file: &str) -> Result<GgufHeader>
pub fn gguf_header(&self, repo: &str, file: &str) -> Result<GgufHeader>
The header of file in repo, of any kind (gguf::read_header): whether it is a model
or an adapter, its architecture and base model.
Sourcepub fn adapters(&self, repo: &str) -> Result<Vec<RepoAdapter>>
pub fn adapters(&self, repo: &str) -> Result<Vec<RepoAdapter>>
The LoRA adapters in repo: GGUF files whose header says general.type = adapter and
adapter.type = lora (files with an adapter_hint in the name, or every GGUF when
the repo’s tags mark it as an adapter), and PEFT directories (an adapter_config.json
with peft_type LORA next to adapter_model.safetensors or adapter_model.bin). Sorted
by id.