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
09a9888f
Unverified
Commit
09a9888f
authored
Apr 06, 2023
by
Younes Belkada
Committed by
GitHub
Apr 06, 2023
Browse files
[`bnb`] 8bit models should not be converted to `DDP` (#22628)
add safety checker
parent
d0b83fe2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/transformers/trainer.py
src/transformers/trainer.py
+2
-2
No files found.
src/transformers/trainer.py
View file @
09a9888f
...
@@ -1406,8 +1406,8 @@ class Trainer:
...
@@ -1406,8 +1406,8 @@ class Trainer:
if
self
.
use_apex
and
training
:
if
self
.
use_apex
and
training
:
model
,
self
.
optimizer
=
amp
.
initialize
(
model
,
self
.
optimizer
,
opt_level
=
self
.
args
.
fp16_opt_level
)
model
,
self
.
optimizer
=
amp
.
initialize
(
model
,
self
.
optimizer
,
opt_level
=
self
.
args
.
fp16_opt_level
)
# Multi-gpu training (should be after apex fp16 initialization)
# Multi-gpu training (should be after apex fp16 initialization)
/ 8bit models does not support DDP
if
self
.
args
.
n_gpu
>
1
:
if
self
.
args
.
n_gpu
>
1
and
not
getattr
(
model
,
"is_loaded_in_8bit"
,
False
)
:
model
=
nn
.
DataParallel
(
model
)
model
=
nn
.
DataParallel
(
model
)
if
self
.
args
.
jit_mode_eval
:
if
self
.
args
.
jit_mode_eval
:
...
...
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