-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Add option to set determinism with bundle configs #4942
Description
Is your feature request related to a problem? Please describe.
There should be a configuration option to enable deterministic training with monai bundle. Currently, a user has to add python code in the "training" portion of the config:
"training": [
"$monai.utils.set_determinism(seed=123)",
"$setattr(torch.backends.cudnn, 'benchmark', True)",
"$@train#trainer.run()"
]
This can be difficult to use in security-constrained environments such as in federated learning, where one might want to disable the python code execution in the bundle.
Describe the solution you'd like
There should be an option to set the deterministic behavior using configuration style options, e.g., the below to achieve the same behavior as above:
"determinism": {
"random_seed": 123,
"benchmark": True
}
Describe alternatives you've considered
MonaiAlgo for executing FL training does not run the "training" section in the config. Therefore the code there is not being executed. One can achieve determinism by using the "required" option for the SupervisedTrainer but this will not work if python code is disabled.
Additional context
Especially important feature to support FL.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status