MCPcopy Create free account
hub / github.com/Monalissaa/DisenDiff / __call__

Method __call__

src/attention_controllers.py:149–164  ·  view source on GitHub ↗
(self, attn, is_cross: bool, place_in_unet: str)

Source from the content-addressed store, hash-verified

147 raise NotImplementedError
148
149 def __call__(self, attn, is_cross: bool, place_in_unet: str):
150 if self.cur_att_layer >= self.num_uncond_att_layers:
151 if LOW_RESOURCE:
152 attn = self.forward(attn, is_cross, place_in_unet)
153 else:
154 h = attn.shape[0]
155 attn[h // 2:] = self.forward(attn[h // 2:], is_cross, place_in_unet)
156 self.cur_att_layer += 1
157 # print(self.num_att_layers)
158 # print(self.num_uncond_att_layers)
159 if self.cur_att_layer == self.num_att_layers + self.num_uncond_att_layers:
160 self.cur_att_layer = 0
161 self.cur_step += 1
162 # print(self.cur_step)
163 self.between_steps()
164 return attn
165
166 def reset(self):
167 self.cur_step = 0

Callers

nothing calls this directly

Calls 2

forwardMethod · 0.95
between_stepsMethod · 0.95

Tested by

no test coverage detected