Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
ce32c69c
Unverified
Commit
ce32c69c
authored
Sep 17, 2021
by
Alex Hedges
Committed by
GitHub
Sep 17, 2021
Browse files
Use `config_dict_or_path` for deepspeed.zero.Init (#13614)
parent
0eb02871
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+1
-1
No files found.
src/transformers/modeling_utils.py
View file @
ce32c69c
...
@@ -1340,7 +1340,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
...
@@ -1340,7 +1340,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
logger
.
info
(
"Detected DeepSpeed ZeRO-3: activating zero.init() for this model"
)
logger
.
info
(
"Detected DeepSpeed ZeRO-3: activating zero.init() for this model"
)
# this immediately partitions the model across all gpus, to avoid the overhead in time
# this immediately partitions the model across all gpus, to avoid the overhead in time
# and memory copying it on CPU or each GPU first
# and memory copying it on CPU or each GPU first
with
deepspeed
.
zero
.
Init
(
config
=
deepspeed_config
()):
with
deepspeed
.
zero
.
Init
(
config
_dict_or_path
=
deepspeed_config
()):
with
no_init_weights
(
_enable
=
_fast_init
):
with
no_init_weights
(
_enable
=
_fast_init
):
model
=
cls
(
config
,
*
model_args
,
**
model_kwargs
)
model
=
cls
(
config
,
*
model_args
,
**
model_kwargs
)
else
:
else
:
...
...
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