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
47c5c059
Unverified
Commit
47c5c059
authored
Apr 06, 2022
by
Suraj Patil
Committed by
GitHub
Apr 06, 2022
Browse files
don't load state_dict twice when using low_cpu_mem_usage in from_pretrained (#16602)
parent
a2b7d19b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
1 deletion
+0
-1
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+0
-1
No files found.
src/transformers/modeling_utils.py
View file @
47c5c059
...
...
@@ -1823,7 +1823,6 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
if
is_sharded
:
loaded_state_dict_keys
=
sharded_metadata
[
"all_checkpoint_keys"
]
else
:
state_dict
=
load_state_dict
(
resolved_archive_file
)
loaded_state_dict_keys
=
[
k
for
k
in
state_dict
.
keys
()]
del
state_dict
# free CPU memory - will reload again later
...
...
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