cellmap_flow.utils.config_utils
Smart YAML configuration utilities that dynamically discover and instantiate ModelConfig subclasses, similar to the CLI v2 approach.
Attributes
Functions
|
Get mapping of CLI-friendly names to ModelConfig classes. |
|
Load and validate the YAML configuration. |
Build a single ModelConfig instance from a YAML entry. |
|
|
Given model entries from YAML, instantiate the correct ModelConfig objects. |
Module Contents
- cellmap_flow.utils.config_utils.DEFAULT_SERVER_QUEUE = 'gpu_h100'
- cellmap_flow.utils.config_utils.logger
- cellmap_flow.utils.config_utils.get_model_type_mapping() Dict[str, type]
Get mapping of CLI-friendly names to ModelConfig classes. Uses the same logic as cli_v2 for consistency.
- Returns:
Dictionary mapping model type names to ModelConfig classes
- cellmap_flow.utils.config_utils.load_config(path: str) Dict[str, Any]
Load and validate the YAML configuration.
- Parameters:
path – Path to YAML configuration file
- Returns:
Validated configuration dictionary
- cellmap_flow.utils.config_utils.build_model_from_entry(entry: Dict[str, Any], model_name: str) cellmap_flow.models.models_config.ModelConfig
Build a single ModelConfig instance from a YAML entry. Dynamically discovers the appropriate class and validates parameters.
- Parameters:
entry – Dictionary containing model configuration from YAML
model_name – Name/key of the model from YAML (used as the model’s name)
- Returns:
Instantiated ModelConfig subclass
- cellmap_flow.utils.config_utils.build_models(model_entries: Dict[str, Dict[str, Any]]) List[cellmap_flow.models.models_config.ModelConfig]
Given model entries from YAML, instantiate the correct ModelConfig objects. Uses dynamic discovery like cli_v2 instead of hardcoded if/else chains.
YAML format: models:
- my_model_1:
type: cellmap-model checkpoint_path: /path/to/checkpoint
- my_model_2:
type: dacapo run_name: my_run iteration: 50000
- Parameters:
model_entries – Dictionary mapping model names to their configurations
- Returns:
List of instantiated ModelConfig objects