diff --git a/monai/bundle/properties.py b/monai/bundle/properties.py index 744b961c16..16ecf77268 100644 --- a/monai/bundle/properties.py +++ b/monai/bundle/properties.py @@ -58,16 +58,17 @@ BundleProperty.REQUIRED: True, BundlePropertyConfig.ID: f"train{ID_SEP_KEY}dataset", }, - "train_dataset_data": { - BundleProperty.DESC: "data source for the training dataset.", - BundleProperty.REQUIRED: True, - BundlePropertyConfig.ID: f"train{ID_SEP_KEY}dataset{ID_SEP_KEY}data", - }, "train_inferer": { BundleProperty.DESC: "MONAI Inferer object to execute the model computation in training.", BundleProperty.REQUIRED: True, BundlePropertyConfig.ID: f"train{ID_SEP_KEY}inferer", }, + "train_dataset_data": { + BundleProperty.DESC: "data source for the training dataset.", + BundleProperty.REQUIRED: False, + BundlePropertyConfig.ID: f"train{ID_SEP_KEY}dataset{ID_SEP_KEY}data", + BundlePropertyConfig.REF_ID: None, # no reference to this ID + }, "train_handlers": { BundleProperty.DESC: "event-handlers for the training logic.", BundleProperty.REQUIRED: False, @@ -169,11 +170,6 @@ BundleProperty.REQUIRED: True, BundlePropertyConfig.ID: "dataset", }, - "dataset_data": { - BundleProperty.DESC: "data source for the inference / evaluation dataset.", - BundleProperty.REQUIRED: True, - BundlePropertyConfig.ID: f"dataset{ID_SEP_KEY}data", - }, "evaluator": { BundleProperty.DESC: "inference / evaluation workflow engine.", BundleProperty.REQUIRED: True, @@ -189,6 +185,12 @@ BundleProperty.REQUIRED: True, BundlePropertyConfig.ID: "inferer", }, + "dataset_data": { + BundleProperty.DESC: "data source for the inference / evaluation dataset.", + BundleProperty.REQUIRED: False, + BundlePropertyConfig.ID: f"dataset{ID_SEP_KEY}data", + BundlePropertyConfig.REF_ID: None, # no reference to this ID + }, "handlers": { BundleProperty.DESC: "event-handlers for the inference / evaluation logic.", BundleProperty.REQUIRED: False, diff --git a/monai/bundle/workflows.py b/monai/bundle/workflows.py index 3d80055674..6bd966592e 100644 --- a/monai/bundle/workflows.py +++ b/monai/bundle/workflows.py @@ -371,6 +371,7 @@ def _check_optional_id(self, name: str, property: dict) -> bool: # no ID of reference config item, skipping check for this optional property return True # check validation `validator` and `interval` properties as the handler index of ValidationHandler is unknown + ref: str | None = None if name in ("evaluator", "val_interval"): if f"train{ID_SEP_KEY}handlers" in self.parser: for h in self.parser[f"train{ID_SEP_KEY}handlers"]: diff --git a/monai/utils/enums.py b/monai/utils/enums.py index 25c747ed90..572cd9293d 100644 --- a/monai/utils/enums.py +++ b/monai/utils/enums.py @@ -671,6 +671,7 @@ class BundlePropertyConfig(StrEnum): additional bundle property fields for config based bundle workflow: `ID` is the config item ID of the property. `REF_ID` is the ID of config item which is supposed to refer to this property. + For properties that do not have `REF_ID`, `None` should be set. this field is only useful to check the optional property ID. """