Skip to content

Commit

Permalink
Fix taesd VAE in lowvram mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
comfyanonymous committed Dec 26, 2023
1 parent 61b3f15 commit f21bb41
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions comfy/taesd/taesd.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
import torch.nn as nn

import comfy.utils
import comfy.ops

def conv(n_in, n_out, **kwargs):
return nn.Conv2d(n_in, n_out, 3, padding=1, **kwargs)
return comfy.ops.disable_weight_init.Conv2d(n_in, n_out, 3, padding=1, **kwargs)

class Clamp(nn.Module):
def forward(self, x):
Expand All @@ -19,7 +20,7 @@ class Block(nn.Module):
def __init__(self, n_in, n_out):
super().__init__()
self.conv = nn.Sequential(conv(n_in, n_out), nn.ReLU(), conv(n_out, n_out), nn.ReLU(), conv(n_out, n_out))
self.skip = nn.Conv2d(n_in, n_out, 1, bias=False) if n_in != n_out else nn.Identity()
self.skip = comfy.ops.disable_weight_init.Conv2d(n_in, n_out, 1, bias=False) if n_in != n_out else nn.Identity()
self.fuse = nn.ReLU()
def forward(self, x):
return self.fuse(self.conv(x) + self.skip(x))
Expand Down

0 comments on commit f21bb41

Please sign in to comment.