Non-Deterministic Training Despite deterministic=True (#15961)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com>
This commit is contained in:
Francesco Mattioli 2024-09-11 19:03:41 +02:00 committed by GitHub
parent 7c61569630
commit ec9f4a7b1a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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