Documentation
¶
Index ¶
Constants ¶
const DefaultBaseURL = "https://huggingface.co"
DefaultBaseURL is the public Hugging Face Hub.
Variables ¶
var ErrNotCached = errors.New("file not cached and download not allowed")
ErrNotCached reports a file that is missing from the cache while the caller did not allow a download. Callers wrap it with the config key that gates it.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client downloads repository files. BaseURL and HTTP are overridable in tests.
func NewClient ¶
func NewClient() *Client
NewClient returns a Client for the public Hub. Its transport bounds the response-header wait so a non-responding Hub errors instead of hanging the download - the request context bounds the body read for large models.
func (*Client) EnsureFile ¶
func (c *Client) EnsureFile(ctx context.Context, repo Repo, file, dir, label string, allowDownload bool, report func(string)) (string, error)
EnsureFile returns the local path of file inside dir, downloading it from repo when it is missing and allowDownload is true. A missing file with downloads disallowed yields ErrNotCached. label names the file in progress reports (sent to report, nil for none) and errors (e.g. "whisper model").