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

Method change_forward

src/model.py:268–276  ·  view source on GitHub ↗
(model, count)

Source from the content-addressed store, hash-verified

266 return self.to_out(out)
267 cross_att_count = 0
268 def change_forward(model, count):
269 for layer in model.children():
270 if type(layer) == CrossAttention:
271 bound_method = new_forward.__get__(layer, layer.__class__)
272 setattr(layer, 'forward', bound_method)
273 count += 1
274 else:
275 count += change_forward(layer, 0)
276 return count
277
278 cross_att_count += change_forward(self.model.diffusion_model, 0)
279

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected