project

package
v0.0.0-...-e8b1e36 Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const IDLength = 64

Variables

This section is empty.

Functions

func CreateHeartbeat

func CreateHeartbeat(repo repository.Repository, experimentID string, t time.Time) error

func DeleteHeartbeat

func DeleteHeartbeat(repo repository.Repository, experimentID string) error

Types

type Checkpoint

type Checkpoint struct {
	ID            string         `json:"id"`
	Created       time.Time      `json:"created"`
	Metrics       param.ValueMap `json:"metrics"`
	Step          int64          `json:"step"`
	Path          string         `json:"path"`
	PrimaryMetric *PrimaryMetric `json:"primary_metric"`
}

Checkpoint is a snapshot of an experiment's filesystem

func NewCheckpoint

func NewCheckpoint(metrics param.ValueMap) *Checkpoint

NewCheckpoint creates a checkpoint with default values

func (*Checkpoint) ShortID

func (c *Checkpoint) ShortID() string

func (*Checkpoint) SortedMetrics

func (c *Checkpoint) SortedMetrics() []*NamedParam

func (*Checkpoint) StorageTarPath

func (c *Checkpoint) StorageTarPath() string

type CheckpointOrExperiment

type CheckpointOrExperiment struct {
	Checkpoint *Checkpoint
	Experiment *Experiment
}

type CreateCheckpointArgs

type CreateCheckpointArgs struct {
	Path          string
	Step          int64
	Metrics       map[string]param.Value
	PrimaryMetric *PrimaryMetric
}

type CreateExperimentArgs

type CreateExperimentArgs struct {
	Path           string
	Command        string
	Params         map[string]param.Value
	PythonPackages map[string]string
	PythonVersion  string
}

type Experiment

type Experiment struct {
	ID               string            `json:"id"`
	Created          time.Time         `json:"created"`
	Params           param.ValueMap    `json:"params"`
	Host             string            `json:"host"`
	User             string            `json:"user"`
	Config           *config.Config    `json:"config"`
	Command          string            `json:"command"`
	Path             string            `json:"path"`
	PythonVersion    string            `json:"python_version"`
	PythonPackages   map[string]string `json:"python_packages"`
	Checkpoints      []*Checkpoint     `json:"checkpoints"`
	KeepsakeVersion  string            `json:"keepsake_version"`
	ReplicateVersion string            `json:"replicate_version,omitempty"`
}

Experiment represents a training run

func NewExperiment

func NewExperiment(params param.ValueMap) *Experiment

NewExperiment creates an experiment, setting ID and Created

func (*Experiment) BestCheckpoint

func (e *Experiment) BestCheckpoint() *Checkpoint

BestCheckpoint returns the best checkpoint for an experiment according to the primary metric, or nil if primary metric is not defined or if none of the checkpoints have the primary metric defined

func (*Experiment) HeartbeatPath

func (e *Experiment) HeartbeatPath() string

func (*Experiment) LatestCheckpoint

func (e *Experiment) LatestCheckpoint() *Checkpoint

LatestCheckpoint returns the latest checkpoint for an experiment

func (*Experiment) MetadataPath

func (e *Experiment) MetadataPath() string

func (*Experiment) Save

func (e *Experiment) Save(repo repository.Repository) error

Save experiment to repository

func (*Experiment) ShortID

func (e *Experiment) ShortID() string

func (*Experiment) SortedParams

func (c *Experiment) SortedParams() []*NamedParam

func (*Experiment) StorageTarPath

func (e *Experiment) StorageTarPath() string

type Heartbeat

type Heartbeat struct {
	ExperimentID  string    `json:"experiment_id"`
	LastHeartbeat time.Time `json:"last_heartbeat"`
}

func (*Heartbeat) IsRunning

func (h *Heartbeat) IsRunning() bool

type MetricGoal

type MetricGoal string
const (
	GoalMaximize MetricGoal = "maximize"
	GoalMinimize MetricGoal = "minimize"
)

type NamedParam

type NamedParam struct {
	Name  string
	Value param.Value
}

type PrimaryMetric

type PrimaryMetric struct {
	Name string     `json:"name"`
	Goal MetricGoal `json:"goal"`
}

type Project

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

Project is essentially a data access object for retrieving metadata objects

func NewProject

func NewProject(repo repository.Repository, directory string) *Project

func (*Project) CheckoutCheckpoint

func (p *Project) CheckoutCheckpoint(checkpoint *Checkpoint, experiment *Experiment, outputDir string, quiet bool) error

func (*Project) CheckoutFileOrDirectory

func (p *Project) CheckoutFileOrDirectory(checkpoint *Checkpoint, experiment *Experiment, outputDir string, checkoutPath string) error

checkout all the files from an experiment or checkpoint

func (*Project) CheckpointFromPrefix

func (p *Project) CheckpointFromPrefix(prefix string) (*Checkpoint, *Experiment, error)

CheckpointFromPrefix returns an experiment that matches a given ID prefix.

func (*Project) CheckpointOrExperimentFromPrefix

func (p *Project) CheckpointOrExperimentFromPrefix(prefix string) (*CheckpointOrExperiment, error)

CheckpointOrExperimentFromPrefix returns a checkpoint/experiment given a prefix. This is a single function so we can detect ambiguities across both checkpoints and experiments.

func (*Project) CreateCheckpoint

func (p *Project) CreateCheckpoint(args CreateCheckpointArgs, async bool, workChan chan func() error, quiet bool) (*Checkpoint, error)

func (*Project) CreateExperiment

func (p *Project) CreateExperiment(args CreateExperimentArgs, async bool, workChan chan func() error, quiet bool) (*Experiment, error)

func (*Project) DeleteCheckpoint

func (p *Project) DeleteCheckpoint(chk *Checkpoint) error

func (*Project) DeleteExperiment

func (p *Project) DeleteExperiment(exp *Experiment) error

func (*Project) ExperimentByID

func (p *Project) ExperimentByID(id string) (*Experiment, error)

ExperimentByID returns an experiment that matches a given ID.

func (*Project) ExperimentFromPrefix

func (p *Project) ExperimentFromPrefix(prefix string) (*Experiment, error)

ExperimentFromPrefix returns an experiment that matches a given ID prefix.

func (*Project) ExperimentIsRunning

func (p *Project) ExperimentIsRunning(experimentID string) (bool, error)

ExperimentIsRunning returns true if an experiment is still running (i.e. the heartbeat has beat in the last n seconds).

func (*Project) Experiments

func (p *Project) Experiments() ([]*Experiment, error)

Experiments returns all experiments in this project

func (*Project) RefreshHeartbeat

func (p *Project) RefreshHeartbeat(experimentID string) error

func (*Project) SaveExperiment

func (p *Project) SaveExperiment(exp *Experiment, quiet bool) (*Experiment, error)

func (*Project) StopExperiment

func (p *Project) StopExperiment(experimentID string) error

Jump to

Keyboard shortcuts

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