types

package
v0.0.0-...-82f30a9 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyInUse   = errors.New("already in use")
	ErrInvalidInput   = errors.New("invalid input")
	ErrInternal       = errors.New("internal error")
	ErrBadRequest     = errors.New("bad request")
	ErrNotFound       = errors.New("not found")
	ErrNotInitialized = errors.New("not initialized")
)

Functions

func ArtifactIDMap

func ArtifactIDMap(artifacts []Artifact) map[string]Artifact

func ArtifactIDs

func ArtifactIDs(artifacts []Artifact) []string

func IsValidContentType

func IsValidContentType(contentType string) bool

func NewAlreadyInUseErr

func NewAlreadyInUseErr(s string) error

func NewBadRequest

func NewBadRequest(s string) error

func NewInternalErr

func NewInternalErr(s string) error

func NewInvalidInputErr

func NewInvalidInputErr(s string) error

func NewNotFoundErr

func NewNotFoundErr(s string) error

func NormalizeID

func NormalizeID(s string) string

func ParseVal

func ParseVal(s string) any

func UniqueMetrics

func UniqueMetrics(runs []*Run) []string

Types

type Artifact

type Artifact interface {
	Name() string
	Content() []byte
	ContentType() ContentType
}

func NewArtifact

func NewArtifact(name string, contentType string, content []byte) (Artifact, error)

type CheckpointArtifact

type CheckpointArtifact struct {
	Model      string
	Checkpoint []byte
}

func (CheckpointArtifact) Content

func (c CheckpointArtifact) Content() []byte

func (CheckpointArtifact) ContentType

func (c CheckpointArtifact) ContentType() ContentType

func (CheckpointArtifact) Name

func (c CheckpointArtifact) Name() string

type ContentType

type ContentType string
const (
	TextContentType  ContentType = "content-type/text"
	ModelContentType ContentType = "content-type/model"
)

type Experiment

type Experiment struct {
	Name string
	Runs []*Run
}

type GenericMetric

type GenericMetric[T cmp.Ordered] struct {
	Key    string
	Values []T
	// contains filtered or unexported fields
}

func NewGenericMetric

func NewGenericMetric[T cmp.Ordered](key string, sizeAlloc int) *GenericMetric[T]

func (*GenericMetric[T]) Add

func (s *GenericMetric[T]) Add(v T)

func (*GenericMetric[T]) AddVal

func (s *GenericMetric[T]) AddVal(v any)

func (*GenericMetric[T]) Commit

func (s *GenericMetric[T]) Commit()

func (*GenericMetric[T]) LastVal

func (s *GenericMetric[T]) LastVal() any

func (GenericMetric[T]) Name

func (s GenericMetric[T]) Name() string

func (*GenericMetric[T]) SetVals

func (s *GenericMetric[T]) SetVals(vs []any)

func (*GenericMetric[T]) Type

func (s *GenericMetric[T]) Type() MetricType

Type infers the MetricType using reflection. If the metric has multiple values it can either be a ContinuousMetric (numerical) or a MultiValueMetric. In the case where no value is present or a single value is present, it can be SingleMetric or SingleNumericMetric.

func (*GenericMetric[T]) UnCommited

func (s *GenericMetric[T]) UnCommited() []T

func (GenericMetric[T]) Vals

func (s GenericMetric[T]) Vals() []any

func (GenericMetric[T]) ValsToCommit

func (s GenericMetric[T]) ValsToCommit() []any

type Metric

type Metric interface {
	Name() string
	Vals() []any
	SetVals(vs []any)
	ValsToCommit() []any
	Commit()
	LastVal() any
	AddVal(v any)
	Type() MetricType
}

type MetricType

type MetricType string
const (
	ContinuousMetric    MetricType = "metric/continuous"
	MultiValueMetric    MetricType = "metric/multival"
	SingleNumericMetric MetricType = "metric/single-numeric"
	SingleMetric        MetricType = "metric/single"
	ComplexMetric       MetricType = "metric/complex"
)

func CollectMetric

func CollectMetric(runs []*Run, metric string) (map[string]any, MetricType)

type ModelEntry

type ModelEntry struct {
	URL  string
	Tags []string
	Name string
}

type ModelRegistry

type ModelRegistry struct {
	Name   string
	Models []ModelEntry
	Tags   map[string][]int
}

func NewModelRegistry

func NewModelRegistry(name string) *ModelRegistry

func (*ModelRegistry) Add

func (m *ModelRegistry) Add(url string, tags ...string)

Add registers a model checkpoint with a highest version number. Additional tags can be supplied such (`latest`, `prod`, `dev`)

func (*ModelRegistry) AddTag

func (m *ModelRegistry) AddTag(tag string, version int) error

func (ModelRegistry) LastModel

func (m ModelRegistry) LastModel() ModelEntry

func (ModelRegistry) LatestVersion

func (m ModelRegistry) LatestVersion() int

func (ModelRegistry) MarshalEntries

func (m ModelRegistry) MarshalEntries() ([][]byte, error)

func (ModelRegistry) ModelByTag

func (m ModelRegistry) ModelByTag(tag string) (ModelEntry, error)

func (ModelRegistry) ModelByVersion

func (m ModelRegistry) ModelByVersion(version int) (ModelEntry, error)

func (ModelRegistry) ModelsByTag

func (m ModelRegistry) ModelsByTag(tag string) ([]ModelEntry, error)

func (ModelRegistry) VersionTag

func (m ModelRegistry) VersionTag(version int) string

type PlainTextArtifact

type PlainTextArtifact struct {
	FileName    string
	FileContent string
}

func (PlainTextArtifact) Content

func (p PlainTextArtifact) Content() []byte

func (PlainTextArtifact) ContentType

func (p PlainTextArtifact) ContentType() ContentType

func (PlainTextArtifact) Name

func (p PlainTextArtifact) Name() string

type Run

type Run struct {
	Name         string
	Timestamp    time.Time
	ExperimentID string
	Metrics      map[string]Metric
	Artifacts    map[string]Artifact
}

func NewRun

func NewRun(name string, expID string) Run

func (Run) AddAritifact

func (r Run) AddAritifact(name string, a Artifact) error

func (*Run) AddMetric

func (r *Run) AddMetric(name string, m Metric) error

func (Run) ArtifactsSlice

func (r Run) ArtifactsSlice() []Artifact

type SavedArtifact

type SavedArtifact struct {
	Name        string
	ContentType ContentType
	S3Key       string
}

Jump to

Keyboard shortcuts

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