Skip to content

Commit 6585f9c

Browse files
committed
Merge branch 'master' into dev
2 parents 6e25170 + d3f14bb commit 6585f9c

File tree

8 files changed

+23
-19
lines changed

8 files changed

+23
-19
lines changed

__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"LatentMirror": LatentMirror,
55
"LatentShift": LatentShift,
66
"LatentNormalize": LatentNormalize,
7-
"KSamplerWithTransform": TSamplerWithTransform,
7+
"TSamplerWithTransform": TSamplerWithTransform,
88
"TransformSampler": TransformSampler,
99
"MirrorTransform": MirrorTransform,
1010
"ShiftTransform": ShiftTransform,
@@ -25,7 +25,7 @@
2525
"LatentMirror": "Latent mirror",
2626
"LatentShift": "Latent shift",
2727
"LatentNormalize": "Latent normalize",
28-
"KSamplerWithTransform": "TSampler with transforms (Latent Control)",
28+
"TSamplerWithTransform": "TSampler with transforms (Latent Control)",
2929
"TransformSampler": "TSampler (Latent Control)",
3030
"MirrorTransform": "Mirror transform",
3131
"ShiftTransform": "Shift transform",

nodes/KSamplerNodes/TransformSampler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def prepare_callback(model, steps, transforms, x0_output_dict=None):
77
def transform_callback(step, x0, x, total_steps):
88
for transform in transforms:
99
for i in range(x0.size()[0]):
10-
x0[i] = transform["function"](step, x0[i], total_steps, transform["params"])
10+
x0[i] = transform["function"](step, x0[i].unsqueeze(0), total_steps, transform["params"])
1111

1212
preview = preview_callback(model, steps, x0_output_dict)
1313

nodes/KSamplerNodes/Transforms/LatentAddTransform.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
from .utils import latent_add_transform, get_offset_list
2+
import comfy
3+
import torch
24

35

46
class LatentAddTransform:
@@ -22,14 +24,14 @@ def INPUT_TYPES(s):
2224
CATEGORY = "sampling/transforms"
2325

2426
def process(self,
25-
offset_optional,
2627
latent,
2728
start_at=0,
2829
stop_at=0,
29-
multiplier=1):
30+
multiplier=1,
31+
offset_optional=None):
3032
return ([{
3133
"params": {
32-
"latent": latent["samples"][0],
34+
"latent": latent["samples"][0].unsqueeze(0),
3335
"start_at": start_at,
3436
"stop_at": stop_at,
3537
"multiplier": multiplier,

nodes/KSamplerNodes/Transforms/LatentIntrpolateTransform.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
from .utils import latent_interpolate_transform, get_offset_list
2+
import comfy
3+
import torch
24

35

46
class LatentInterpolateTransform:
@@ -23,15 +25,15 @@ def INPUT_TYPES(s):
2325
CATEGORY = "sampling/transforms"
2426

2527
def process(self,
26-
offset_optional,
2728
latent,
2829
start_at=0,
2930
stop_at=0,
3031
factor=0.5,
31-
multiplier=1):
32+
multiplier=1,
33+
offset_optional=None):
3234
return ([{
3335
"params": {
34-
"latent": latent["samples"][0],
36+
"latent": latent["samples"][0].unsqueeze(0),
3537
"start_at": start_at,
3638
"stop_at": stop_at,
3739
"factor": factor,

nodes/KSamplerNodes/Transforms/MirrorTransform.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ def INPUT_TYPES(s):
2424
CATEGORY = "sampling/transforms"
2525

2626
def process(self,
27-
offset_optional,
2827
start_at=0,
2928
stop_at=0,
3029
mode="replace",
31-
direction="horizontally",):
30+
direction="horizontally",
31+
offset_optional=None):
3232
return ([{
3333
"params": {
3434
"start_at": start_at,

nodes/KSamplerNodes/Transforms/MultiplyTransform.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ def INPUT_TYPES(s):
2222
CATEGORY = "sampling/transforms"
2323

2424
def process(self,
25-
offset_optional,
2625
start_at=0,
2726
stop_at=0,
2827
mode="combine",
29-
multiplier=1):
28+
multiplier=1,
29+
offset_optional=None):
3030
return ([{
3131
"params": {
3232
"start_at": start_at,

nodes/KSamplerNodes/Transforms/ShiftTransform.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ def INPUT_TYPES(s):
2323
CATEGORY = "sampling/transforms"
2424

2525
def process(self,
26-
offset_optional,
2726
start_at=0,
2827
stop_at=0,
2928
mode="replace",
3029
x_shift=0,
31-
y_shift=0):
30+
y_shift=0,
31+
offset_optional=None):
3232
return ([{
3333
"params": {
3434
"start_at": start_at,

nodes/KSamplerNodes/Transforms/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ def mirror_transform(x0, params):
5959

6060

6161
def latent_interpolate_transform(x0, params):
62-
latent = params["latent"]
62+
latent = params["latent"].to(x0.device)
6363

6464
if x0.shape != latent.shape:
6565
latent.permute(0, 3, 1, 2)
66-
latent = comfy.utils.common_upscale(latent, x0.shape[3], x0.shape[2], 'bicubic')
66+
latent = comfy.utils.common_upscale(latent, x0.shape[3], x0.shape[2], 'bicubic', crop='center')
6767
latent.permute(0, 2, 3, 1)
6868

6969
x = x0 * params["factor"] + latent * (1 - params["factor"])
@@ -73,11 +73,11 @@ def latent_interpolate_transform(x0, params):
7373

7474

7575
def latent_add_transform(x0, params):
76-
latent = params["latent"]
76+
latent = params["latent"].to(x0.device)
7777

7878
if x0.shape != latent.shape:
7979
latent.permute(0, 3, 1, 2)
80-
latent = comfy.utils.common_upscale(latent, x0.shape[3], x0.shape[2], 'bicubic')
80+
latent = comfy.utils.common_upscale(latent, x0.shape[3], x0.shape[2], 'bicubic', crop='center')
8181
latent.permute(0, 2, 3, 1)
8282

8383
x = x0 + latent

0 commit comments

Comments
 (0)