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
68d12b53
Commit
68d12b53
authored
May 14, 2023
by
comfyanonymous
Browse files
Merge branch 'tiled_sampler' of
https://github.com/BlenderNeko/ComfyUI
parents
587f89fe
19c014f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
comfy/ldm/modules/tomesd.py
comfy/ldm/modules/tomesd.py
+1
-1
comfy/sd.py
comfy/sd.py
+10
-7
No files found.
comfy/ldm/modules/tomesd.py
View file @
68d12b53
...
...
@@ -36,7 +36,7 @@ def bipartite_soft_matching_random2d(metric: torch.Tensor,
"""
B
,
N
,
_
=
metric
.
shape
if
r
<=
0
:
if
r
<=
0
or
w
==
1
or
h
==
1
:
return
do_nothing
,
do_nothing
gather
=
mps_gather_workaround
if
metric
.
device
.
type
==
"mps"
else
torch
.
gather
...
...
comfy/sd.py
View file @
68d12b53
...
...
@@ -581,12 +581,9 @@ class VAE:
samples
=
samples
.
cpu
()
return
samples
def
resize_image_to
(
tensor
,
target_latent_tensor
,
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
]
def
broadcast_image_to
(
tensor
,
target_batch_size
,
batched_number
):
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
:
return
tensor
...
...
@@ -623,7 +620,9 @@ class ControlNet:
if
self
.
cond_hint
is
not
None
:
del
self
.
cond_hint
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
:
precision_scope
=
torch
.
autocast
...
...
@@ -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
not
None
:
del
self
.
cond_hint
self
.
control_input
=
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
:
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
.
control_input
=
self
.
t2i_model
(
self
.
cond_hint
)
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