MCPcopy Create free account
hub / github.com/AlayaLab/Hive / enable_full_determinism

Function enable_full_determinism

models/flowsep/diffusers/utils/testing_utils.py:564–579  ·  view source on GitHub ↗

Helper function for reproducible behavior during distributed training. See - https://pytorch.org/docs/stable/notes/randomness.html for pytorch

()

Source from the content-addressed store, hash-verified

562
563
564def enable_full_determinism():
565 """
566 Helper function for reproducible behavior during distributed training. See
567 - https://pytorch.org/docs/stable/notes/randomness.html for pytorch
568 """
569 # Enable PyTorch deterministic mode. This potentially requires either the environment
570 # variable 'CUDA_LAUNCH_BLOCKING' or 'CUBLAS_WORKSPACE_CONFIG' to be set,
571 # depending on the CUDA version, so we set them both here
572 os.environ["CUDA_LAUNCH_BLOCKING"] = "1"
573 os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":16:8"
574 torch.use_deterministic_algorithms(True)
575
576 # Enable CUDNN deterministic mode
577 torch.backends.cudnn.deterministic = True
578 torch.backends.cudnn.benchmark = False
579 torch.backends.cuda.matmul.allow_tf32 = False

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected