cellmap_flow.finetune.cli
The finetune training job’s command line: its flags, and what they describe.
build_arg_parserandparse_args: every flag ofpython -m cellmap_flow.finetune.finetune_cli. The training settings’ flags are made fromoptions.TrainingOptions, one per field, andoptions_ofreads them back into one;training_flagsis the inverse, which the job manager builds the command with. A running job outlives a dashboard upgrade, so flags only ever change compatibly.model_config_from_argsandbuild_target_transform: the model and the training target the flags describe.RESTARTABLE_ARGSandapply_restart_params: which settings a restart may change, and how a restart request changes them.
Attributes
Functions
|
A flag per |
|
The training settings the parsed command line |
|
|
|
The job's flags, the training settings checked and completed as TrainingOptions |
|
The TargetTransform |
|
The ModelConfig the command line describes. |
|
Update args with parameters from restart signal and persist to metadata.json. |
|
Apply |
Module Contents
- cellmap_flow.finetune.cli.logger
- cellmap_flow.finetune.cli.add_training_flags(parser)
A flag per
TrainingOptionsfield:--<name>with the field’s default and its description as help,--<name>/--no-<name>for a boolean. The manifest’s fields have none (see options.MANIFEST_FIELDS).
- cellmap_flow.finetune.cli.options_of(args) cellmap_flow.finetune.options.TrainingOptions
The training settings the parsed command line
argscarries.
- cellmap_flow.finetune.cli.training_flags(options: cellmap_flow.finetune.options.TrainingOptions) list
optionsas the flagsbuild_arg_parsertakes, every setting said so the command stands on its own:--<name> <value>,--<name>or--no-<name>for a boolean; a blank value and the manifest’s fields have no flag.
- cellmap_flow.finetune.cli.build_arg_parser()
- cellmap_flow.finetune.cli.parse_args(argv=None) argparse.Namespace
The job’s flags, the training settings checked and completed as TrainingOptions checks them (a rank of 0 is mode full; alpha is twice the rank unless given).
- cellmap_flow.finetune.cli.build_target_transform(options: cellmap_flow.finetune.options.TrainingOptions, model_config, output_voxel_size_nm=None, script=None)
The TargetTransform
optionsdescribe (output_type, loss_type, select_channel, offsets).output_voxel_size_nmis the annotation patches’ voxel size, which the distance bounds of--loss-type intervalare measured in; the model’s output voxel size when not given.scriptis the model script an affinity model’s offsets are read from when the options name none; the model config’s own otherwise.
- 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.RESTART_ALIASES
- 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.
Each value is checked as TrainingOptions checks it, so one that cannot train (0 epochs, a learning rate of 0, two-value offsets) is refused here, with its reason, and the job keeps the setting it has; found only once training ran, it failed a job that was serving. A rank for a full finetune, or a rank of 0 for a LoRA job, is refused too: the model is built once, so a job never switches between the two.
- 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.