Skip to content

Commit

Permalink
Add emb_patch support to UNetModel forward (#4779)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kosinkadink authored Sep 4, 2024
1 parent f067ad1 commit f04229b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions comfy/ldm/modules/diffusionmodules/openaimodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,11 @@ def forward(self, x, timesteps=None, context=None, y=None, control=None, transfo
t_emb = timestep_embedding(timesteps, self.model_channels, repeat_only=False).to(x.dtype)
emb = self.time_embed(t_emb)

if "emb_patch" in transformer_patches:
patch = transformer_patches["emb_patch"]
for p in patch:
emb = p(emb, self.model_channels, transformer_options)

if self.num_classes is not None:
assert y.shape[0] == x.shape[0]
emb = emb + self.label_emb(y)
Expand Down

0 comments on commit f04229b

Please sign in to comment.