diff --git a/anomalib/config/config.py b/anomalib/config/config.py index 62b9d47cde..3ca25f5918 100644 --- a/anomalib/config/config.py +++ b/anomalib/config/config.py @@ -142,6 +142,15 @@ def get_configurable_parameters( # keep track of the original config file because it will be modified config_original: DictConfig = config.copy() + # if the seed value is 0, notify a user that the behavior of the seed value zero has been changed. + if config.project.get("seed") == 0: + warn( + "The seed value is now fixed to 0. " + "Up to v0.3.7, the seed was not fixed when the seed value was set to 0. " + "If you want to use the random seed, please select `None` for the seed value " + "(`null` in the YAML file) or remove the `seed` key from the YAML file." + ) + # Dataset Configs if "format" not in config.dataset.keys(): config.dataset.format = "mvtec" diff --git a/tools/hpo/sweep.py b/tools/hpo/sweep.py index 771d93ac58..d14d43c1d3 100644 --- a/tools/hpo/sweep.py +++ b/tools/hpo/sweep.py @@ -35,7 +35,7 @@ def get_args(): model_config = get_configurable_parameters(model_name=args.model, config_path=args.model_config) hpo_config = OmegaConf.load(args.sweep_config) - if model_config.project.seed != 0: + if model_config.project.get("seed") is not None: seed_everything(model_config.project.seed) # check hpo config structure to see whether it adheres to comet or wandb format diff --git a/tools/train.py b/tools/train.py index 0bb00c8179..9416906951 100644 --- a/tools/train.py +++ b/tools/train.py @@ -47,7 +47,7 @@ def train(): warnings.filterwarnings("ignore") config = get_configurable_parameters(model_name=args.model, config_path=args.config) - if config.project.seed: + if config.project.get("seed") is not None: seed_everything(config.project.seed) datamodule = get_datamodule(config)