Unset CUBLAS_WORKSPACE_CONFIG for non-deterministic training and inference (#19138)
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
parent
31e96e20d3
commit
ff1a04609f
5 changed files with 16 additions and 3 deletions
|
|
@ -488,8 +488,15 @@ def init_seeds(seed=0, deterministic=False):
|
|||
else:
|
||||
LOGGER.warning("WARNING ⚠️ Upgrade to torch>=2.0.0 for deterministic training.")
|
||||
else:
|
||||
torch.use_deterministic_algorithms(False)
|
||||
torch.backends.cudnn.deterministic = False
|
||||
unset_deterministic()
|
||||
|
||||
|
||||
def unset_deterministic():
|
||||
"""Unsets all the configurations applied for deterministic training."""
|
||||
torch.use_deterministic_algorithms(False)
|
||||
torch.backends.cudnn.deterministic = False
|
||||
os.environ.pop("CUBLAS_WORKSPACE_CONFIG", None)
|
||||
os.environ.pop("PYTHONHASHSEED", None)
|
||||
|
||||
|
||||
class ModelEMA:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue