cellmap_flow.models.models_config
The model config classes: ModelConfig and the built-in model types.
This is their public import path. The docs import them from here, and
plugins subclass ModelConfig, ScriptModelConfig and the rest by
it. The classes live in cellmap_flow.models.configs, one module per
type. Config, what a type’s _get_config returns, is here too, for
plugins that define a type.
Classes
What a model type's |
|
A network fly_organelles trained, from a training checkpoint, a .ts or a model.pt. |
|
A BioImage Model Zoo model, run through bioimageio.core. |
|
Configuration class for a CellmapModel. |
|
Configuration class for a finetuned model. |
|
Configuration class for a Hugging Face model. |
|
Cellpose 4 run on each z slice of a chunk, or on the chunk in 3D. |
|
An ONNX export, the browser mode's kind of model, served with ONNX Runtime. |
Module Contents
- class cellmap_flow.models.models_config.Config(**kwargs)
What a model type’s
_get_configreturns: the model, its geometry and anything else its script or checkpoint defines, as attributes.Built from keyword arguments (a script’s globals, for a script model), which
to_dict()andget()read back.axes_namesdefaults to x, y, z.- axes_names
- kwargs
- to_dict()
Returns the configuration as a dictionary.
- get(key: str, default: Any = None) Any
Gets the value of a configuration key.
- class cellmap_flow.models.models_config.ModelConfig
- env = None
- default_env = None
- display_channel = None
- normalizes_input = False
- finetunable = False
- config_relative_paths = ()
- finetune_modes()
What this model can be finetuned with: (“lora”, “full”), (“full”,) or (). For the dashboard, so it must not build the network: a type whose networks differ (a compiled one takes no LoRA adapter) reads it from what describes the model. The trainer checks the module it gets the same way (
finetune.trainable.finetune_modes).
- declared_input_norm(data_range=None)
The input normalization the model declares itself, as cellmap-flow steps (
[{"name": ..., **params}]), or None when it declares none.Asked on every dashboard poll, so it must be cheap and must not raise. An onnx model’s manifest declares its steps, and so does the metadata.json of a model a server published to Hugging Face; a cellmap-models export’s metadata.json declares the range the model reads (
probe.metadata_input_norm), which needsdata_range, the raw data’s (lo, hi), to say what to scale from.
- declared_geometry()
What the model says of its output without being built:
{"write_shape" (nm, z, y, x), "input_voxel_size" and "output_voxel_size" (nm), "output_channels", "channels" (their names, None when it names none)}, as its server reports them; None when it says none, or not for certain. Atrun_voxel_size, when it has one: every type’s is scaled to it (__init_subclass__), so a type declares its own sizes.For the finetune tab’s model list, which asks on every poll while the model’s server is not up: building the model there loaded its weights and ran a forward on the dashboard’s CPU (25 s for a 3 GB TorchScript). So it must be cheap and must not raise, as declared_input_norm. A type declares it from what describes the model (a metadata.json, a manifest, its entry).
- output_graph()
The graph of what this model serves, for its output activation:
(nodes, output)asportable.activation.output_activationreads them, or None when it cannot be read. The inference server reads it once the model is built (inference/runner.py), so it may load what the built model has.By default
config.model’s (inference.graph.module_graph: a TorchScript, a torch.export program or module, a torch.fx trace of any other module), when that is what the server runs: not when the config predicts through its ownpredictorprocess_chunk, which may do anything to the model’s output (a script’s sigmoid after it). A type whose own process_chunk it knows says its graph itself (an onnx model’s file, a bioimage.io model’s postprocessing).
- trainable_model()
The torch module the finetune trainer trains, or None for
config.modelas it is (finetune.model_loading.load_trainable_model).The trainer feeds it a float tensor (B, 1, Z, Y, X), normalized as the dashboard’s input normalization does, at the input voxel size and read shape, and wants (B, C, Z’, Y’, X’) at the write shape back. A type whose
config.modelis not such a module (a bioimage.io prediction pipeline, a Cellpose model object) returns one that is, sharing its parameters, so that what is trained is what is served.
- serve_trained(config, module)
Make
configservemodule, the trainedtrainable_model().configis this model’s own Config (the trainer’s live server) or a new one with its geometry (a finetuned model’s,FinetuneModelConfig). By default the module is the model, run by the inferencer’s own forward; a type that predicts through its ownprocess_chunksets that up here instead.
- validate_model_shapes = True
- check_shapes_on_warmup = False
- property run_voxel_size
The voxel size (nm, z, y, x) the model is run at, or None for its own: its entry’s
run_voxel_size.Its
configthen reads at it, and writes at its output voxel size scaled as the input’s is (geometry.run_at_geometry): a 16 nm model run on the 32 nm level. The voxel counts are the model’s own, so the shapes in nm scale with it. Set from one number, three or the text a form sends; a blank clears it. Setting another one forgets the config built at the old one.- Raises:
ValueError – not a voxel size, or the model reads its input itself (
reads_input_itself), and so cannot be run at another.
- reads_input_itself() bool
Whether the model reads its input itself: its config’s own
process_chunkorpredictworks out in nm, at the model’s own voxel size, what to read around each chunk, so it cannot be run at another from outside (run_voxel_size).Its built config says for certain. Unbuilt, a type that defines a
process_chunkof its own does (Cellpose, a BioImage Model Zoo model), and a type whose models decide it says so for each (a script); any other is taken not to until it is built, which then refuses a run voxel size.
- property effective_env
The environment this model’s server and finetuning job run in, or None for this one:
env, elsedefault_env(envs.effective).
- property config
- check_output_shape(output_shape)
Raise ValueError if a forward’s
output_shape(batch first) contradicts the declared write_shape, block_shape or output_channels.
- property geometry: cellmap_flow.models.geometry.ModelGeometry
The config’s geometry as one ModelGeometry, read once per built config.
- property chunk_output_axes: tuple[str, ...]
The axes of a processed chunk; by default
geometry.DEFAULT_OUTPUT_AXES, (“c”, “z”, “y”, “x”).Models can override by setting config.chunk_output_axes. The server and blockwise read it only for whether a chunk has a channel axis: one that has must have it first, and its spatial axes are the raw data’s, in the raw data’s order.
- property output_dtype
Returns the output dtype of the model. Defaults to np.float32.
- to_dict()
This config as a model entry, which
registry.build_modelrebuilds.{"type": <registered name>, **the constructor arguments given}, leaving out None as the built-in types leave out an unset name or scale. The built-in types write their own; this one serves a plugin type that does not, so exporting its config and launching its server work without one.
- property launch_entry: dict
The model entry a launched server rebuilds this exact config from.
to_dict(), less what only the pipeline builder shows (a Hugging Face repo’s downloaded metadata), under the name the registry has this class under (
registry.cli_name_of), so that the server rebuilds this class and not a parent it inherited cli_name from. With the entry’s ownenv, if it has one, whichserving.launchtakes off again (the server’s environment iseffective_env, which it reads from the config), and itsrun_voxel_size, which the server’s config is built at.
- property command: str
cellmap_flow_serverarguments that rebuild this exact config.Generated from to_dict() so no constructor argument is left behind (hand-written commands dropped Fly’s input/output size, which then silently fell back to 178/56, and Bio’s required voxel size), with every token shell-quoted: bsub runs it through
bash -cand local launches throughshlex.split. The class is named as the server CLI registers it (registry.cli_name_of), so it rebuilds this class and not a parent it inherited cli_name from.
- class cellmap_flow.models.models_config.ScriptModelConfig(script_path, name=None, scale=None)
- cli_name = 'script'
- finetunable = True
- script_path
- name = None
- scale = None
- reads_input_itself() bool
Its built config’s answer, else its script’s (
script_reads_input_itself).
- to_dict()
This config as a model entry, which
registry.build_modelrebuilds.
- class cellmap_flow.models.models_config.DaCapoModelConfig(run_name: str, iteration: int, name=None, scale=None)
- cli_name = 'dacapo'
- finetunable = True
- run_name
- iteration
- name = None
- scale = None
- to_dict()
This config as a model entry, which
registry.build_modelrebuilds.
- class cellmap_flow.models.models_config.FlyModelConfig(checkpoint_path: str, channels: list[str] = None, input_voxel_size: tuple = None, output_voxel_size: tuple = None, name: str = None, input_size: tuple = None, output_size: tuple = None, scale=None, sigmoid: bool = True)
A network fly_organelles trained, from a training checkpoint, a .ts or a model.pt.
- Parameters:
checkpoint_path – the checkpoint file (see the module docstring).
channels – the name of each output channel. Default: read beside the checkpoint.
input_voxel_size – nm per voxel (one number or one per axis). Default: read beside the checkpoint; one stands for the other.
output_voxel_size – nm per voxel (one number or one per axis). Default: read beside the checkpoint; one stands for the other.
input_size – voxels a side of a tile in and out. Default: read beside the checkpoint, else 178 in and the output computed from the network. An output size needs its input size.
output_size – voxels a side of a tile in and out. Default: read beside the checkpoint, else 178 in and the output computed from the network. An output size needs its input size.
sigmoid – pass the output through a sigmoid, added unless the network ends in one (default True); False serves the network’s output.
- cli_name = 'fly'
- finetunable = True
- checkpoint_path = ''
- name = None
- scale = None
- sigmoid
- channels
- input_voxel_size = None
- output_voxel_size = None
- input_size = None
- output_size = None
- property default_env
flyfor a training checkpoint or an eager model.pt, else none (TorchScript runs anywhere).A training checkpoint is loaded into fly_organelles’
StandardUnet, and unpickling an eagermodel.ptimports fly_organelles’ classes: pixi.toml’sflyenvironment has them, cellmap-flow’s own does not. A.tsfile carries its own code and runs wherever torch does.
- load_eval_model()
The network to serve, in eval mode: the checkpoint’s, with a sigmoid if
sigmoid.
- property model
- to_dict()
This config as a model entry, which
registry.build_modelrebuilds.With what was read beside the checkpoint, so the entry says what is served; the sizes when given or read, not when computed. In the constructor’s order, which exported YAMLs keep.
- class cellmap_flow.models.models_config.BioModelConfig(model: str, voxel_size: tuple = None, input_size: tuple = None, context: tuple = None, slices_per_chunk: int = None, weight_format: str = None, name=None, scale=None)
A BioImage Model Zoo model, run through bioimageio.core.
- Parameters:
model – a zoo id or nickname (“conscientious-dromedary”), a DOI or URL, or the path of a model’s rdf.yaml (bioimageio.yaml) or packaged .zip.
voxel_size – nm per input voxel (one number, or z, y, x): the level the model reads. By default the RDF’s, from its input’s space axes’ scale and unit; for a model whose RDF gives no unit (all of the zoo’s), the one it was trained at when cellmap-flow’s table knows it (
bioimage_catalog.trained_at: the zoo’s EM models); else it is needed. A 2D model’s z is the spacing of its slices, its y by default.input_size – voxels a side of the tile the model is given, one number or one per space axis of the model (z, y, x; y, x for a 2D model). An axis the RDF fixes keeps its size; a parameterized one gets the smallest size it takes of at least this. By default 256 for a 2D model and 128 for a 3D one.
context – voxels cut off each side of the model’s output (one number, or one per space axis of the model), so chunks meet where the model saw both sides of the seam; the input is read that much larger. By default the RDF’s halo, 0 where it gives none.
slices_per_chunk – z slices in a chunk of a 2D model; 8 by default. A 3D model ignores it.
weight_format – the weights to run (“torchscript”, “pytorch_state_dict”, “onnx”, …); by default bioimageio.core’s pick of those the model has.
- cli_name = 'bioimage'
- default_env = 'bioimageio'
- finetunable = True
- normalizes_input = True
- model = ''
- voxel_size = None
- input_size = None
- context = None
- slices_per_chunk = None
- weight_format = None
- name = None
- scale = None
- process_chunk(idi: cellmap_flow.io.raw.RawInput, output_roi)
output_roipredicted:(channels, z, y, x), inoutput_dtype.
- output_graph()
What its description says ends its output, as a graph: its one output’s postprocessing (a sigmoid, a softmax, a clip and its bounds; an ensure_dtype to a float type casts), which process_chunk’s pipeline applies, after the network, which is not read here: an op (
bioimage.io network) that decides nothing. So a model whose description applies its sigmoid is known, and one whose network does, or that has none, is left to the output probe. Of several outputs, served one after another (_output), none.
- trainable_model()
The model as one torch module, for the finetune trainer: (B, 1, Z, Y, X) of the read shape in, (B, channels, Z’, Y’, X’) of the write shape out, as process_chunk serves it.
Built from the model’s description, the way bioimageio.core runs it: the input’s preprocessing (its normalization), the network from its torch weights (a 2D one on each z slice, the slices in one call when its batch axis takes any size), each output’s postprocessing (a sigmoid) and the same crop, the outputs’ channels one after another. Statistics are taken per patch, over the axes the RDF names, so a patch is normalized as a chunk is; an RDF that names none asks bioimageio.core for statistics of all it has seen, which a patch cannot reproduce, and gets the patch’s own.
Refuses, with a ValueError saying why, a model whose weights are not torch (ONNX, TensorFlow, Keras: no torch module to train), or whose output goes through something no gradient passes (labels, a threshold, Stardist or Cellpose instances). On the device the server uses, in float32 and in eval mode.
- serve_trained(config, module)
Serve
module(the trainedtrainable_model()) through the inferencer’s own forward.process_chunk runs the pipeline’s weights, as loaded from the zoo, so it is switched off: the module does all process_chunk did (the normalization, each slice of a 2D model, the sigmoid, the crop), given (1, 1, Z, Y, X) of the read shape, and gives float32.
- finetune_modes()
How the dashboard can finetune this model: (“lora”, “full”), (“full”,) or ().
From its weight formats only, without bioimageio or torch: the catalog’s cached entry, else a local rdf.yaml or .zip read as YAML, else (where bioimageio.core is) its description. Torch weights decide, as
trainable_modelpicks them: a state dict takes LoRA and a full finetune, TorchScript a full one only, and a model without either, or whose weights cannot be told, none.
- to_dict()
This config as a model entry, which
registry.build_modelrebuilds.What the model’s description decides unless told otherwise (its voxel size, tile and context) is written only when it was given, so that an exported entry keeps following the model.
- class cellmap_flow.models.models_config.CellMapModelConfig(folder_path, name=None, scale=None)
Configuration class for a CellmapModel.
- cli_name = 'cellmap'
- finetunable = True
- cellmap_model
- name = None
- scale = None
- finetune_modes()
export_finetune_modesof its folder’s files, read from their names without loading them: the model list asks on every poll. Both while the folder cannot be listed.
- declared_geometry()
Its export’s metadata.json’s (
metadata_geometry), read without the model.
- declared_input_norm(data_range=None)
Its export’s metadata.json’s input_normalization (
metadata_input_norm). cellmap_models’ parsed metadata leaves that field out, so the file is read for it, once.
- to_dict()
This config as a model entry, which
registry.build_modelrebuilds.
- class cellmap_flow.models.models_config.FinetuneModelConfig(lora_adapter_path: str = None, base_model: dict = None, name: str = None, scale=None, weights_path: str = None, input_voxel_size: tuple = None, output_voxel_size: tuple = None)
Configuration class for a finetuned model.
Wraps any base ModelConfig with the finetune’s weights, which are exactly one of: a LoRA adapter (
lora_adapter_path), applied with PEFT, or a full finetune’s state dict (weights_path, from a run with--lora-r 0), loaded strictly. The base model is built by its own ModelConfig, as the trainable module the trainer trained, and the weights go on top of it.- cli_name = 'finetune'
- finetunable = True
- lora_adapter_path = None
- weights_path = None
- base_model_dict = None
- name = None
- scale = None
- input_voxel_size = None
- output_voxel_size = None
- property env
the weights go on the base model, so they need the base’s packages.
- Type:
Its own
envif it was given one, else its base model’s
- property default_env
The base model type’s
default_env, as the weights need the base model’s packages. A type that decides per model decides for the base.
- property base_model_config
Lazily build the base ModelConfig from the stored dict.
- property display_channel
a finetune serves the same channels.
- Type:
Its base’s
- property normalizes_input
a finetune serves through the same preprocessing.
- Type:
Its base’s
- finetune_modes()
Its base’s: continuing a finetune trains the same network.
- declared_geometry()
Its base’s, at the voxel sizes the finetune was trained at (
trained_at_geometry); None when the base declares none.
- output_graph()
Its base’s: a finetune’s weights (an adapter beside each layer, or the whole network’s) change what its layers compute, not the op that ends it, and the module it serves (PEFT’s, around the base’s trainable module) is not one a torch.fx trace reads.
- trainable_model()
The module it serves (its base’s trainable module with the adapter or weights on), to train on from where the finetune left off; not
config.model, which a type serving through its own process_chunk (cellpose) keeps as its own model object.
- to_dict()
This config as a model entry, which
registry.build_modelrebuilds.Surfaces key base model fields at the top level so the pipeline builder UI can display them alongside the finetune-specific fields.
- class cellmap_flow.models.models_config.HuggingFaceModelConfig(repo, revision=None, name=None, scale=None)
Configuration class for a Hugging Face model.
- cli_name = 'huggingface'
- finetunable = True
- METADATA_RETRY_SECONDS = 60
- repo
- revision = None
- name = None
- scale = None
- finetune_modes()
export_finetune_modesof the repo’s files. Their list is asked for, not the model, once for the life of this config; when the Hub cannot say, both are offered, and the job says which it takes.
- declared_geometry()
Its metadata.json’s, as a cellmap export’s (
metadata_geometry): that file is downloaded, not the model.
- declared_input_norm(data_range=None)
The input normalization the repo’s metadata.json declares: its
input_norm, cellmap-flow steps, which a model a server published has (finetune.export_web); else a cellmap-models export’sinput_normalization, the range the model reads (metadata_input_norm), for raw data spanningdata_range. Downloaded as for declared_geometry; cheap after the first ask, as_load_metadatais, and never raises.
- to_dict()
This config as a model entry, which
registry.build_modelrebuilds.
- class cellmap_flow.models.models_config.CellposeModelConfig(voxel_size: tuple, pretrained_model: str = 'cpsam_v2', output: str = 'flows', do_3d: bool = False, slices_per_chunk: int = 8, slice_size: int = None, context: int = None, batch_size: int = DEFAULT_BATCH_SIZE, diameter: float = None, flow_threshold: float = 0.4, cellprob_threshold: float = 0.0, stitch_threshold: float = 0.0, flow3d_smooth: float = 0.0, name=None, scale=None)
Cellpose 4 run on each z slice of a chunk, or on the chunk in 3D.
- Parameters:
voxel_size – nm per voxel, input and output (one number or one per axis). Cellpose-SAM sees objects best about 30 voxels across, so pick the scale at which yours are roughly that, or give
diameter.pretrained_model – “cpsam_v2” (default), “cpsam”, “cpdino”, “cpdino-vitb”, or the path of finetuned Cellpose weights.
output – “flows” (the default; float32: flow_y, flow_x and the cell probability, with flow_z first in 3D), “probability” (float32, 0 to 1, one channel) or “masks” (uint64, ids unique within a chunk).
do_3d – segment each chunk in 3D (Cellpose’s
do_3D) rather than slice by slice.slices_per_chunk – z slices in a chunk (2D only; a 3D chunk’s z follows from
slice_size,chunk_voxels).slice_size – voxels a side, in y and x, of each chunk’s slices; None is 512 in 2D, 192 in 3D (
DEFAULT_SLICE_SIZE).context – voxels read on each side in y and x beyond those, and cut off, and in z too in 3D; None is 32 in 2D, 24 in 3D.
batch_size – tiles per GPU pass (
DEFAULT_BATCH_SIZE; None, as a blank form field sends it, is that too).diameter – object diameter in input voxels; None keeps the model’s own scale (about 30). Cellpose resizes each slice by 30 / diameter.
flow_threshold – Cellpose’s mask thresholds (masks only).
cellprob_threshold – Cellpose’s mask thresholds (masks only).
stitch_threshold – Cellpose’s own slice linking (masks only, 2D only): a mask takes the id of the mask in the slice before that it overlaps by at least this IoU, within a chunk. 0, the default, leaves each slice’s masks apart.
flow3d_smooth – in 3D, the sigma, in voxels, of a Gaussian Cellpose smooths the 3D flows with before following them (its
flow3D_smooth), against objects broken up along z; 0, the default, is none.
- cli_name = 'cellpose'
- default_env = 'cellpose4'
- finetunable = True
- normalizes_input = True
- finetune_output_type = 'flows'
- property channels
The names of the channels
outputserves, in 2D or 3D.
- property display_channel
The cell probability’s channel when the output has several (flows): the layer’s flow colours are dimmed by it, and its range is the layer’s.
- voxel_size = None
- pretrained_model = ''
- output = 'flows'
- do_3d = False
- slices_per_chunk = 8
- slice_size = 0
- context = 0
- batch_size = 16
- diameter = None
- flow_threshold
- cellprob_threshold
- stitch_threshold
- flow3d_smooth
- name = None
- scale = None
- property read_size: int
Voxels a side, in y and x, of each slice Cellpose is given.
- property anisotropy: float
how much Cellpose stretches z in 3D (its
anisotropy) so that its planes are square in nm.- Type:
z’s voxel size over y’s
- chunk_voxels()
(chunk, context): a chunk’s (z, y, x) voxels, and those read beyond it on each side.In 2D,
slices_per_chunkslices ofslice_sizesquared, with context in y and x only: each slice is segmented on its own. In 3D a cube in nm:slice_sizeandcontextin y and x, and as many nm in z, so that once Cellpose stretches z byanisotropyevery plane is as wide as a YX one, about one tile.
- process_chunk(idi, output_roi)
output_roisegmented:(channels, z, y, x), theoutput’s channels.
- finetune_modes()
(“lora”, “full”), without building the network: every Cellpose 4 network is a ViT whose Linear and Conv layers take adapters.
- training_patch_voxels()
The patch the trainer reads, (input, output) in voxels: one slice of one tile.
Not the serving geometry. Cellpose-SAM’s ViT adds a fixed 32 x 32 grid of position embeddings to its 8-pixel tokens, so it takes 256 x 256 images and nothing else; Cellpose serves a slice by cutting it into such tiles, and trains on random tiles of that size too. The trainer does the same: it reads tiles, and supervises the whole of each, as Cellpose does (an instance cut by its edge is left out of the flow loss,
instance_flows). One slice: the network is 2D and sees each slice alone, so more slices would cost a network pass each and add nothing, and a one-slice patch centred on a painted voxel always lands on paint. The slice is cut in the plane its paint was drawn in where the voxels are cubes, and turned to face the network, else it is always a YX one (finetune.data.dataset). A 3D model’s network is the same 2D one, run on the chunk’s planes in all three orientations, so paint in its side views trains it there.
- trainable_model()
Cellpose’s network as the trainer trains it: (B, 1, Z, Y, X) -> (B, 3, Z, Y, X).
Each slice normalized as Cellpose’s eval does (1st to 99th percentile), then through the network, which gives flowY, flowX and the cell probability logit (
instance_flows’ channels). The network is the oneconfig.modelsegments with, so what is trained is what is served; it is put in float32 (Cellpose loads it in bfloat16), which serving then uses too. Its patch embedding is kept out of LoRA (lora_exclude_patterns): Cellpose’s forward reads that layer’s weight tensor directly, so an adapter on it would never be used.
- serve_trained(config, module)
Serve
module(the trainedtrainable_model()) through Cellpose’s eval.Training changed the network in place, LoRA adapters and all, and Cellpose’s eval runs that network, so the chunks are segmented as before.
configis this model’s own config (the trainer’s live server) or a finetuned model’s new one with this geometry, which gets what segmenting needs.config.modelstays Cellpose’s model object, as it is for the base model, so the inferencer neither moves nor forwards it. Were it the module, the warmup and the shape check would forward it, and a 3-channel tile network fails the 1-channel serving geometry: as a hard error whenever the read slice happens to be one tile. The module is kept asconfig.trained_module.
- to_dict()
This config as a model entry, which
registry.build_modelrebuilds.
- class cellmap_flow.models.models_config.OnnxModelConfig(path: str = None, folder: str = None, repo: str = None, revision: str = None, file: str = None, variant: str = None, input_voxel_size: tuple = None, output_voxel_size: tuple = None, input_size: tuple = None, output_size: tuple = None, channels: list[str] = None, output: str = None, slices_per_chunk: int = None, name: str = None, scale=None)
An ONNX export, the browser mode’s kind of model, served with ONNX Runtime.
- Parameters:
path – a local .onnx file. Relative in a YAML: from the YAML’s folder.
folder – a model’s folder in
repo(setup_54), instead ofpath.repo – the Hugging Face repo of
folder; cellmap/onnx-web-models.revision – the repo’s branch, tag or commit; its main branch.
file – the
.onnxoffolderto serve: one of its manifest’s variants (what the browser’s Export Config writes).variant – the precision to serve when
fileis not given: fp32 (the default), fp16, int8w or int8w_fp16.input_voxel_size – nm per input voxel (one number, or z, y, x). The manifest’s; needed for a file without one.
output_voxel_size – nm per output voxel: by default the input’s times the manifest’s ratio of the two, else the input’s.
input_size – voxels of the block the model reads (one number or z, y, x): the manifest’s variant’s, else the graph’s input. For a
folder, it chooses the variant (the largest by default).output_size – voxels it writes: the variant’s, else the graph’s output.
channels – the output channels’ names; the manifest’s, else channel_0, channel_1, … for as many as the graph outputs.
output – what the output is, as the manifests say it (“raw logits”).
slices_per_chunk – z slices a chunk of a 2D student (a model whose input and output are one slice thick), each one call; 8 by default. A 3D model ignores it.
- cli_name = 'onnx'
- default_env = 'onnx'
- finetunable = False
- config_relative_paths = ('path',)
- path = None
- folder = None
- repo = None
- revision = None
- file = None
- variant = None
- input_voxel_size = None
- output_voxel_size = None
- input_size = None
- output_size = None
- channels = None
- output = None
- slices_per_chunk = None
- name = None
- scale = None
- property hub_repo: str
- declared_input_norm(data_range=None) list | None
The input normalization the model’s manifest declares, as cellmap-flow steps (
[{"name": ..., **params}]), or None. The manifest gives each step’s values, sodata_rangeis not used.For the dashboard’s model advice (
suggest_input_norm’sdeclared), which asks on every poll (_declared_manifest).
- declared_geometry() dict | None
ModelConfig.declared_geometryfrom the entry, the manifest and its variant, as the server works it out (_geometry) but without the graph: None when they leave a size to the graph, or the manifest cannot be read now (_declared_manifest).
- output_graph()
The served file’s graph (
read_graph), read back from the output it is fetched by; the manifest’soutputwords are not consulted, as the graph says it for certain.
- to_dict()
This config as a model entry, which
registry.build_modelrebuilds.What the manifest or the graph decides unless told otherwise is written only when it was given, so that an exported entry keeps following the model.