Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
41cf4097
Unverified
Commit
41cf4097
authored
Jun 05, 2024
by
Huazhong Ji
Committed by
GitHub
Jun 05, 2024
Browse files
enable deterministic mode for npu (#31253)
parent
4a602492
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
0 deletions
+3
-0
src/transformers/trainer_utils.py
src/transformers/trainer_utils.py
+3
-0
No files found.
src/transformers/trainer_utils.py
View file @
41cf4097
...
...
@@ -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
os
.
environ
[
"CUDA_LAUNCH_BLOCKING"
]
=
"1"
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
)
# Enable CUDNN deterministic mode
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment