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
6b548129
Unverified
Commit
6b548129
authored
Jun 07, 2023
by
Younes Belkada
Committed by
GitHub
Jun 07, 2023
Browse files
[`Hub`] Add `safe_serialization` in push_to_hub (#24074)
add `safe_serialization` in push_to_hub
parent
6daf7c31
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
src/transformers/utils/hub.py
src/transformers/utils/hub.py
+4
-1
No files found.
src/transformers/utils/hub.py
View file @
6b548129
...
...
@@ -740,6 +740,7 @@ class PushToHubMixin:
use_auth_token
:
Optional
[
Union
[
bool
,
str
]]
=
None
,
max_shard_size
:
Optional
[
Union
[
int
,
str
]]
=
"10GB"
,
create_pr
:
bool
=
False
,
safe_serialization
:
bool
=
False
,
**
deprecated_kwargs
,
)
->
str
:
"""
...
...
@@ -767,6 +768,8 @@ class PushToHubMixin:
by a unit (like `"5MB"`).
create_pr (`bool`, *optional*, defaults to `False`):
Whether or not to create a PR with the uploaded files or directly commit.
safe_serialization (`bool`, *optional*, defaults to `False`):
Whether or not to convert the model weights in safetensors format for safer serialization.
Examples:
...
...
@@ -809,7 +812,7 @@ class PushToHubMixin:
files_timestamps
=
self
.
_get_files_timestamps
(
work_dir
)
# Save all files.
self
.
save_pretrained
(
work_dir
,
max_shard_size
=
max_shard_size
)
self
.
save_pretrained
(
work_dir
,
max_shard_size
=
max_shard_size
,
safe_serialization
=
safe_serialization
)
return
self
.
_upload_modified_files
(
work_dir
,
...
...
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