coreml

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package coreml provides an Embedder that runs models directly via Apple's CoreML framework, bypassing ONNX Runtime. This gives full ANE (Apple Neural Engine) utilization on supported models.

macOS only. On other platforms, Open returns an error.

The Objective-C bridge (bridge_darwin.m) calls CoreML's MLModel API through CGO. The model must be in .mlpackage or .mlmodelc format — use coremltools to convert from ONNX/PyTorch.

Usage:

ckv build --embedder=coreml --model-dir=./models/bge-m3.mlpackage

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter implements types.Embedder via CoreML Framework. Only available on macOS (darwin) builds.

func Open

func Open(opts Options) (*Adapter, error)

Open returns an error on non-macOS platforms.

func (*Adapter) Close

func (a *Adapter) Close() error

func (*Adapter) Dimension

func (a *Adapter) Dimension() int

func (*Adapter) Embed

func (a *Adapter) Embed(_ context.Context, _ []string) ([][]float32, error)

func (*Adapter) Identity

func (a *Adapter) Identity() types.EmbeddingIdentity

func (*Adapter) MaxInputTokens

func (a *Adapter) MaxInputTokens() int

func (*Adapter) Name

func (a *Adapter) Name() string

type Options

type Options struct {
	ModelPath     string // path to .mlpackage or .mlmodelc directory
	TokenizerPath string // path to tokenizer.json (required for inference)
	ModelName     string // display name for manifest
	Dim           int    // output vector dimension (must match model)
	MaxSeqLen     int    // max sequence length for tokenization (default 512)
}

Options configures the CoreML adapter.

Jump to

Keyboard shortcuts

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