Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions comfy/ldm/modules/diffusionmodules/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,13 +714,21 @@ def forward(self, z, **kwargs):
h = self.mid.block_2(h, temb, **kwargs)

# upsampling
for i_level in reversed(range(self.num_resolutions)):
for i_block in range(self.num_res_blocks+1):
h = self.up[i_level].block[i_block](h, temb, **kwargs)
if len(self.up[i_level].attn) > 0:
h = self.up[i_level].attn[i_block](h, **kwargs)
if i_level != 0:
h = self.up[i_level].upsample(h)
with torch.no_grad():
for i_level in reversed(range(self.num_resolutions)):
for i_block in range(self.num_res_blocks + 1):
h_new = self.up[i_level].block[i_block](h, temb, **kwargs)
if len(self.up[i_level].attn) > 0:
h_new = self.up[i_level].attn[i_block](h_new, **kwargs)
del h
model_management.soft_empty_cache()
h = h_new

if i_level != 0:
h_new = self.up[i_level].upsample(h)
del h
model_management.soft_empty_cache()
h = h_new

# end
if self.give_pre_end:
Expand Down