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
renzhc
diffusers_dcu
Commits
f354dd9e
Unverified
Commit
f354dd9e
authored
Jan 19, 2023
by
Patrick von Platen
Committed by
GitHub
Jan 19, 2023
Browse files
[Save Pretrained] Remove dead code lines that can accidentally remove pytorch files (#2038)
correct safetensors
parent
007c914c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
9 deletions
+0
-9
src/diffusers/models/modeling_utils.py
src/diffusers/models/modeling_utils.py
+0
-9
No files found.
src/diffusers/models/modeling_utils.py
View file @
f354dd9e
...
@@ -272,15 +272,6 @@ class ModelMixin(torch.nn.Module):
...
@@ -272,15 +272,6 @@ class ModelMixin(torch.nn.Module):
weights_name
=
SAFETENSORS_WEIGHTS_NAME
if
safe_serialization
else
WEIGHTS_NAME
weights_name
=
SAFETENSORS_WEIGHTS_NAME
if
safe_serialization
else
WEIGHTS_NAME
# Clean the folder from a previous save
for
filename
in
os
.
listdir
(
save_directory
):
full_filename
=
os
.
path
.
join
(
save_directory
,
filename
)
# If we have a shard file that is not going to be replaced, we delete it, but only from the main process
# in distributed settings to avoid race conditions.
weights_no_suffix
=
weights_name
.
replace
(
".bin"
,
""
).
replace
(
".safetensors"
,
""
)
if
filename
.
startswith
(
weights_no_suffix
)
and
os
.
path
.
isfile
(
full_filename
)
and
is_main_process
:
os
.
remove
(
full_filename
)
# Save the model
# Save the model
save_function
(
state_dict
,
os
.
path
.
join
(
save_directory
,
weights_name
))
save_function
(
state_dict
,
os
.
path
.
join
(
save_directory
,
weights_name
))
...
...
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