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
492db2de
Commit
492db2de
authored
Sep 21, 2023
by
comfyanonymous
Browse files
Allow having a different pooled output for each image in a batch.
parent
0793eb92
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
comfy/model_base.py
comfy/model_base.py
+2
-2
comfy/samplers.py
comfy/samplers.py
+2
-1
No files found.
comfy/model_base.py
View file @
492db2de
...
@@ -181,7 +181,7 @@ class SDXLRefiner(BaseModel):
...
@@ -181,7 +181,7 @@ class SDXLRefiner(BaseModel):
out
.
append
(
self
.
embedder
(
torch
.
Tensor
([
crop_h
])))
out
.
append
(
self
.
embedder
(
torch
.
Tensor
([
crop_h
])))
out
.
append
(
self
.
embedder
(
torch
.
Tensor
([
crop_w
])))
out
.
append
(
self
.
embedder
(
torch
.
Tensor
([
crop_w
])))
out
.
append
(
self
.
embedder
(
torch
.
Tensor
([
aesthetic_score
])))
out
.
append
(
self
.
embedder
(
torch
.
Tensor
([
aesthetic_score
])))
flat
=
torch
.
flatten
(
torch
.
cat
(
out
))
[
None
,
]
flat
=
torch
.
flatten
(
torch
.
cat
(
out
))
.
unsqueeze
(
dim
=
0
).
repeat
(
clip_pooled
.
shape
[
0
],
1
)
return
torch
.
cat
((
clip_pooled
.
to
(
flat
.
device
),
flat
),
dim
=
1
)
return
torch
.
cat
((
clip_pooled
.
to
(
flat
.
device
),
flat
),
dim
=
1
)
class
SDXL
(
BaseModel
):
class
SDXL
(
BaseModel
):
...
@@ -206,5 +206,5 @@ class SDXL(BaseModel):
...
@@ -206,5 +206,5 @@ class SDXL(BaseModel):
out
.
append
(
self
.
embedder
(
torch
.
Tensor
([
crop_w
])))
out
.
append
(
self
.
embedder
(
torch
.
Tensor
([
crop_w
])))
out
.
append
(
self
.
embedder
(
torch
.
Tensor
([
target_height
])))
out
.
append
(
self
.
embedder
(
torch
.
Tensor
([
target_height
])))
out
.
append
(
self
.
embedder
(
torch
.
Tensor
([
target_width
])))
out
.
append
(
self
.
embedder
(
torch
.
Tensor
([
target_width
])))
flat
=
torch
.
flatten
(
torch
.
cat
(
out
))
[
None
,
]
flat
=
torch
.
flatten
(
torch
.
cat
(
out
))
.
unsqueeze
(
dim
=
0
).
repeat
(
clip_pooled
.
shape
[
0
],
1
)
return
torch
.
cat
((
clip_pooled
.
to
(
flat
.
device
),
flat
),
dim
=
1
)
return
torch
.
cat
((
clip_pooled
.
to
(
flat
.
device
),
flat
),
dim
=
1
)
comfy/samplers.py
View file @
492db2de
...
@@ -7,6 +7,7 @@ from .ldm.models.diffusion.ddim import DDIMSampler
...
@@ -7,6 +7,7 @@ from .ldm.models.diffusion.ddim import DDIMSampler
from
.ldm.modules.diffusionmodules.util
import
make_ddim_timesteps
from
.ldm.modules.diffusionmodules.util
import
make_ddim_timesteps
import
math
import
math
from
comfy
import
model_base
from
comfy
import
model_base
import
comfy.utils
def
lcm
(
a
,
b
):
#TODO: eventually replace by math.lcm (added in python3.9)
def
lcm
(
a
,
b
):
#TODO: eventually replace by math.lcm (added in python3.9)
return
abs
(
a
*
b
)
//
math
.
gcd
(
a
,
b
)
return
abs
(
a
*
b
)
//
math
.
gcd
(
a
,
b
)
...
@@ -538,7 +539,7 @@ def encode_adm(model, conds, batch_size, width, height, device, prompt_type):
...
@@ -538,7 +539,7 @@ def encode_adm(model, conds, batch_size, width, height, device, prompt_type):
if
adm_out
is
not
None
:
if
adm_out
is
not
None
:
x
[
1
]
=
x
[
1
].
copy
()
x
[
1
]
=
x
[
1
].
copy
()
x
[
1
][
"adm_encoded"
]
=
torch
.
cat
([
adm_out
]
*
batch_size
).
to
(
device
)
x
[
1
][
"adm_encoded"
]
=
comfy
.
utils
.
repeat_to_batch_size
(
adm_out
,
batch_size
).
to
(
device
)
return
conds
return
conds
...
...
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