distribution/

directory
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: Apache-2.0, Apache-2.0

README

Model Distribution

A Go library for distributing models using container registries.

Overview

Model Distribution is a Go library that allows you to package, push, pull, and manage models using container registries. It provides a simple API for working with models in GGUF and Safetensors format.

Features

  • Push models to container registries
  • Pull models from container registries
  • Local model storage
  • Model metadata management
  • Support for both GGUF and Safetensors model formats

Usage

import (
    "context"
    "github.com/docker/model-runner/pkg/distribution/distribution"
)

// Create a new client
client, err := distribution.NewClient(
    distribution.WithStoreRootPath("/path/to/cache"),
)
if err != nil {
    // Handle error
}

// Pull a model
err = client.PullModel(context.Background(), "registry.example.com/models/llama:v1.0", os.Stdout)
if err != nil {
    // Handle error
}

// Get a model
model, err := client.GetModel("registry.example.com/models/llama:v1.0")
if err != nil {
    // Handle error
}

// Create a bundle
bundle, err := client.GetBundle("registry.example.com/models/llama:v1.0")
if err != nil {
    // Handle error
}

// Get the GGUF file path within the bundle
modelPath, err := bundle.GGUFPath()
if err != nil {
    // Handle error
}

fmt.Println("Model path:", modelPath)

// List all models
models, err := client.ListModels()
if err != nil {
    // Handle error
}

// Delete a model
_, err = client.DeleteModel("registry.example.com/models/llama:v1.0", false)
if err != nil {
    // Handle error
}

// Tag a model
err = client.Tag("registry.example.com/models/llama:v1.0", "registry.example.com/models/llama:latest")
if err != nil {
    // Handle error
}

// Push a model
err = client.PushModel(context.Background(), "registry.example.com/models/llama:v1.0", nil)
if err != nil {
    // Handle error
}

Directories

Path Synopsis
Package files provides utilities for classifying and working with model files.
Package files provides utilities for classifying and working with model files.
Package format provides a unified interface for handling different model formats.
Package format provides a unified interface for handling different model formats.
internal
Package modelpack provides native support for CNCF ModelPack format models.
Package modelpack provides native support for CNCF ModelPack format models.
oci
Package oci provides OCI-compatible types for model distribution.
Package oci provides OCI-compatible types for model distribution.
authn
Package authn provides authentication support for registry operations.
Package authn provides authentication support for registry operations.
reference
Package reference provides image reference parsing using the distribution/reference library.
Package reference provides image reference parsing using the distribution/reference library.
remote
Package remote provides registry operations using containerd's remotes.
Package remote provides registry operations using containerd's remotes.
testregistry
Package testregistry provides a simple in-memory OCI registry for testing.
Package testregistry provides a simple in-memory OCI registry for testing.

Jump to

Keyboard shortcuts

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