From ec9f4a7b1a3d3580bdea40107f54bb3a43e361f5 Mon Sep 17 00:00:00 2001 From: Francesco Mattioli Date: Wed, 11 Sep 2024 19:03:41 +0200 Subject: [PATCH] Non-Deterministic Training Despite deterministic=True (#15961) Co-authored-by: UltralyticsAssistant Co-authored-by: Glenn Jocher Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com> --- ultralytics/data/base.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ultralytics/data/base.py b/ultralytics/data/base.py index 703fbae7..f18c2d54 100644 --- a/ultralytics/data/base.py +++ b/ultralytics/data/base.py @@ -91,6 +91,11 @@ class BaseDataset(Dataset): self.npy_files = [Path(f).with_suffix(".npy") for f in self.im_files] self.cache = cache.lower() if isinstance(cache, str) else "ram" if cache is True else None if (self.cache == "ram" and self.check_cache_ram()) or self.cache == "disk": + if self.cache == "ram" and hyp.deterministic: + LOGGER.warning( + "WARNING ⚠️ cache='ram' may produce non-deterministic training results. " + "Consider cache='disk' as a deterministic alternative if your disk space allows." + ) self.cache_images() # Transforms