huggingface

package
v0.228.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultBaseURL = "https://huggingface.co"

DefaultBaseURL is the public Hugging Face Hub.

Variables

View Source
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

type Client struct {
	BaseURL string
	HTTP    *http.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.

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").

type Repo

type Repo struct {
	ID       string
	Revision string
}

Repo identifies a model repository on the Hub, e.g. "ggerganov/whisper.cpp". An empty Revision means "main"; set a commit SHA to pin the files.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL