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
9ddbb696
Unverified
Commit
9ddbb696
authored
Dec 01, 2023
by
Liangliang-Ma
Committed by
GitHub
Dec 01, 2023
Browse files
Fix unsupported setting of self._n_gpu in training_args on XPU devices (#27716)
change xpu _n_gpu = 1
parent
29f1aee3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/training_args.py
src/transformers/training_args.py
+1
-1
No files found.
src/transformers/training_args.py
View file @
9ddbb696
...
@@ -1879,7 +1879,7 @@ class TrainingArguments:
...
@@ -1879,7 +1879,7 @@ class TrainingArguments:
elif
self
.
distributed_state
.
distributed_type
==
DistributedType
.
MULTI_XPU
:
elif
self
.
distributed_state
.
distributed_type
==
DistributedType
.
MULTI_XPU
:
if
"ACCELERATE_USE_XPU"
not
in
os
.
environ
:
if
"ACCELERATE_USE_XPU"
not
in
os
.
environ
:
os
.
environ
[
"ACCELERATE_USE_XPU"
]
=
"true"
os
.
environ
[
"ACCELERATE_USE_XPU"
]
=
"true"
self
.
_n_gpu
=
torch
.
xpu
.
device_count
()
self
.
_n_gpu
=
1
device
=
torch
.
device
(
"xpu:0"
)
device
=
torch
.
device
(
"xpu:0"
)
torch
.
xpu
.
set_device
(
device
)
torch
.
xpu
.
set_device
(
device
)
elif
self
.
distributed_state
.
distributed_type
==
DistributedType
.
NO
:
elif
self
.
distributed_state
.
distributed_type
==
DistributedType
.
NO
:
...
...
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