cellmap_flow.finetune.cli

The finetune training job’s command line: its flags, and what they describe.

  • build_arg_parser and parse_args: every flag of python -m cellmap_flow.finetune.finetune_cli. The job manager builds the command, and a running job outlives a dashboard upgrade, so flags only ever change compatibly.

  • model_config_from_args and build_target_transform: the model and the training target the flags describe.

  • RESTARTABLE_ARGS and apply_restart_params: which settings a restart may change, and how a restart request changes them.

Attributes

logger

LOSS_TYPES

OUTPUT_TYPES

RESTARTABLE_ARGS

Functions

build_arg_parser()

parse_args(→ argparse.Namespace)

The job's flags, with the defaults that depend on other flags filled in.

build_target_transform(args, model_config[, ...])

Build a TargetTransform based on CLI args.

model_config_from_args(...)

The ModelConfig the command line describes.

apply_restart_params(args, signal_data)

Update args with parameters from restart signal and persist to metadata.json.

update_run_metadata(→ bool)

Apply change(metadata) to the run's metadata.json; False if the run has none.

Module Contents

cellmap_flow.finetune.cli.logger
cellmap_flow.finetune.cli.LOSS_TYPES = ('dice', 'bce', 'combined', 'mse', 'margin', 'interval', 'flow')
cellmap_flow.finetune.cli.OUTPUT_TYPES = ('binary', 'binary_broadcast', 'affinities', 'distance', 'flows')
cellmap_flow.finetune.cli.build_arg_parser()
cellmap_flow.finetune.cli.parse_args(argv=None) → argparse.Namespace

The job’s flags, with the defaults that depend on other flags filled in.

cellmap_flow.finetune.cli.build_target_transform(args, model_config, output_voxel_size_nm=None)

Build a TargetTransform based on CLI args.

output_voxel_size_nm is the annotation patches’ voxel size, which the distance bounds of --loss-type interval are measured in; the model’s output voxel size when not given.

cellmap_flow.finetune.cli.model_config_from_args(args) → cellmap_flow.models.models_config.ModelConfig

The ModelConfig the command line describes.

cellmap_flow.finetune.cli.RESTARTABLE_ARGS
cellmap_flow.finetune.cli.apply_restart_params(args, signal_data: dict)

Update args with parameters from restart signal and persist to metadata.json.

Parameters:
  • args – argparse Namespace to update

  • signal_data – Dict from restart signal file

cellmap_flow.finetune.cli.update_run_metadata(output_dir, change) → bool

Apply change(metadata) to the run’s metadata.json; False if the run has none.

The dashboard’s job monitor updates the same file from its own host, within seconds of every restart. The file is read just before it is replaced, and replaced whole (write_json_atomically), so neither side can read the other’s write half done, and the window in which both update it at once, and one loses the other’s change, is kept short. A run that the job manager did not start has no metadata.json, and gets none.