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
d7dc0ffd
Unverified
Commit
d7dc0ffd
authored
Jan 31, 2024
by
Dhruv Nair
Committed by
GitHub
Jan 31, 2024
Browse files
Fix setting scaling factor in VAE config (#6779)
fix
parent
97ee6169
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
src/diffusers/loaders/single_file.py
src/diffusers/loaders/single_file.py
+2
-1
src/diffusers/loaders/single_file_utils.py
src/diffusers/loaders/single_file_utils.py
+2
-1
No files found.
src/diffusers/loaders/single_file.py
View file @
d7dc0ffd
...
@@ -61,8 +61,9 @@ def build_sub_model_components(
...
@@ -61,8 +61,9 @@ def build_sub_model_components(
return
unet_components
return
unet_components
if
component_name
==
"vae"
:
if
component_name
==
"vae"
:
scaling_factor
=
kwargs
.
get
(
"scaling_factor"
,
None
)
vae_components
=
create_diffusers_vae_model_from_ldm
(
vae_components
=
create_diffusers_vae_model_from_ldm
(
pipeline_class_name
,
original_config
,
checkpoint
,
image_size
pipeline_class_name
,
original_config
,
checkpoint
,
image_size
,
scaling_factor
)
)
return
vae_components
return
vae_components
...
...
src/diffusers/loaders/single_file_utils.py
View file @
d7dc0ffd
...
@@ -513,11 +513,12 @@ def create_controlnet_diffusers_config(original_config, image_size: int):
...
@@ -513,11 +513,12 @@ def create_controlnet_diffusers_config(original_config, image_size: int):
return
controlnet_config
return
controlnet_config
def
create_vae_diffusers_config
(
original_config
,
image_size
,
scaling_factor
=
0.18125
):
def
create_vae_diffusers_config
(
original_config
,
image_size
,
scaling_factor
=
None
):
"""
"""
Creates a config for the diffusers based on the config of the LDM model.
Creates a config for the diffusers based on the config of the LDM model.
"""
"""
vae_params
=
original_config
[
"model"
][
"params"
][
"first_stage_config"
][
"params"
][
"ddconfig"
]
vae_params
=
original_config
[
"model"
][
"params"
][
"first_stage_config"
][
"params"
][
"ddconfig"
]
scaling_factor
=
scaling_factor
or
original_config
[
"model"
][
"params"
][
"scale_factor"
]
block_out_channels
=
[
vae_params
[
"ch"
]
*
mult
for
mult
in
vae_params
[
"ch_mult"
]]
block_out_channels
=
[
vae_params
[
"ch"
]
*
mult
for
mult
in
vae_params
[
"ch_mult"
]]
down_block_types
=
[
"DownEncoderBlock2D"
]
*
len
(
block_out_channels
)
down_block_types
=
[
"DownEncoderBlock2D"
]
*
len
(
block_out_channels
)
...
...
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