pack

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package pack builds ModelPack artifacts from GGUF or safetensors weights. Either format's metadata lands in one modelmeta.Info record, and the model config carries the format for everything downstream (ADR-0012). What depends on the format here is the metadata readers, the gathering of the files a model consists of, and the refusal of an input set that mixes the two.

Packing is reproducible (see docs/architecture.md, "Artifact format"): layer ordering is fixed (weights, then weight-configs, then docs, each sorted by artifact path), config and manifest JSON contain no timestamps, and identical inputs therefore yield identical digests on every run.

Two profiles ship the same content in two envelopes: the primary "artifact" profile (raw weight layers, which a GGUF model is served from in place in the store) and the secondary "car" profile (a single-tar-layer OCI image for Kubernetes image volumes and KServe modelcars).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Car

func Car(ctx context.Context, st *store.Store, files []File, ref string, opts Options) (ocispec.Descriptor, error)

Car packs the same inputs as an OCI *image* with a single uncompressed tar layer (see docs/architecture.md, "Artifact format"): containerd-based image volumes and KServe modelcars mount images, not raw artifacts. The tar is deterministic (sorted entries, zeroed timestamps, fixed ownership) and uncompressed, so identical inputs give identical digests.

The image config pins linux/amd64: the payload is architecture-neutral data, but image tooling requires a platform.

func Model

func Model(ctx context.Context, st *store.Store, files []File, ref string, opts Options) (ocispec.Descriptor, error)

Model packs files into st as a ModelPack artifact tagged ref and returns the manifest descriptor.

Types

type File

type File struct {
	// Path is the source file on disk.
	Path string
	// Name is the path recorded in the artifact (org.cncf.model.filepath);
	// defaults to the basename of Path.
	Name string
	// Kind classifies the layer; zero means auto-detect from the name.
	Kind modelspec.LayerKind
}

File is one input to pack.

type Options

type Options struct {
	// SourceURL becomes org.opencontainers.image.source.
	SourceURL string
	// License (SPDX expression) overrides the GGUF header's general.license.
	License string
	// ServeDefaults, when non-nil, is embedded as io.palan.serve.defaults.
	ServeDefaults *modelspec.ServeDefaults
	// OriginSHA256 records the SHA-256 of the original upstream file
	// (io.palan.origin.sha256); defaults to the primary weight digest, which
	// is identical for raw packing.
	OriginSHA256 string
}

Options carries pack-time metadata.

Jump to

Keyboard shortcuts

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