huggingface

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package huggingface owns the current Machine Learning layout used by Hugging Face model and dataset repositories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeferReindex

func DeferReindex(ctx context.Context) context.Context

DeferReindex lets a native multi-file commit publish its snapshot before rebuilding the package index once inside the same transaction.

func FilePath

func FilePath(s string) bool

FilePath refuses traversal and control characters while preserving valid Unicode filenames used by model repositories.

func IsXetPath

func IsXetPath(path string) bool

func RefName

func RefName(s string) bool

RefName is the documented branch/tag grammar. A ref points to an immutable full revision; its name is never interpreted as a filesystem traversal.

func RefPath

func RefPath(id Identity, name string) (string, bool)

func Revision

func Revision(s string) bool

Revision accepts immutable full commit IDs. main is a mutable ref resolved before a snapshot path is built. The wire permits a branch or tag name, but only a published ref is resolved; it is never treated as a file-system path.

func Serves

func Serves(t repo.PackageType) bool

func SnapshotPath

func SnapshotPath(id Identity, revision, file string) (string, bool)

SnapshotPath returns the canonical item path for one file.

func ValidXetPath

func ValidXetPath(path string) bool

func XetWrite

func XetWrite(ctx context.Context) context.Context

XetWrite marks a validated CAS publication; HTTP properties cannot opt in.

Types

type Handler

type Handler struct{ generic.Handler }

func (Handler) Admit

func (Handler) Admit(
	ctx context.Context,
	_ format.Env,
	c repo.Config,
	w format.Write,
) (format.Write, error)

func (Handler) Classify

func (Handler) Classify(_ repo.Config, path string) format.Class

func (Handler) Deleted

func (h Handler) Deleted(
	ctx context.Context,
	env format.Env,
	c repo.Config,
	removed []types.Item,
) error

func (Handler) Deleting

func (Handler) Deployed

func (h Handler) Deployed(ctx context.Context, env format.Env, c repo.Config, it types.Item) error

func (Handler) GuardTransferSource

func (Handler) GuardTransferSource(
	_ context.Context,
	_ format.Env,
	_ repo.Config,
	it types.Item,
) error

func (Handler) Reindex

func (Handler) Reindex(ctx context.Context, env format.Env, c repo.Config) error

Reindex reconstructs the native package/version view from committed snapshot files. A delete, restore or move cannot leave a stale revision.

func (Handler) Resolve

func (Handler) Resolve(
	_ context.Context,
	_ format.Env,
	_ repo.Config,
	d format.Download,
) (string, error)

type Identity

type Identity struct {
	Kind, Owner, Name string
}

Identity is one model or dataset in the current ML layout.

func ParseIdentity

func ParseIdentity(kind, owner, name string) (Identity, bool)

ParseIdentity accepts the names documented for Artifactory's Hugging Face repositories. A model and a dataset with the same Hub ID stay disjoint.

func ParseRefPath

func ParseRefPath(path string) (Identity, string, bool)

func ParseSnapshotPath

func ParseSnapshotPath(p string) (Identity, string, string, bool)

ParseSnapshotPath is shared by the format hook, native client routes and lifecycle reindex. It never accepts the superseded legacy layout.

func (Identity) Prefix

func (id Identity) Prefix() string

func (Identity) RepoID

func (id Identity) RepoID() string

Directories

Path Synopsis
Package xet validates the public Hugging Face Xet chunk and shard wire formats.
Package xet validates the public Hugging Face Xet chunk and shard wire formats.

Jump to

Keyboard shortcuts

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