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
chenpangpang
ComfyUI
Commits
0e836d52
"vscode:/vscode.git/clone" did not exist on "6cb740469885d682e08d6c052e1b3e79b49bed1f"
Commit
0e836d52
authored
Mar 13, 2023
by
comfyanonymous
Browse files
use half() on fp16 models loaded with config.
parent
986dd820
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
comfy/sd.py
comfy/sd.py
+10
-0
No files found.
comfy/sd.py
View file @
0e836d52
...
@@ -733,6 +733,12 @@ def load_checkpoint(config_path, ckpt_path, output_vae=True, output_clip=True, e
...
@@ -733,6 +733,12 @@ def load_checkpoint(config_path, ckpt_path, output_vae=True, output_clip=True, e
scale_factor
=
model_config_params
[
'scale_factor'
]
scale_factor
=
model_config_params
[
'scale_factor'
]
vae_config
=
model_config_params
[
'first_stage_config'
]
vae_config
=
model_config_params
[
'first_stage_config'
]
fp16
=
False
if
"unet_config"
in
model_config_params
:
if
"params"
in
model_config_params
[
"unet_config"
]:
if
"use_fp16"
in
model_config_params
[
"unet_config"
][
"params"
]:
fp16
=
model_config_params
[
"unet_config"
][
"params"
][
"use_fp16"
]
clip
=
None
clip
=
None
vae
=
None
vae
=
None
...
@@ -754,6 +760,10 @@ def load_checkpoint(config_path, ckpt_path, output_vae=True, output_clip=True, e
...
@@ -754,6 +760,10 @@ def load_checkpoint(config_path, ckpt_path, output_vae=True, output_clip=True, e
model
=
instantiate_from_config
(
config
[
"model"
])
model
=
instantiate_from_config
(
config
[
"model"
])
sd
=
load_torch_file
(
ckpt_path
)
sd
=
load_torch_file
(
ckpt_path
)
model
=
load_model_weights
(
model
,
sd
,
verbose
=
False
,
load_state_dict_to
=
load_state_dict_to
)
model
=
load_model_weights
(
model
,
sd
,
verbose
=
False
,
load_state_dict_to
=
load_state_dict_to
)
if
fp16
:
model
=
model
.
half
()
return
(
ModelPatcher
(
model
),
clip
,
vae
)
return
(
ModelPatcher
(
model
),
clip
,
vae
)
...
...
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