dacapo.experiments.run

Classes

Run

Class representing a run in the experiment. A run is a combination of a task, architecture, trainer, datasplit,

Module Contents

class dacapo.experiments.run.Run(run_config, load_starter_model: bool = True)

Class representing a run in the experiment. A run is a combination of a task, architecture, trainer, datasplit, model, optimizer, training stats, and validation scores. It also contains the name of the run, the number of iterations to train for, and the interval at which to validate. It also contains a start object that can be used to initialize the model with preloaded weights. The run object can be used to move the optimizer to a specified device.

name

The name of the run.

Type:

str

train_until

The number of iterations to train for.

Type:

int

validation_interval

The interval at which to validate.

Type:

int

task

The task object.

Type:

Task

architecture

The architecture object.

Type:

Architecture

trainer

The trainer object.

Type:

Trainer

datasplit

The datasplit object.

Type:

DataSplit

model

The model object.

Type:

Model

optimizer

The optimizer object.

Type:

torch.optim.Optimizer

training_stats

The training stats object.

Type:

TrainingStats

validation_scores

The validation scores object.

Type:

ValidationScores

start

The start object.

Type:

Start

move_optimizer(device

torch.device, empty_cuda_cache: bool) -> None: Moves the optimizer to the specified device.

get_validation_scores(run_config) ValidationScores

Static method to get the validation scores without initializing model, optimizer, trainer, etc.

Note

The iteration stats list is structured as follows: - The outer list contains the stats for each iteration. - The inner list contains the stats for each training iteration.

name: str
train_until: int
validation_interval: int
task: dacapo.experiments.tasks.task.Task
architecture: dacapo.experiments.architectures.Architecture
trainer: dacapo.experiments.trainers.Trainer
model: dacapo.experiments.model.Model
optimizer: torch.optim.Optimizer
training_stats: dacapo.experiments.training_stats.TrainingStats
task_type
architecture_type
trainer_type
datasplit_type
start
new_head = None
property datasplit
property validation_scores
static get_validation_scores(run_config) dacapo.experiments.validation_scores.ValidationScores

Static method to get the validation scores without initializing model, optimizer, trainer, etc.

Parameters:

run_config – The configuration for the run.

Returns:

The validation scores.

Raises:

AssertionError – If the task or datasplit types are not specified in the run_config.

Examples

>>> validation_scores = Run.get_validation_scores(run_config)
>>> validation_scores
ValidationScores object
move_optimizer(device: torch.device, empty_cuda_cache: bool = False) None

Moves the optimizer to the specified device.

Parameters:
  • device – The device to move the optimizer to.

  • empty_cuda_cache – Whether to empty the CUDA cache after moving the optimizer.

Raises:

AssertionError – If the optimizer state is not a dictionary.

Examples

>>> run.move_optimizer(device)
>>> run.optimizer
Optimizer object
visualize_pipeline(bind_address='0.0.0.0', bind_port=0)

Visualizes the pipeline for the run, including all produced arrays.

Parameters:
  • bind_address – str Bind address for Neuroglancer webserver

  • bind_port – int Bind port for Neuroglancer webserver

Examples

>>> run.visualize_pipeline()