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
ffb6777a
Unverified
Commit
ffb6777a
authored
Feb 21, 2025
by
Marc Sun
Committed by
GitHub
Feb 21, 2025
Browse files
remove format check for safetensors file (#10864)
remove check
parent
85fcbaf3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
14 deletions
+0
-14
src/diffusers/models/model_loading_utils.py
src/diffusers/models/model_loading_utils.py
+0
-14
No files found.
src/diffusers/models/model_loading_utils.py
View file @
ffb6777a
...
...
@@ -134,19 +134,6 @@ def _fetch_remapped_cls_from_config(config, old_class):
return
old_class
def
_check_archive_and_maybe_raise_error
(
checkpoint_file
,
format_list
):
"""
Check format of the archive
"""
with
safetensors
.
safe_open
(
checkpoint_file
,
framework
=
"pt"
)
as
f
:
metadata
=
f
.
metadata
()
if
metadata
is
not
None
and
metadata
.
get
(
"format"
)
not
in
format_list
:
raise
OSError
(
f
"The safetensors archive passed at
{
checkpoint_file
}
does not contain the valid metadata. Make sure "
"you save your model with the `save_pretrained` method."
)
def
_determine_param_device
(
param_name
:
str
,
device_map
:
Optional
[
Dict
[
str
,
Union
[
int
,
str
,
torch
.
device
]]]):
"""
Find the device of param_name from the device_map.
...
...
@@ -183,7 +170,6 @@ def load_state_dict(
# tensors are loaded on cpu
with
dduf_entries
[
checkpoint_file
].
as_mmap
()
as
mm
:
return
safetensors
.
torch
.
load
(
mm
)
_check_archive_and_maybe_raise_error
(
checkpoint_file
,
format_list
=
[
"pt"
,
"flax"
])
if
disable_mmap
:
return
safetensors
.
torch
.
load
(
open
(
checkpoint_file
,
"rb"
).
read
())
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