Unverified Commit daccde14 authored by Frank995's avatar Frank995 Committed by GitHub
Browse files

Allow for warn_only selection in enable_full_determinism (#24496)

* Warn only in enable full determinism

* Add option in the function definition
parent 11cb6e0f
...@@ -55,7 +55,7 @@ def seed_worker(_): ...@@ -55,7 +55,7 @@ def seed_worker(_):
set_seed(worker_seed) set_seed(worker_seed)
def enable_full_determinism(seed: int): def enable_full_determinism(seed: int, warn_only: bool = False):
""" """
Helper function for reproducible behavior during distributed training. See Helper function for reproducible behavior during distributed training. See
- https://pytorch.org/docs/stable/notes/randomness.html for pytorch - https://pytorch.org/docs/stable/notes/randomness.html for pytorch
...@@ -70,7 +70,7 @@ def enable_full_determinism(seed: int): ...@@ -70,7 +70,7 @@ def enable_full_determinism(seed: int):
# depending on the CUDA version, so we set them both here # depending on the CUDA version, so we set them both here
os.environ["CUDA_LAUNCH_BLOCKING"] = "1" os.environ["CUDA_LAUNCH_BLOCKING"] = "1"
os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":16:8" os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":16:8"
torch.use_deterministic_algorithms(True) torch.use_deterministic_algorithms(True, warn_only=warn_only)
# Enable CUDNN deterministic mode # Enable CUDNN deterministic mode
torch.backends.cudnn.deterministic = True torch.backends.cudnn.deterministic = True
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment