mirror of
https://github.com/huggingface/transformers.git
synced 2025-08-02 19:21:31 +06:00
enable deterministic mode for npu (#31253)
This commit is contained in:
parent
4a6024921f
commit
41cf4097f7
@ -71,6 +71,9 @@ def enable_full_determinism(seed: int, warn_only: bool = False):
|
|||||||
# 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"
|
||||||
|
# The environment variable required to enable deterministic mode on Ascend NPUs.
|
||||||
|
os.environ["ASCEND_LAUNCH_BLOCKING"] = 1
|
||||||
|
os.environ["HCCL_DETERMINISTIC"] = 1
|
||||||
torch.use_deterministic_algorithms(True, warn_only=warn_only)
|
torch.use_deterministic_algorithms(True, warn_only=warn_only)
|
||||||
|
|
||||||
# Enable CUDNN deterministic mode
|
# Enable CUDNN deterministic mode
|
||||||
|
Loading…
Reference in New Issue
Block a user