partial

package
v1.0.15 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChatTemplatePath

func ChatTemplatePath(i WithLayers) (string, error)

func Config

Config returns the model configuration. Returns *types.Config for Docker format or *modelpack.Model for ModelPack format, without any conversion.

func ConfigArchivePath

func ConfigArchivePath(i WithLayers) (string, error)

func ConfigFile

func ConfigFile(i WithRawConfigFile) (*types.ConfigFile, error)

ConfigFile returns the full Docker format config file (only for Docker format models).

func DDUFPaths added in v1.0.12

func DDUFPaths(i WithLayers) ([]string, error)

func Descriptor

func Descriptor(i WithRawConfigFile) (types.Descriptor, error)

Descriptor returns the types.Descriptor for the model.

func GGUFPaths

func GGUFPaths(i WithLayers) ([]string, error)

func ID

func ID(i WithRawManifest) (string, error)

func MMPROJPath

func MMPROJPath(i WithLayers) (string, error)

func ManifestForLayers

func ManifestForLayers(i WithLayers) (*oci.Manifest, error)

func SafetensorsPaths

func SafetensorsPaths(i WithLayers) ([]string, error)

Types

type BaseModel added in v1.0.3

type BaseModel struct {
	ModelConfigFile types.ConfigFile
	LayerList       []oci.Layer
	// ConfigMediaType specifies the media type for the config descriptor.
	// If empty, defaults to MediaTypeModelConfigV01 for backward compatibility.
	// Set to MediaTypeModelConfigV02 for layer-per-file packaging (FromDirectory).
	ConfigMediaType oci.MediaType
}

BaseModel provides a common implementation for model types. It can be embedded by specific model format implementations (GGUF, Safetensors, etc.)

func (*BaseModel) Config added in v1.0.3

func (m *BaseModel) Config() (types.ModelConfig, error)

func (*BaseModel) ConfigFile added in v1.0.3

func (m *BaseModel) ConfigFile() (*oci.ConfigFile, error)

func (*BaseModel) ConfigName added in v1.0.3

func (m *BaseModel) ConfigName() (oci.Hash, error)

func (*BaseModel) Descriptor added in v1.0.3

func (m *BaseModel) Descriptor() (types.Descriptor, error)

func (*BaseModel) Digest added in v1.0.3

func (m *BaseModel) Digest() (oci.Hash, error)

func (*BaseModel) GetConfigMediaType added in v1.0.14

func (m *BaseModel) GetConfigMediaType() oci.MediaType

GetConfigMediaType returns the config media type for the model. If not set, returns empty string and ManifestForLayers will default to V0.1.

func (*BaseModel) ID added in v1.0.3

func (m *BaseModel) ID() (string, error)

func (*BaseModel) LayerByDiffID added in v1.0.3

func (m *BaseModel) LayerByDiffID(hash oci.Hash) (oci.Layer, error)

func (*BaseModel) LayerByDigest added in v1.0.3

func (m *BaseModel) LayerByDigest(hash oci.Hash) (oci.Layer, error)

func (*BaseModel) Layers added in v1.0.3

func (m *BaseModel) Layers() ([]oci.Layer, error)

func (*BaseModel) Manifest added in v1.0.3

func (m *BaseModel) Manifest() (*oci.Manifest, error)

func (*BaseModel) MediaType added in v1.0.3

func (m *BaseModel) MediaType() (oci.MediaType, error)

func (*BaseModel) RawConfigFile added in v1.0.3

func (m *BaseModel) RawConfigFile() ([]byte, error)

func (*BaseModel) RawManifest added in v1.0.3

func (m *BaseModel) RawManifest() ([]byte, error)

func (*BaseModel) Size added in v1.0.3

func (m *BaseModel) Size() (int64, error)

type Layer

type Layer struct {
	Path string
	oci.Descriptor
}

func NewLayer

func NewLayer(path string, mt oci.MediaType) (*Layer, error)

NewLayer creates a new layer from a file path. The AnnotationFilePath annotation is set to the basename of the file.

func NewLayerWithRelativePath added in v1.0.14

func NewLayerWithRelativePath(path string, relativePath string, mt oci.MediaType) (*Layer, error)

NewLayerWithRelativePath creates a new layer with a custom relative path annotation. The relativePath parameter allows preserving nested directory structure (e.g., "text_encoder/model.safetensors"). This relative path is stored in the AnnotationFilePath annotation and used during unpacking.

func (Layer) Compressed

func (l Layer) Compressed() (io.ReadCloser, error)

func (Layer) DiffID

func (l Layer) DiffID() (oci.Hash, error)

func (Layer) Digest

func (l Layer) Digest() (oci.Hash, error)

func (Layer) GetDescriptor added in v1.0.14

func (l Layer) GetDescriptor() oci.Descriptor

GetDescriptor returns the full descriptor including annotations. This allows accessing the AnnotationFilePath during unpacking.

func (Layer) GetPath added in v1.0.14

func (l Layer) GetPath() string

GetPath returns the local file path of the layer. This is used during unpacking to enable hard linking instead of copying.

func (Layer) MediaType

func (l Layer) MediaType() (oci.MediaType, error)

func (Layer) Size

func (l Layer) Size() (int64, error)

func (Layer) Uncompressed

func (l Layer) Uncompressed() (io.ReadCloser, error)

type WithConfigMediaType added in v1.0.14

type WithConfigMediaType interface {
	GetConfigMediaType() oci.MediaType
}

WithConfigMediaType provides access to the config media type version.

type WithLayers

type WithLayers interface {
	WithRawConfigFile
	Layers() ([]oci.Layer, error)
}

type WithRawConfigFile

type WithRawConfigFile interface {
	// RawConfigFile returns the serialized bytes of this model's config file.
	RawConfigFile() ([]byte, error)
}

type WithRawManifest

type WithRawManifest interface {
	// RawManifest returns the serialized bytes of this model's manifest file.
	RawManifest() ([]byte, error)
}

WithRawManifest defines the subset of types.Model used by these helper methods

Jump to

Keyboard shortcuts

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