cellmap_flow.models.configs.huggingface

HuggingFaceModelConfig: a cellmap_models export on the Hugging Face Hub.

It is the export at the repository’s root, downloaded (download_export), then built as a CellMapModelConfig. to_dict() adds the repo’s metadata.json for the pipeline builder; building a launch command never downloads it.

Attributes

logger

DISPLAY_KEYS

Classes

HuggingFaceModelConfig

Configuration class for a Hugging Face model.

Functions

download_export(repo[, revision])

The cellmap_models export at the root of the Hugging Face repository

Module Contents

cellmap_flow.models.configs.huggingface.logger
cellmap_flow.models.configs.huggingface.DISPLAY_KEYS = ('channels_names', 'input_voxel_size', 'output_voxel_size', 'inference_input_shape',...
cellmap_flow.models.configs.huggingface.download_export(repo, revision=None)

The cellmap_models export at the root of the Hugging Face repository repo, downloaded: its CellmapModel.

The root’s files only. A model a server published (dashboard/routes/finetune/publish.py) has its ONNX web export in a folder beside them, a model of its own (<repo>/<folder>, type onnx) whose files are of no use here and can be gigabytes.

class cellmap_flow.models.configs.huggingface.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_modes of 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. None when its output cannot be trained through (finetune_refusal).

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’s input_normalization, the range the model reads (metadata_input_norm), for raw data spanning data_range. Downloaded as for declared_geometry; cheap after the first ask, as _load_metadata is, and never raises.

finetune_refusal()

integer_output_refusal of the repo’s metadata.json’s output_dtype.

declared_affinity_offsets()

The offsets the repo’s metadata.json declares (affinity_offsets), downloaded as for declared_geometry; None without them.

declared_class_ids()

The ids the repo’s metadata.json declares its class channels have (class_ids), downloaded as for declared_geometry; None without them.

declared_postprocess()

The step the repo’s metadata.json declares is applied after the model (its inference_output_activation: portable/rank.py declared_postprocess), downloaded as for declared_geometry; [] for none.

runs_at_native_voxel_size() → bool

Whether the repo’s metadata.json says native_voxel_size.

to_dict()

This config as a model entry, which registry.build_model rebuilds.