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
OpenDAS
diffusers
Commits
ed8fd383
Unverified
Commit
ed8fd383
authored
Apr 17, 2023
by
Patrick von Platen
Committed by
GitHub
Apr 17, 2023
Browse files
Improve deprecation warnings (#3131)
parent
ca783a0f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
src/diffusers/pipelines/pipeline_utils.py
src/diffusers/pipelines/pipeline_utils.py
+5
-5
tests/models/test_lora_layers.py
tests/models/test_lora_layers.py
+1
-0
No files found.
src/diffusers/pipelines/pipeline_utils.py
View file @
ed8fd383
...
@@ -201,24 +201,24 @@ def variant_compatible_siblings(filenames, variant=None) -> Union[List[os.PathLi
...
@@ -201,24 +201,24 @@ def variant_compatible_siblings(filenames, variant=None) -> Union[List[os.PathLi
# .bin, .safetensors, ...
# .bin, .safetensors, ...
weight_suffixs
=
[
w
.
split
(
"."
)[
-
1
]
for
w
in
weight_names
]
weight_suffixs
=
[
w
.
split
(
"."
)[
-
1
]
for
w
in
weight_names
]
# -00001-of-00002
# -00001-of-00002
transformers_index_format
=
"\d{5}-of-\d{5}"
transformers_index_format
=
r
"\d{5}-of-\d{5}"
if
variant
is
not
None
:
if
variant
is
not
None
:
# `diffusion_pytorch_model.fp16.bin` as well as `model.fp16-00001-of-00002.safetenstors`
# `diffusion_pytorch_model.fp16.bin` as well as `model.fp16-00001-of-00002.safetenstors`
variant_file_re
=
re
.
compile
(
variant_file_re
=
re
.
compile
(
f
"(
{
'|'
.
join
(
weight_prefixes
)
}
)\.(
{
variant
}
|
{
variant
}
-
{
transformers_index_format
}
)\.(
{
'|'
.
join
(
weight_suffixs
)
}
)$"
r
f
"(
{
'|'
.
join
(
weight_prefixes
)
}
)\.(
{
variant
}
|
{
variant
}
-
{
transformers_index_format
}
)\.(
{
'|'
.
join
(
weight_suffixs
)
}
)$"
)
)
# `text_encoder/pytorch_model.bin.index.fp16.json`
# `text_encoder/pytorch_model.bin.index.fp16.json`
variant_index_re
=
re
.
compile
(
variant_index_re
=
re
.
compile
(
f
"(
{
'|'
.
join
(
weight_prefixes
)
}
)\.(
{
'|'
.
join
(
weight_suffixs
)
}
)\.index\.
{
variant
}
\.json$"
r
f
"(
{
'|'
.
join
(
weight_prefixes
)
}
)\.(
{
'|'
.
join
(
weight_suffixs
)
}
)\.index\.
{
variant
}
\.json$"
)
)
# `diffusion_pytorch_model.bin` as well as `model-00001-of-00002.safetenstors`
# `diffusion_pytorch_model.bin` as well as `model-00001-of-00002.safetenstors`
non_variant_file_re
=
re
.
compile
(
non_variant_file_re
=
re
.
compile
(
f
"(
{
'|'
.
join
(
weight_prefixes
)
}
)(-
{
transformers_index_format
}
)?\.(
{
'|'
.
join
(
weight_suffixs
)
}
)$"
r
f
"(
{
'|'
.
join
(
weight_prefixes
)
}
)(-
{
transformers_index_format
}
)?\.(
{
'|'
.
join
(
weight_suffixs
)
}
)$"
)
)
# `text_encoder/pytorch_model.bin.index.json`
# `text_encoder/pytorch_model.bin.index.json`
non_variant_index_re
=
re
.
compile
(
f
"(
{
'|'
.
join
(
weight_prefixes
)
}
)\.(
{
'|'
.
join
(
weight_suffixs
)
}
)\.index\.json"
)
non_variant_index_re
=
re
.
compile
(
r
f
"(
{
'|'
.
join
(
weight_prefixes
)
}
)\.(
{
'|'
.
join
(
weight_suffixs
)
}
)\.index\.json"
)
if
variant
is
not
None
:
if
variant
is
not
None
:
variant_weights
=
{
f
for
f
in
filenames
if
variant_file_re
.
match
(
f
.
split
(
"/"
)[
-
1
])
is
not
None
}
variant_weights
=
{
f
for
f
in
filenames
if
variant_file_re
.
match
(
f
.
split
(
"/"
)[
-
1
])
is
not
None
}
...
...
tests/models/test_lora_layers.py
View file @
ed8fd383
...
@@ -71,6 +71,7 @@ class LoraLoaderMixinTests(unittest.TestCase):
...
@@ -71,6 +71,7 @@ class LoraLoaderMixinTests(unittest.TestCase):
beta_schedule
=
"scaled_linear"
,
beta_schedule
=
"scaled_linear"
,
clip_sample
=
False
,
clip_sample
=
False
,
set_alpha_to_one
=
False
,
set_alpha_to_one
=
False
,
steps_offset
=
1
,
)
)
torch
.
manual_seed
(
0
)
torch
.
manual_seed
(
0
)
vae
=
AutoencoderKL
(
vae
=
AutoencoderKL
(
...
...
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