Documentation
¶
Index ¶
- type Data
- type Loadable
- type ModelInfo
- type ModelStorage
- type Saveable
- type Storage
- func (s *Storage) GetAllTaskStats() map[string]*TaskData
- func (s *Storage) GetTaskStats(task string) *TaskData
- func (s *Storage) IsDirty() bool
- func (s *Storage) Load() error
- func (s *Storage) MarkDirty()
- func (s *Storage) Save() error
- func (s *Storage) Start(ctx context.Context)
- func (s *Storage) Stop() error
- func (s *Storage) TaskCount() int
- func (s *Storage) UpdateTaskStats(task string, count int64, cpuDelta, memDelta, gpuDelta, vramDelta float64)
- type TaskData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data struct {
Version int `json:"version"`
UpdatedAt time.Time `json:"updated_at"`
TaskStats map[string]*TaskData `json:"task_stats"`
}
Data represents the persisted data structure.
type ModelInfo ¶
type ModelInfo struct {
Exists bool `json:"exists"`
Path string `json:"path"`
Size int64 `json:"size,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
ModelInfo returns information about the saved model.
type ModelStorage ¶
type ModelStorage struct {
// contains filtered or unexported fields
}
ModelStorage handles persistence of prediction models.
func NewModelStorage ¶
func NewModelStorage(s *Storage) *ModelStorage
NewModelStorage creates a new ModelStorage.
func (*ModelStorage) DeleteModel ¶
func (ms *ModelStorage) DeleteModel() error
DeleteModel deletes the saved model file.
func (*ModelStorage) GetModelInfo ¶
func (ms *ModelStorage) GetModelInfo() ModelInfo
GetModelInfo returns information about the saved model.
func (*ModelStorage) LoadModel ¶
func (ms *ModelStorage) LoadModel(model Loadable) error
LoadModel loads a model from disk.
func (*ModelStorage) ModelExists ¶
func (ms *ModelStorage) ModelExists() bool
ModelExists returns whether a saved model exists.
func (*ModelStorage) SaveModel ¶
func (ms *ModelStorage) SaveModel(model Saveable) error
SaveModel saves a model to disk.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage handles persistence of learning data.
func (*Storage) GetAllTaskStats ¶
GetAllTaskStats returns statistics for all tasks.
func (*Storage) GetTaskStats ¶
GetTaskStats returns statistics for a specific task.
func (*Storage) MarkDirty ¶
func (s *Storage) MarkDirty()
MarkDirty marks data as needing to be saved.
func (*Storage) Stop ¶
Stop stops the periodic flush and saves final state. Multiple calls to Stop are safe and idempotent.
type TaskData ¶
type TaskData struct {
Task string `json:"task"`
Count int64 `json:"count"`
AvgCPUDelta float64 `json:"avg_cpu_delta"`
AvgMemDelta float64 `json:"avg_mem_delta"`
AvgGPUDelta float64 `json:"avg_gpu_delta,omitempty"`
AvgVRAMDelta float64 `json:"avg_vram_delta,omitempty"`
}
TaskData represents persisted statistics for a task type.