MCPcopy Create free account
hub / github.com/CompVis/diff2flow / __init__

Method __init__

diff2flow/conditioning/encoders.py:66–85  ·  view source on GitHub ↗
(
            self,
            nulltext_path="nulltext.npy",
    )

Source from the content-addressed store, hash-verified

64
65class DummyOpenCLIPTextEmbedder(nn.Module):
66 def __init__(
67 self,
68 nulltext_path="nulltext.npy",
69 ):
70 super().__init__()
71 self.arch = "ViT-H-14"
72 self.version = "laion2b_s32b_b79k"
73 self.layer = "penultimate"
74
75 # find correct path for nulltext embedding
76 if isinstance(nulltext_path, list) or isinstance(nulltext_path, ListConfig):
77 for path in nulltext_path:
78 if os.path.exists(path):
79 nulltext_path = path
80 break
81 else:
82 raise FileNotFoundError("Could not find a valid nulltext path.")
83
84 cond = np.load(nulltext_path)
85 self.uncond = torch.from_numpy(cond).squeeze(0)
86
87 def forward(self, x, *args, **kwargs):
88 bs = x.shape[0]

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected