Skip to content

Commit bc606d7

Browse files
Add a way to set the default ref method in the qwen image code. (#11349)
1 parent 645ee18 commit bc606d7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

comfy/ldm/qwen_image/model.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ def __init__(
322322
pooled_projection_dim: int = 768,
323323
guidance_embeds: bool = False,
324324
axes_dims_rope: Tuple[int, int, int] = (16, 56, 56),
325+
default_ref_method="index",
325326
image_model=None,
326327
final_layer=True,
327328
dtype=None,
@@ -334,6 +335,7 @@ def __init__(
334335
self.in_channels = in_channels
335336
self.out_channels = out_channels or in_channels
336337
self.inner_dim = num_attention_heads * attention_head_dim
338+
self.default_ref_method = default_ref_method
337339

338340
self.pe_embedder = EmbedND(dim=attention_head_dim, theta=10000, axes_dim=list(axes_dims_rope))
339341

@@ -416,7 +418,7 @@ def _forward(
416418
h = 0
417419
w = 0
418420
index = 0
419-
ref_method = kwargs.get("ref_latents_method", "index")
421+
ref_method = kwargs.get("ref_latents_method", self.default_ref_method)
420422
index_ref_method = (ref_method == "index") or (ref_method == "index_timestep_zero")
421423
timestep_zero = ref_method == "index_timestep_zero"
422424
for ref in ref_latents:

0 commit comments

Comments
 (0)