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
e342ac7e
Unverified
Commit
e342ac7e
authored
Nov 30, 2022
by
Sylvain Gugger
Committed by
GitHub
Nov 30, 2022
Browse files
Add some warning for Dynamo and enable TF32 when it's set (#20515)
parent
68cfffc4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
src/transformers/training_args.py
src/transformers/training_args.py
+9
-0
No files found.
src/transformers/training_args.py
View file @
e342ac7e
...
@@ -1148,6 +1148,15 @@ class TrainingArguments:
...
@@ -1148,6 +1148,15 @@ class TrainingArguments:
" (`--bf16_full_eval`) can only be used on CUDA or CPU devices."
" (`--bf16_full_eval`) can only be used on CUDA or CPU devices."
)
)
if
self
.
framework
==
"pt"
and
is_torch_available
()
and
self
.
torchdynamo
is
not
None
:
if
is_torch_tf32_available
():
if
self
.
tf32
is
None
and
not
self
.
fp16
or
self
.
bf16
:
logger
.
info
(
"Setting TF32 in CUDA backends to speedup torchdynamo."
)
torch
.
backends
.
cuda
.
matmul
.
allow_tf32
=
True
else
:
logger
.
warning
(
"The speedups for torchdynamo mostly come wih GPU Ampere or higher and which is not detected here."
)
if
self
.
framework
==
"pt"
and
is_torch_available
()
and
self
.
tf32
is
not
None
:
if
self
.
framework
==
"pt"
and
is_torch_available
()
and
self
.
tf32
is
not
None
:
if
self
.
tf32
:
if
self
.
tf32
:
if
is_torch_tf32_available
():
if
is_torch_tf32_available
():
...
...
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