cellmap_flow.dashboard.services.launch

Start the models picked on the Models tab, and show each in the viewer.

  • update_run_models(): stop and forget the models no longer picked, start the ones newly picked, each in its own thread. A finetune job’s server is the Finetune tab’s to stop, never this one’s.

  • run_model() / run_hf_model() / run_bioimage_model() / run_cellpose_model(): start one catalog, Hugging Face, BioImage Model Zoo or Cellpose model’s inference server (start_hosts, which records the job) and add its layer, the one Submit would give it. Each is served from its type’s default_env, when the type sets one (serving.launch.server_argv_for): a zoo model from pixi’s bioimageio environment, a Cellpose one from cellpose4.

Attributes

logger

CELLPOSE_MODELS

Functions

run_model(model_path, name, st_data)

run_hf_model(repo, name, st_data)

Run a Hugging Face model by repo ID.

run_model_config(model_config, st_data)

Run a model given as its config (an entry the Models tab's Add built),

bioimage_job_name(→ str)

A zoo model's job, layer and config name, from the key it is loaded

run_bioimage_model(params, st_data)

Run a BioImage Model Zoo model: params are its BioModelConfig

cellpose_job_name(→ str)

A Cellpose model's job, layer and config name: "cpsam_v2" serving all

run_cellpose_model(params, st_data)

Run a Cellpose model: params are its CellposeModelConfig

running_names(→ set)

The models running, or on their way: the session's jobs and the

kill_n_remove_from_neuroglancer(jobs, s)

Kill jobs and drop their layers from the viewer state s.

update_run_models(names[, hf_repos, bioimage_models, ...])

Run names (catalog models), hf_repos, bioimage_models

Module Contents

cellmap_flow.dashboard.services.launch.logger
cellmap_flow.dashboard.services.launch.run_model(model_path, name, st_data)
cellmap_flow.dashboard.services.launch.run_hf_model(repo, name, st_data)

Run a Hugging Face model by repo ID.

cellmap_flow.dashboard.services.launch.run_model_config(model_config, st_data)

Run a model given as its config (an entry the Models tab’s Add built), in its environment, as Submit runs the catalog’s.

cellmap_flow.dashboard.services.launch.bioimage_job_name(key: str) → str

A zoo model’s job, layer and config name, from the key it is loaded by: “affable-shark” is affable_shark. A DOI’s slash and dots go too.

cellmap_flow.dashboard.services.launch.run_bioimage_model(params, st_data)

Run a BioImage Model Zoo model: params are its BioModelConfig arguments, name included (bioimage_catalog.bioimage_entry).

cellmap_flow.dashboard.services.launch.CELLPOSE_MODELS
cellmap_flow.dashboard.services.launch.cellpose_job_name(model: str, output: str) → str

A Cellpose model’s job, layer and config name: “cpsam_v2” serving all its channels (flows, the default) is cellpose_sam_v2, its probability alone cellpose_sam_v2_probability and its masks cellpose_sam_v2_masks.

The output is in the name, so one model’s outputs can run side by side (the probability to look at, the masks to proofread), each its own job and layer; the default output keeps the plain name. The voxel size and the slice linking are not: changing them restarts that job instead (update_run_models), rather than leaving the old one running beside.

cellmap_flow.dashboard.services.launch.run_cellpose_model(params, st_data)

Run a Cellpose model: params are its CellposeModelConfig arguments, name included (_cellpose_params).

cellmap_flow.dashboard.services.launch.running_names() → set

The models running, or on their way: the session’s jobs and the launches not finished yet.

cellmap_flow.dashboard.services.launch.kill_n_remove_from_neuroglancer(jobs, s)

Kill jobs and drop their layers from the viewer state s.

cellmap_flow.dashboard.services.launch.update_run_models(names: List[str], hf_repos: List[str] = None, bioimage_models: List[dict] = None, cellpose_models: List[dict] = None)

Run names (catalog models), hf_repos, bioimage_models ({“id”, “voxel_size”} each) and cellpose_models ({“model”, “voxel_size”, “output”, “stitch_threshold”} each), and stop every other model. A ValueError, before anything changes, when a zoo model needs a voxel size or a Cellpose model’s settings are missing or wrong.