dacapo.experiments.run ====================== .. py:module:: dacapo.experiments.run Classes ------- .. autoapisummary:: dacapo.experiments.run.Run Module Contents --------------- .. py:class:: 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. .. attribute:: name The name of the run. :type: str .. attribute:: train_until The number of iterations to train for. :type: int .. attribute:: validation_interval The interval at which to validate. :type: int .. attribute:: task The task object. :type: Task .. attribute:: architecture The architecture object. :type: Architecture .. attribute:: trainer The trainer object. :type: Trainer .. attribute:: datasplit The datasplit object. :type: DataSplit .. attribute:: model The model object. :type: Model .. attribute:: optimizer The optimizer object. :type: torch.optim.Optimizer .. attribute:: training_stats The training stats object. :type: TrainingStats .. attribute:: validation_scores The validation scores object. :type: ValidationScores .. attribute:: start The start object. :type: Start .. method:: move_optimizer(device torch.device, empty_cuda_cache: bool) -> None: Moves the optimizer to the specified device. .. method:: 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. .. py:attribute:: name :type: str .. py:attribute:: train_until :type: int .. py:attribute:: validation_interval :type: int .. py:attribute:: task :type: dacapo.experiments.tasks.task.Task .. py:attribute:: architecture :type: dacapo.experiments.architectures.Architecture .. py:attribute:: trainer :type: dacapo.experiments.trainers.Trainer .. py:attribute:: model :type: dacapo.experiments.model.Model .. py:attribute:: optimizer :type: torch.optim.Optimizer .. py:attribute:: training_stats :type: dacapo.experiments.training_stats.TrainingStats .. py:attribute:: task_type .. py:attribute:: architecture_type .. py:attribute:: trainer_type .. py:attribute:: datasplit_type .. py:attribute:: start .. py:attribute:: new_head :value: None .. py:property:: datasplit .. py:property:: validation_scores .. py:method:: get_validation_scores(run_config) -> dacapo.experiments.validation_scores.ValidationScores :staticmethod: Static method to get the validation scores without initializing model, optimizer, trainer, etc. :param 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. .. rubric:: Examples >>> validation_scores = Run.get_validation_scores(run_config) >>> validation_scores ValidationScores object .. py:method:: move_optimizer(device: torch.device, empty_cuda_cache: bool = False) -> None Moves the optimizer to the specified device. :param device: The device to move the optimizer to. :param empty_cuda_cache: Whether to empty the CUDA cache after moving the optimizer. :raises AssertionError: If the optimizer state is not a dictionary. .. rubric:: Examples >>> run.move_optimizer(device) >>> run.optimizer Optimizer object .. py:method:: visualize_pipeline(bind_address='0.0.0.0', bind_port=0) Visualizes the pipeline for the run, including all produced arrays. :param bind_address: str Bind address for Neuroglancer webserver :param bind_port: int Bind port for Neuroglancer webserver .. rubric:: Examples >>> run.visualize_pipeline()