MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / ConfigWorkflow

Class ConfigWorkflow

monai/bundle/workflows.py:361–666  ·  view source on GitHub ↗

Specification for the config-based bundle workflow. Standardized the `initialize`, `run`, `finalize` behavior in a config-based training, evaluation, or inference. Before `run`, we add bundle root directory to Python search directories automatically. For more information: https://mo

Source from the content-addressed store, hash-verified

359
360
361class ConfigWorkflow(BundleWorkflow):
362 """
363 Specification for the config-based bundle workflow.
364 Standardized the `initialize`, `run`, `finalize` behavior in a config-based training, evaluation, or inference.
365 Before `run`, we add bundle root directory to Python search directories automatically.
366 For more information: https://monai.readthedocs.io/en/latest/mb_specification.html.
367
368 Args:
369 config_file: filepath of the config file, if this is a list of file paths, their contents will be merged in order.
370 meta_file: filepath of the metadata file, if this is a list of file paths, their contents will be merged in order.
371 If None, default to "configs/metadata.json", which is commonly used for bundles in MONAI model zoo.
372 logging_file: config file for `logging` module in the program. for more details:
373 https://docs.python.org/3/library/logging.config.html#logging.config.fileConfig.
374 If None, default to "configs/logging.conf", which is commonly used for bundles in MONAI model zoo.
375 If False, the logging logic for the bundle will not be modified.
376 init_id: ID name of the expected config expression to initialize before running, default to "initialize".
377 allow a config to have no `initialize` logic and the ID.
378 run_id: ID name of the expected config expression to run, default to "run".
379 to run the config, the target config must contain this ID.
380 final_id: ID name of the expected config expression to finalize after running, default to "finalize".
381 allow a config to have no `finalize` logic and the ID.
382 tracking: if not None, enable the experiment tracking at runtime with optionally configurable and extensible.
383 if "mlflow", will add `MLFlowHandler` to the parsed bundle with default tracking settings,
384 if other string, treat it as file path to load the tracking settings.
385 if `dict`, treat it as tracking settings.
386 will patch the target config content with `tracking handlers` and the top-level items of `configs`.
387 for detailed usage examples, please check the tutorial:
388 https://github.com/Project-MONAI/tutorials/blob/main/experiment_management/bundle_integrate_mlflow.ipynb.
389 workflow_type: specifies the workflow type: "train" or "training" for a training workflow,
390 or "infer", "inference", "eval", "evaluation" for a inference workflow,
391 other unsupported string will raise a ValueError.
392 default to `None` for common workflow.
393 properties_path: the path to the JSON file of properties. If `workflow_type` is specified, properties will be
394 loaded from the file based on the provided `workflow_type` and meta. If no `workflow_type` is specified,
395 properties will default to loading from "train". If `properties_path` is None, default properties
396 will be sourced from "monai/bundle/properties.py" based on the workflow_type:
397 For a training workflow, properties load from `TrainProperties` and `MetaProperties`.
398 For a inference workflow, properties load from `InferProperties` and `MetaProperties`.
399 For workflow_type = None : only `MetaProperties` will be loaded.
400 override: id-value pairs to override or add the corresponding config content.
401 e.g. ``--net#input_chns 42``, ``--net %/data/other.json#net_arg``
402
403 """
404
405 def __init__(
406 self,
407 config_file: str | Sequence[str],
408 meta_file: str | Sequence[str] | None = None,
409 logging_file: str | bool | None = None,
410 init_id: str = "initialize",
411 run_id: str = "run",
412 final_id: str = "finalize",
413 tracking: str | dict | None = None,
414 workflow_type: str | None = "train",
415 properties_path: PathLike | None = None,
416 **override: Any,
417 ) -> None:
418 if config_file is not None:

Callers 10

initializeMethod · 0.90
initializeMethod · 0.90
test_trainMethod · 0.90
test_evaluateMethod · 0.90
test_dataset_trackingMethod · 0.90
test_inference_configMethod · 0.90
test_train_configMethod · 0.90

Calls

no outgoing calls

Tested by 6

test_trainMethod · 0.72
test_evaluateMethod · 0.72
test_dataset_trackingMethod · 0.72
test_inference_configMethod · 0.72
test_train_configMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…