dacapo.experiments.starts

Submodules

Classes

Start

This class interfaces with the dacapo store to retrieve and load the

StartConfig

A class to represent the configuration for running tasks. This class

CosemStart

A class to represent the starting point for tasks. This class inherits

CosemStartConfig

Starter for COSEM pretained models. This is a subclass of StartConfig and

Package Contents

class dacapo.experiments.starts.Start(start_config)

This class interfaces with the dacapo store to retrieve and load the weights of the starter model used for finetuning.

run

str The specified run to retrieve weights for the model.

criterion

str The policy that was used to decide when to store the weights.

channels

int The number of channels in the input data.

__init__(start_config)

Initializes the Start class with specified config to run the initialization of weights for a model associated with a specific criterion.

initialize_weights(model, new_head=None)

Retrieves the weights from the dacapo store and load them into the model.

Notes

This class is used to retrieve and load the weights of the starter model used for finetuning from the dacapo store.

channels = None
initialize_weights(model, new_head=None)

Retrieves the weights from the dacapo store and load them into the model.

Parameters:
  • model – obj The model to which the weights are to be loaded.

  • new_head – list The labels of the new head.

Returns:

obj

The model with the weights loaded from the dacapo store.

Return type:

model

Raises:

RuntimeError – If weights of a non-existing or mismatched layer are being loaded, a RuntimeError exception is thrown which is logged and handled by loading only the common layers from weights.

Examples

>>> model = start.initialize_weights(model, new_head)

Notes

This function is called by the Start class to retrieve the weights from the dacapo store and load them into the model.

class dacapo.experiments.starts.StartConfig

A class to represent the configuration for running tasks. This class interfaces with the dacapo store to retrieve and load the weights of the starter model used for finetuning.

run

str The run to be used as a starting point for tasks.

criterion

str The criterion to be used for choosing weights from run.

__init__(start_config)

Initializes the StartConfig class with specified config to run the initialization of weights for a model associated with a specific criterion.

Notes

This class is used to represent the configuration for running tasks.

start_type
run: str
criterion: str
class dacapo.experiments.starts.CosemStart(start_config)

A class to represent the starting point for tasks. This class inherits from the Start class and is used to load the weights of the starter model used for finetuning. The weights are loaded from the dacapo store for the specified run and criterion.

run

str The run to be used as a starting point for tasks.

criterion

str The criterion to be used for choosing weights from run.

name

str The name of the run and criterion.

channels

list The classes_channels of the model.

__init__(start_config)

Initializes the CosemStart class with specified config to run the initialization of weights for a model associated with a specific criterion.

check()

Checks if the checkpoint for the specified run and criterion exists.

initialize_weights(model, new_head=None)

Retrieves the weights from the dacapo store and load them into the model.

Notes

This class is used to represent the starting point for tasks. The weights of the starter model used for finetuning are loaded from the dacapo store.

run
criterion
name
channels
check()

Checks if the checkpoint for the specified run and criterion exists.

Raises:

Exception – If the checkpoint does not exist, an Exception is thrown which is logged and handled by training the model without head matching.

Examples

>>> check()

Notes

This function is called by the CosemStart class to check if the checkpoint for the specified run and criterion exists.

initialize_weights(model, new_head=None)

Retrieves the weights from the dacapo store and load them into the model.

Parameters:
  • model – obj The model to which the weights are to be loaded.

  • new_head – list The labels of the new head.

Returns:

obj

The model with the weights loaded from the dacapo store.

Return type:

model

Raises:

RuntimeError – If weights of a non-existing or mismatched layer are being loaded, a RuntimeError exception is thrown which is logged and handled by loading only the common layers from weights.

Examples

>>> model = initialize_weights(model, new_head)

Notes

This function is called by the CosemStart class to retrieve the weights from the dacapo store and load them into the model.

class dacapo.experiments.starts.CosemStartConfig

Starter for COSEM pretained models. This is a subclass of StartConfig and should be used to initialize the model with pretrained weights from a previous run.

The weights are loaded from the dacapo store for the specified run. The configuration is used to initialize the weights for the model associated with a specific criterion.

run

str The run to be used as a starting point for tasks.

criterion

str The criterion to be used for choosing weights from run.

__init__(start_config)

Initializes the CosemStartConfig class with specified config to run the initialization of weights for a model associated with a specific criterion.

Examples

>>> start_config = CosemStartConfig(run="run_1", criterion="best")

Notes

This class is used to represent the configuration for running tasks.

start_type