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
d9e088dd
Commit
d9e088dd
authored
May 12, 2023
by
BlenderNeko
Browse files
minor changes for tiled sampler
parent
8ea165dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
comfy/ldm/modules/tomesd.py
comfy/ldm/modules/tomesd.py
+1
-1
comfy/sd.py
comfy/sd.py
+9
-6
No files found.
comfy/ldm/modules/tomesd.py
View file @
d9e088dd
...
@@ -36,7 +36,7 @@ def bipartite_soft_matching_random2d(metric: torch.Tensor,
...
@@ -36,7 +36,7 @@ def bipartite_soft_matching_random2d(metric: torch.Tensor,
"""
"""
B
,
N
,
_
=
metric
.
shape
B
,
N
,
_
=
metric
.
shape
if
r
<=
0
:
if
r
<=
0
or
w
==
1
or
h
==
1
:
return
do_nothing
,
do_nothing
return
do_nothing
,
do_nothing
gather
=
mps_gather_workaround
if
metric
.
device
.
type
==
"mps"
else
torch
.
gather
gather
=
mps_gather_workaround
if
metric
.
device
.
type
==
"mps"
else
torch
.
gather
...
...
comfy/sd.py
View file @
d9e088dd
...
@@ -581,10 +581,7 @@ class VAE:
...
@@ -581,10 +581,7 @@ class VAE:
samples
=
samples
.
cpu
()
samples
=
samples
.
cpu
()
return
samples
return
samples
def
resize_image_to
(
tensor
,
target_latent_tensor
,
batched_number
):
def
broadcast_image_to
(
tensor
,
target_batch_size
,
batched_number
):
tensor
=
utils
.
common_upscale
(
tensor
,
target_latent_tensor
.
shape
[
3
]
*
8
,
target_latent_tensor
.
shape
[
2
]
*
8
,
'nearest-exact'
,
"center"
)
target_batch_size
=
target_latent_tensor
.
shape
[
0
]
current_batch_size
=
tensor
.
shape
[
0
]
current_batch_size
=
tensor
.
shape
[
0
]
print
(
current_batch_size
,
target_batch_size
)
print
(
current_batch_size
,
target_batch_size
)
if
current_batch_size
==
1
:
if
current_batch_size
==
1
:
...
@@ -623,7 +620,9 @@ class ControlNet:
...
@@ -623,7 +620,9 @@ class ControlNet:
if
self
.
cond_hint
is
not
None
:
if
self
.
cond_hint
is
not
None
:
del
self
.
cond_hint
del
self
.
cond_hint
self
.
cond_hint
=
None
self
.
cond_hint
=
None
self
.
cond_hint
=
resize_image_to
(
self
.
cond_hint_original
,
x_noisy
,
batched_number
).
to
(
self
.
control_model
.
dtype
).
to
(
self
.
device
)
self
.
cond_hint
=
utils
.
common_upscale
(
self
.
cond_hint_original
,
x_noisy
.
shape
[
3
]
*
8
,
x_noisy
.
shape
[
2
]
*
8
,
'nearest-exact'
,
"center"
).
to
(
self
.
control_model
.
dtype
).
to
(
self
.
device
)
if
x_noisy
.
shape
[
0
]
!=
self
.
cond_hint
.
shape
[
0
]:
self
.
cond_hint
=
broadcast_image_to
(
self
.
cond_hint
,
x_noisy
.
shape
[
0
],
batched_number
)
if
self
.
control_model
.
dtype
==
torch
.
float16
:
if
self
.
control_model
.
dtype
==
torch
.
float16
:
precision_scope
=
torch
.
autocast
precision_scope
=
torch
.
autocast
...
@@ -794,10 +793,14 @@ class T2IAdapter:
...
@@ -794,10 +793,14 @@ class T2IAdapter:
if
self
.
cond_hint
is
None
or
x_noisy
.
shape
[
2
]
*
8
!=
self
.
cond_hint
.
shape
[
2
]
or
x_noisy
.
shape
[
3
]
*
8
!=
self
.
cond_hint
.
shape
[
3
]:
if
self
.
cond_hint
is
None
or
x_noisy
.
shape
[
2
]
*
8
!=
self
.
cond_hint
.
shape
[
2
]
or
x_noisy
.
shape
[
3
]
*
8
!=
self
.
cond_hint
.
shape
[
3
]:
if
self
.
cond_hint
is
not
None
:
if
self
.
cond_hint
is
not
None
:
del
self
.
cond_hint
del
self
.
cond_hint
self
.
control_input
=
None
self
.
cond_hint
=
None
self
.
cond_hint
=
None
self
.
cond_hint
=
resize_image_to
(
self
.
cond_hint_original
,
x_noisy
,
batched_numb
er
).
float
().
to
(
self
.
device
)
self
.
cond_hint
=
utils
.
common_upscale
(
self
.
cond_hint_original
,
x_noisy
.
shape
[
3
]
*
8
,
x_noisy
.
shape
[
2
]
*
8
,
'nearest-exact'
,
"cent
er
"
).
float
().
to
(
self
.
device
)
if
self
.
channels_in
==
1
and
self
.
cond_hint
.
shape
[
1
]
>
1
:
if
self
.
channels_in
==
1
and
self
.
cond_hint
.
shape
[
1
]
>
1
:
self
.
cond_hint
=
torch
.
mean
(
self
.
cond_hint
,
1
,
keepdim
=
True
)
self
.
cond_hint
=
torch
.
mean
(
self
.
cond_hint
,
1
,
keepdim
=
True
)
if
x_noisy
.
shape
[
0
]
!=
self
.
cond_hint
.
shape
[
0
]:
self
.
cond_hint
=
broadcast_image_to
(
self
.
cond_hint
,
x_noisy
.
shape
[
0
],
batched_number
)
if
self
.
control_input
is
None
:
self
.
t2i_model
.
to
(
self
.
device
)
self
.
t2i_model
.
to
(
self
.
device
)
self
.
control_input
=
self
.
t2i_model
(
self
.
cond_hint
)
self
.
control_input
=
self
.
t2i_model
(
self
.
cond_hint
)
self
.
t2i_model
.
cpu
()
self
.
t2i_model
.
cpu
()
...
...
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