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
29ff8716
Unverified
Commit
29ff8716
authored
Dec 12, 2022
by
Sylvain Gugger
Committed by
GitHub
Dec 12, 2022
Browse files
Add a progress bar for large model loading (#20713)
parent
5f94855d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+2
-0
No files found.
src/transformers/modeling_utils.py
View file @
29ff8716
...
...
@@ -2659,6 +2659,8 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin, GenerationMixin, PushToHubMix
else
:
disk_only_shard_files
=
[]
if
len
(
resolved_archive_file
)
>
1
:
resolved_archive_file
=
logging
.
tqdm
(
resolved_archive_file
,
desc
=
"Loading checkpoint shards"
)
for
shard_file
in
resolved_archive_file
:
# Skip the load for shards that only contain disk-offloaded weights when using safetensors for the offload.
if
shard_file
in
disk_only_shard_files
:
...
...
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