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
76c00c72
Unverified
Commit
76c00c72
authored
Oct 22, 2024
by
Dhruv Nair
Committed by
GitHub
Oct 22, 2024
Browse files
is_safetensors_compatible fix (#9741)
update
parent
0d9d98fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
src/diffusers/pipelines/pipeline_loading_utils.py
src/diffusers/pipelines/pipeline_loading_utils.py
+4
-0
tests/pipelines/test_pipeline_utils.py
tests/pipelines/test_pipeline_utils.py
+12
-0
No files found.
src/diffusers/pipelines/pipeline_loading_utils.py
View file @
76c00c72
...
...
@@ -118,6 +118,10 @@ def is_safetensors_compatible(filenames, passed_components=None, folder_names=No
components
.
setdefault
(
component
,
[])
components
[
component
].
append
(
component_filename
)
# If there are no component folders check the main directory for safetensors files
if
not
components
:
return
any
(
".safetensors"
in
filename
for
filename
in
filenames
)
# iterate over all files of a component
# check if safetensor files exist for that component
# if variant is provided check if the variant of the safetensors exists
...
...
tests/pipelines/test_pipeline_utils.py
View file @
76c00c72
...
...
@@ -197,6 +197,18 @@ class IsSafetensorsCompatibleTests(unittest.TestCase):
]
self
.
assertTrue
(
is_safetensors_compatible
(
filenames
))
def
test_diffusers_is_compatible_no_components
(
self
):
filenames
=
[
"diffusion_pytorch_model.bin"
,
]
self
.
assertFalse
(
is_safetensors_compatible
(
filenames
))
def
test_diffusers_is_compatible_no_components_only_variants
(
self
):
filenames
=
[
"diffusion_pytorch_model.fp16.bin"
,
]
self
.
assertFalse
(
is_safetensors_compatible
(
filenames
))
class
ProgressBarTests
(
unittest
.
TestCase
):
def
get_dummy_components_image_generation
(
self
):
...
...
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