compatmigrate

package
v0.40.4 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Overview

Package compatmigrate converts older Ollama-format GGUF manifests already present in a local model store into llama.cpp-compatible manifest-list children.

This exists to bridge the llama-server transition without forcing users to re-pull large models they already have on disk. The first load can still use the temporary llama.cpp compatibility patch, while a best-effort background migration materializes a clean llamacpp child for later loads.

Once manifest-list publishing has been live for enough releases and stale legacy-only local stores are no longer a practical concern, this code should be removed and users with unmigrated local artifacts should re-pull.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureLocalCompatibilityMigration

func EnsureLocalCompatibilityMigration(name model.Name) (bool, error)

func RewriteLlama3MetadataLayer

func RewriteLlama3MetadataLayer(layer manifest.Layer) (manifest.Layer, bool, error)

RewriteLlama3MetadataLayer rewrites a GGUF layer with the legacy Llama 3 tokenizer metadata gap.

func RunnerForManifest

func RunnerForManifest(source model.Name, mf *manifest.Manifest) (string, error)

RunnerForManifest reports the runner a GGUF manifest should carry: ggml when a compatibility detector fires, llamacpp otherwise. It reads GGUF headers only, so it is cheap enough to run whenever a manifest is written.

func SetMigratorsForTesting

func SetMigratorsForTesting(migrators map[string][]Migrator) func()

SetMigratorsForTesting replaces the migration registry for tests.

func StartLocalCompatibilityMigration

func StartLocalCompatibilityMigration(name model.Name) bool

Types

type Migrator

type Migrator interface {
	NeedsMigration(*SourceModel) bool
	Migrate(*SourceModel) (*Result, error)
}

type Result

type Result struct {
	ModelKV           outKV
	ModelTensors      []*outTensor
	ProjectorKV       outKV
	ProjectorTensors  []*outTensor
	PreserveProjector bool

	Renderer string
	Parser   string
	Requires string

	ClearRenderer bool
	ClearParser   bool
}

type SourceModel

type SourceModel struct {
	Source         model.Name
	Manifest       *manifest.Manifest
	Config         model.ConfigV2
	GGUFPath       string
	GGUF           *gguf.File
	GGUFData       io.ReaderAt
	GGUFDataOffset int64

	ProjectorPath       string
	ProjectorGGUF       *gguf.File
	ProjectorData       io.ReaderAt
	ProjectorDataOffset int64
}

func (*SourceModel) Close

func (src *SourceModel) Close() error

Jump to

Keyboard shortcuts

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