weights

package
v0.14.7 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const WEIGHT_FILE = "weights.json"
View Source
const WEIGHT_FILE_SIZE_EXCLUSION = 1024 * 1024
View Source
const WEIGHT_FILE_SIZE_INCLUSION = 128 * 1024 * 1024

Variables

View Source
var WEIGHT_FILE_EXCLUSIONS = []string{
	".gif",
	".ipynb",
	".jpeg",
	".jpg",
	".log",
	".mp4",
	".png",
	".svg",
	".webp",
}
View Source
var WEIGHT_FILE_INCLUSIONS = []string{
	".ckpt",
	".h5",
	".onnx",
	".pb",
	".pbtxt",
	".pt",
	".pth",
	".safetensors",
	".tflite",
}

Functions

func FindWeights

func FindWeights(fw FileWalker) ([]string, []string, error)

Types

type FileWalker

type FileWalker func(root string, walkFn filepath.WalkFunc) error

FileWalker is a function type that walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root.

type Manifest added in v0.8.3

type Manifest struct {
	Files map[string]Metadata `json:"files"`
}

Manifest contains metadata about weights files in a model

func LoadManifest added in v0.8.3

func LoadManifest(filename string) (*Manifest, error)

LoadManifest loads a manifest from a file

func NewManifest added in v0.8.3

func NewManifest() *Manifest

NewManifest creates a new manifest

func (*Manifest) AddFile added in v0.8.3

func (m *Manifest) AddFile(path string) error

AddFile adds a file to the manifest, calculating its CRC32 checksum

func (*Manifest) Equal added in v0.8.3

func (m *Manifest) Equal(other *Manifest) bool

Equal compares the files in two manifests for strict equality

func (*Manifest) Save added in v0.8.3

func (m *Manifest) Save(filename string) error

Save saves a manifest to a file

type Metadata added in v0.8.3

type Metadata struct {
	// CRC32 is the CRC32 checksum of the file encoded as a hexadecimal string
	CRC32 string `json:"crc32"`
}

Metadata contains information about a file

type Weight added in v0.14.0

type Weight struct {
	Path      string    `json:"path"`
	Digest    string    `json:"digest"`
	Timestamp time.Time `json:"timestamp"`
	Size      int64     `json:"size"`
}

func FindFastWeights added in v0.14.0

func FindFastWeights(folder string, tmpDir string) ([]Weight, error)

func ReadFastWeights added in v0.14.0

func ReadFastWeights(tmpDir string) ([]Weight, error)

type WeightManifest added in v0.14.4

type WeightManifest struct {
	Source      string `json:"source"`
	Destination string `json:"destination"`
}

Jump to

Keyboard shortcuts

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