gguf

package
v0.0.0-...-bf512eb Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GGMLTypeF32 ggmlType = iota
	GGMLTypeF16
	GGMLTypeQ40
	GGMLTypeQ41
	GGMLTypeQ50 = 6
	GGMLTypeQ51
	GGMLTypeQ80
	GGMLTypeQ81
	GGMLTypeQ2K
	GGMLTypeQ3K
	GGMLTypeQ4K
	GGMLTypeQ5K
	GGMLTypeQ6K
	GGMLTypeQ8K
	GGMLTypeI8
	GGMLTypeI16
	GGMLTypeI32
	GGMLTypeCount
)
View Source
const (
	GGUFMetadataValueTypeUint8 ggufMetadataValueType = iota
	GGUFMetadataValueTypeInt8
	GGUFMetadataValueTypeUint16
	GGUFMetadataValueTypeInt16
	GGUFMetadataValueTypeUint32
	GGUFMetadataValueTypeInt32
	GGUFMetadataValueTypeFloat32
	GGUFMetadataValueTypeBool
	GGUFMetadataValueTypeString
	GGUFMetadataValueTypeArray
	GGUFMetadataValueTypeUint64
	GGUFMetadataValueTypeInt64
	GGUFMetadataValueTypeFloat64
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GGUFFile

type GGUFFile struct {
	Header      GGUFHeader
	MetadataKV  []GGUFMetadataKV
	TensorInfos []GGUFTensorInfo
	Padding     []byte
	TensorData  []byte
}

GGUFFile represents the GGUF file in Go

type GGUFFileReader

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

GGUFFileReader represents a reader for GGUF files

func NewGGUFFileReader

func NewGGUFFileReader(reader io.Reader) *GGUFFileReader

NewGGUFFileReader creates a new GGUFFileReader with the given io.Reader

func (*GGUFFileReader) ReadGGUFFile

func (r *GGUFFileReader) ReadGGUFFile() (*GGUFFile, error)

ReadGGUFFile reads the entire GGUF file from the reader

func (*GGUFFileReader) ReadGGUFHeader

func (r *GGUFFileReader) ReadGGUFHeader() (*GGUFHeader, error)

ReadGGUFHeader reads the GGUF header from the reader

func (*GGUFFileReader) ReadGGUFTensorInfos

func (r *GGUFFileReader) ReadGGUFTensorInfos(count uint64) ([]GGUFTensorInfo, error)

ReadGGUFTensorInfos reads the GGUF tensor infos from the reader

func (*GGUFFileReader) ReadMetadataKVs

func (r *GGUFFileReader) ReadMetadataKVs(count uint64) ([]GGUFMetadataKV, error)

func (*GGUFFileReader) ReadValue

func (r *GGUFFileReader) ReadValue(typ ggufMetadataValueType) (string, error)

type GGUFHeader

type GGUFHeader struct {
	Magic           uint32
	Version         uint32
	TensorCount     uint64
	MetadataKVCount uint64
}

GGUFHeader represents the GGUF header in Go

type GGUFMetadataKV

type GGUFMetadataKV struct {
	Key       string
	ValueType ggufMetadataValueType
	Value     string
}

GGUFMetadataKV represents the GGUF metadata key-value pair in Go

type GGUFString

type GGUFString struct {
	Len    uint64
	String string
}

GGUFString represents the GGUF string in Go

type GGUFTensorInfo

type GGUFTensorInfo struct {
	Name        string
	NDimensions uint32
	Dimensions  []uint64
	Type        ggmlType
	Offset      uint64
}

GGUFTensorInfo represents the GGUF tensor info in Go

Jump to

Keyboard shortcuts

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