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
fd4c5f07
Commit
fd4c5f07
authored
Oct 13, 2023
by
comfyanonymous
Browse files
Add a --bf16-unet to test running the unet in bf16.
parent
9a55dadb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
0 deletions
+4
-0
comfy/cli_args.py
comfy/cli_args.py
+2
-0
comfy/model_management.py
comfy/model_management.py
+2
-0
No files found.
comfy/cli_args.py
View file @
fd4c5f07
...
@@ -53,6 +53,8 @@ fp_group = parser.add_mutually_exclusive_group()
...
@@ -53,6 +53,8 @@ fp_group = parser.add_mutually_exclusive_group()
fp_group
.
add_argument
(
"--force-fp32"
,
action
=
"store_true"
,
help
=
"Force fp32 (If this makes your GPU work better please report it)."
)
fp_group
.
add_argument
(
"--force-fp32"
,
action
=
"store_true"
,
help
=
"Force fp32 (If this makes your GPU work better please report it)."
)
fp_group
.
add_argument
(
"--force-fp16"
,
action
=
"store_true"
,
help
=
"Force fp16."
)
fp_group
.
add_argument
(
"--force-fp16"
,
action
=
"store_true"
,
help
=
"Force fp16."
)
parser
.
add_argument
(
"--bf16-unet"
,
action
=
"store_true"
,
help
=
"Run the UNET in bf16. This should only be used for testing stuff."
)
fpvae_group
=
parser
.
add_mutually_exclusive_group
()
fpvae_group
=
parser
.
add_mutually_exclusive_group
()
fpvae_group
.
add_argument
(
"--fp16-vae"
,
action
=
"store_true"
,
help
=
"Run the VAE in fp16, might cause black images."
)
fpvae_group
.
add_argument
(
"--fp16-vae"
,
action
=
"store_true"
,
help
=
"Run the VAE in fp16, might cause black images."
)
fpvae_group
.
add_argument
(
"--fp32-vae"
,
action
=
"store_true"
,
help
=
"Run the VAE in full precision fp32."
)
fpvae_group
.
add_argument
(
"--fp32-vae"
,
action
=
"store_true"
,
help
=
"Run the VAE in full precision fp32."
)
...
...
comfy/model_management.py
View file @
fd4c5f07
...
@@ -449,6 +449,8 @@ def unet_inital_load_device(parameters, dtype):
...
@@ -449,6 +449,8 @@ def unet_inital_load_device(parameters, dtype):
return
cpu_dev
return
cpu_dev
def
unet_dtype
(
device
=
None
,
model_params
=
0
):
def
unet_dtype
(
device
=
None
,
model_params
=
0
):
if
args
.
bf16_unet
:
return
torch
.
bfloat16
if
should_use_fp16
(
device
=
device
,
model_params
=
model_params
):
if
should_use_fp16
(
device
=
device
,
model_params
=
model_params
):
return
torch
.
float16
return
torch
.
float16
return
torch
.
float32
return
torch
.
float32
...
...
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