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

Function run

monai/bundle/scripts.py:924–1013  ·  view source on GitHub ↗

Specify `config_file` to run monai bundle components and workflows. Typical usage examples: .. code-block:: bash # Execute this module as a CLI entry: python -m monai.bundle run --meta_file --config_file # Execute with specified `run

(
    run_id: str | None = None,
    init_id: str | None = None,
    final_id: str | None = None,
    meta_file: str | Sequence[str] | None = None,
    config_file: str | Sequence[str] | None = None,
    logging_file: str | None = None,
    tracking: str | dict | None = None,
    args_file: str | None = None,
    **override: Any,
)

Source from the content-addressed store, hash-verified

922
923
924def run(
925 run_id: str | None = None,
926 init_id: str | None = None,
927 final_id: str | None = None,
928 meta_file: str | Sequence[str] | None = None,
929 config_file: str | Sequence[str] | None = None,
930 logging_file: str | None = None,
931 tracking: str | dict | None = None,
932 args_file: str | None = None,
933 **override: Any,
934) -> None:
935 """
936 Specify `config_file` to run monai bundle components and workflows.
937
938 Typical usage examples:
939
940 .. code-block:: bash
941
942 # Execute this module as a CLI entry:
943 python -m monai.bundle run --meta_file <meta path> --config_file <config path>
944
945 # Execute with specified `run_id=training`:
946 python -m monai.bundle run training --meta_file <meta path> --config_file <config path>
947
948 # Execute with all specified `run_id=runtest`, `init_id=inittest`, `final_id=finaltest`:
949 python -m monai.bundle run --run_id runtest --init_id inittest --final_id finaltest ...
950
951 # Override config values at runtime by specifying the component id and its new value:
952 python -m monai.bundle run --net#input_chns 1 ...
953
954 # Override config values with another config file `/path/to/another.json`:
955 python -m monai.bundle run --net %/path/to/another.json ...
956
957 # Override config values with part content of another config file:
958 python -m monai.bundle run --net %/data/other.json#net_arg ...
959
960 # Set default args of `run` in a JSON / YAML file, help to record and simplify the command line.
961 # Other args still can override the default args at runtime:
962 python -m monai.bundle run --args_file "/workspace/data/args.json" --config_file <config path>
963
964 Args:
965 run_id: ID name of the expected config expression to run, default to "run".
966 to run the config, the target config must contain this ID.
967 init_id: ID name of the expected config expression to initialize before running, default to "initialize".
968 it&#x27;s optional for both configs and this `run` function.
969 final_id: ID name of the expected config expression to finalize after running, default to "finalize".
970 it&#x27;s optional for both configs and this `run` function.
971 meta_file: filepath of the metadata file, if it is a list of file paths, the content of them will be merged.
972 Default to None.
973 config_file: filepath of the config file, if `None`, must be provided in `args_file`.
974 if it is a list of file paths, the content of them will be merged.
975 logging_file: config file for `logging` module in the program. for more details:
976 https://docs.python.org/3/library/logging.config.html#logging.config.fileConfig.
977 Default to None.
978 tracking: if not None, enable the experiment tracking at runtime with optionally configurable and extensible.
979 If "mlflow", will add `MLFlowHandler` to the parsed bundle with default tracking settings where a set of
980 common parameters shown below will be added and can be passed through the `override` parameter of this method.
981

Callers

nothing calls this directly

Calls 3

create_workflowFunction · 0.85
runMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected