scanner

package
v0.0.0-...-67450be Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EstimateParamCount

func EstimateParamCount(fileSize int64, quant model.QuantType) int64

EstimateParamCount estimates parameter count from file size and quantization.

func EstimateSafeTensorsBytes

func EstimateSafeTensorsBytes(meta *model.SafeTensorsMetadata) int64

EstimateSafeTensorsBytes estimates total tensor data size from metadata.

func EstimateVRAM

func EstimateVRAM(info *model.ModelInfo) float64

EstimateVRAM estimates the VRAM required for inference in GB.

func FormatParamCount

func FormatParamCount(params int64) string

FormatParamCount formats a parameter count as "7B", "1.5B", "70B", etc.

func IsGGUF

func IsGGUF(filePath string) bool

IsGGUF checks if a file starts with the GGUF magic number.

func MetadataKeysByPrefix

func MetadataKeysByPrefix(raw map[string]any, prefix string) []string

MetadataKeysByPrefix returns all raw metadata keys matching a prefix.

func ParseGGUF

func ParseGGUF(filePath string) (*model.GGUFMetadata, error)

ParseGGUF reads a GGUF file header and metadata without reading tensor data.

func ParseSafeTensors

func ParseSafeTensors(filePath string) (*model.SafeTensorsMetadata, error)

ParseSafeTensors reads a SafeTensors file header and returns metadata.

Types

type AppDefinition

type AppDefinition struct {
	Name         model.SourceApp
	SearchPaths  func(homeDir string) []string
	FilePatterns []string
	// ManifestBased means we discover models through manifests (Ollama).
	ManifestBased bool
}

AppDefinition describes how to find models for a specific AI application.

func KnownApps

func KnownApps() []AppDefinition

KnownApps returns definitions for all supported AI applications.

type ContextVRAM

type ContextVRAM struct {
	Context uint64
	Total   float64
	Model   float64
	KVCache float64
}

ContextVRAM holds VRAM estimates for a specific context length.

type DiscoveredFile

type DiscoveredFile struct {
	Path      string
	Source    model.SourceApp
	ModelName string
}

DiscoveredFile represents a raw found file before parsing.

func DiscoverOllamaModels

func DiscoverOllamaModels(baseDir string) ([]DiscoveredFile, error)

DiscoverOllamaModels discovers models by reading Ollama manifests.

type OllamaLayer

type OllamaLayer struct {
	MediaType string `json:"mediaType"`
	Digest    string `json:"digest"`
	Size      int64  `json:"size"`
}

OllamaLayer represents a layer in an Ollama manifest.

type OllamaManifest

type OllamaManifest struct {
	SchemaVersion int           `json:"schemaVersion"`
	MediaType     string        `json:"mediaType"`
	Config        OllamaLayer   `json:"config"`
	Layers        []OllamaLayer `json:"layers"`
}

OllamaManifest represents the Ollama manifest JSON structure.

type ScanError

type ScanError struct {
	Path   string
	Source model.SourceApp
	Err    error
}

ScanError represents a non-fatal scan error.

type ScanOptions

type ScanOptions struct {
	ExtraPaths   []string
	SkipApps     []model.SourceApp
	Concurrency  int
	ProgressFunc func(scanned, total int, current string)
}

ScanOptions configures the scanner.

type ScanResult

type ScanResult struct {
	Models    []model.ModelInfo
	Errors    []ScanError
	Duration  time.Duration
	AppsFound map[model.SourceApp]int
}

ScanResult holds the complete scan output.

type Scanner

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

Scanner performs model discovery and parsing.

func New

func New(opts ScanOptions) *Scanner

New creates a Scanner.

func (*Scanner) Scan

func (s *Scanner) Scan() (*ScanResult, error)

Scan performs the full discovery and parsing pipeline.

type VRAMTableRow

type VRAMTableRow struct {
	Quant       string
	BPW         float64
	ContextVRAM []ContextVRAM
}

VRAMTableRow represents one row of the VRAM estimation table.

func VRAMContextTable

func VRAMContextTable(info *model.ModelInfo) []VRAMTableRow

VRAMContextTable generates a VRAM estimation table for different context sizes, similar to the screenshot reference. Returns rows of [quant, BPW, ctx2k, ctx8k, ...].

Jump to

Keyboard shortcuts

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