common

package
v0.0.0-...-7b461c4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	THRESHOLD_EXACT = 0
	THRESHOLD_F32   = 1e-3
	THRESHOLD_BF16  = 1e-2
)

Variables

This section is empty.

Functions

func AlmostEqualFloat32

func AlmostEqualFloat32(a float32, b float32, threshold float64) bool

func DetermineMachineEndian

func DetermineMachineEndian() string

func FriendlyPanic

func FriendlyPanic(err error)

func InterfaceArrToIntArr

func InterfaceArrToIntArr(arr []interface{}) ([]int, error)

func InterfaceToBool

func InterfaceToBool(val interface{}, defaultValue bool) bool

func InterfaceToInt

func InterfaceToInt(val interface{}) (int, error)

func WaitGroupDone

func WaitGroupDone(wg *sync.WaitGroup) chan struct{}

Types

type InferenceArgs

type InferenceArgs struct {
	SequenceLength int // text context, 0 = from model
}

func NewInferenceArgs

func NewInferenceArgs() InferenceArgs

type Logger

type Logger struct {
	// contains filtered or unexported fields
}
var GLogger *Logger

func NewLogger

func NewLogger(consoleWriter io.Writer, debugWriter io.Writer) (*Logger, error)

func (*Logger) Close

func (l *Logger) Close()

func (*Logger) ConsoleFatal

func (l *Logger) ConsoleFatal(v ...any)

func (*Logger) ConsolePrintf

func (l *Logger) ConsolePrintf(format string, v ...any)

func (*Logger) DebugPrintf

func (l *Logger) DebugPrintf(format string, v ...any)

type MemoryMapper

type MemoryMapper struct {
	FilePath string
	Size     int64

	Data []byte
}

func NewMemoryMapper

func NewMemoryMapper(filePath string) (*MemoryMapper, error)

func (*MemoryMapper) Unmap

func (mm *MemoryMapper) Unmap() error

Jump to

Keyboard shortcuts

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