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
beb932c5
Unverified
Commit
beb932c5
authored
Jan 10, 2023
by
Patrick von Platen
Committed by
GitHub
Jan 10, 2023
Browse files
[Conversion SD] Make sure weirdly sorted keys work as well (#1959)
parent
4401e6aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
scripts/convert_original_stable_diffusion_to_diffusers.py
scripts/convert_original_stable_diffusion_to_diffusers.py
+3
-2
No files found.
scripts/convert_original_stable_diffusion_to_diffusers.py
View file @
beb932c5
...
@@ -443,8 +443,9 @@ def convert_ldm_unet_checkpoint(checkpoint, config, path=None, extract_ema=False
...
@@ -443,8 +443,9 @@ def convert_ldm_unet_checkpoint(checkpoint, config, path=None, extract_ema=False
paths
,
new_checkpoint
,
unet_state_dict
,
additional_replacements
=
[
meta_path
],
config
=
config
paths
,
new_checkpoint
,
unet_state_dict
,
additional_replacements
=
[
meta_path
],
config
=
config
)
)
if
[
"conv.weight"
,
"conv.bias"
]
in
output_block_list
.
values
():
output_block_list
=
{
k
:
sorted
(
v
)
for
k
,
v
in
output_block_list
.
items
()}
index
=
list
(
output_block_list
.
values
()).
index
([
"conv.weight"
,
"conv.bias"
])
if
[
"conv.bias"
,
"conv.weight"
]
in
output_block_list
.
values
():
index
=
list
(
output_block_list
.
values
()).
index
([
"conv.bias"
,
"conv.weight"
])
new_checkpoint
[
f
"up_blocks.
{
block_id
}
.upsamplers.0.conv.weight"
]
=
unet_state_dict
[
new_checkpoint
[
f
"up_blocks.
{
block_id
}
.upsamplers.0.conv.weight"
]
=
unet_state_dict
[
f
"output_blocks.
{
i
}
.
{
index
}
.conv.weight"
f
"output_blocks.
{
i
}
.
{
index
}
.conv.weight"
]
]
...
...
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