mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-05-08 16:22:38 +08:00
Set and pass along rope_opts correctly.
This commit is contained in:
parent
d605edc6ef
commit
7174b9576b
@ -386,7 +386,7 @@ class Flux(nn.Module):
|
|||||||
h = max(h, ref.shape[-2] + h_offset)
|
h = max(h, ref.shape[-2] + h_offset)
|
||||||
w = max(w, ref.shape[-1] + w_offset)
|
w = max(w, ref.shape[-1] + w_offset)
|
||||||
|
|
||||||
kontext, kontext_ids = self.process_img(ref, index=index, h_offset=h_offset, w_offset=w_offset)
|
kontext, kontext_ids = self.process_img(ref, index=index, h_offset=h_offset, w_offset=w_offset, transformer_options=transformer_options)
|
||||||
img = torch.cat([img, kontext], dim=1)
|
img = torch.cat([img, kontext], dim=1)
|
||||||
img_ids = torch.cat([img_ids, kontext_ids], dim=1)
|
img_ids = torch.cat([img_ids, kontext_ids], dim=1)
|
||||||
ref_num_tokens.append(kontext.shape[1])
|
ref_num_tokens.append(kontext.shape[1])
|
||||||
|
|||||||
@ -930,9 +930,10 @@ class LongCatImage(Flux):
|
|||||||
transformer_options = transformer_options.copy()
|
transformer_options = transformer_options.copy()
|
||||||
rope_opts = transformer_options.get("rope_options", {})
|
rope_opts = transformer_options.get("rope_options", {})
|
||||||
rope_opts = dict(rope_opts)
|
rope_opts = dict(rope_opts)
|
||||||
|
pe_len = float(c_crossattn.shape[1]) if c_crossattn is not None else 512.0
|
||||||
rope_opts.setdefault("shift_t", 1.0)
|
rope_opts.setdefault("shift_t", 1.0)
|
||||||
rope_opts.setdefault("shift_y", 512.0)
|
rope_opts.setdefault("shift_y", pe_len)
|
||||||
rope_opts.setdefault("shift_x", 512.0)
|
rope_opts.setdefault("shift_x", pe_len)
|
||||||
transformer_options["rope_options"] = rope_opts
|
transformer_options["rope_options"] = rope_opts
|
||||||
return super()._apply_model(x, t, c_concat, c_crossattn, control, transformer_options, **kwargs)
|
return super()._apply_model(x, t, c_concat, c_crossattn, control, transformer_options, **kwargs)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user