omer11a commited on
Commit
154600e
·
1 Parent(s): e7e4657

Remove prints

Browse files
Files changed (1) hide show
  1. injection_utils.py +0 -15
injection_utils.py CHANGED
@@ -129,18 +129,7 @@ def regiter_attention_editor_diffusers(model, editor: AttentionBase):
129
 
130
  return forward
131
 
132
- #def conv_forward(self):
133
- # def forward(x):
134
- # return editor.conv(self, x)
135
-
136
- # return forward
137
-
138
  def register_editor(net, count, place_in_unet, prefix=''):
139
- #print(prefix + f'Found net: {net.__class__.__name__}')
140
- #if 'Conv' in net.__class__.__name__:
141
- # print(prefix + f'Found conv with kernel size: {net.kernel_size}')
142
- # net.old_forward = net.forward
143
- # net.forward = conv_forward(net)
144
  for name, subnet in net.named_children():
145
  if net.__class__.__name__ == 'Attention': # spatial Transformer layer
146
  net.forward = ca_forward(net, place_in_unet)
@@ -153,14 +142,10 @@ def regiter_attention_editor_diffusers(model, editor: AttentionBase):
153
  for net_name, net in model.unet.named_children():
154
  if "down" in net_name:
155
  cross_att_count += register_editor(net, 0, "down")
156
- #print(f'Down number of attention layers {cross_att_count}!')
157
  elif "mid" in net_name:
158
  cross_att_count += register_editor(net, 0, "mid")
159
- #print(f'Mid number of attention layers {cross_att_count}!')
160
  elif "up" in net_name:
161
  cross_att_count += register_editor(net, 0, "up")
162
- #print(f'Up number of attention layers {cross_att_count}!')
163
- print(f'Number of attention layers {cross_att_count}!')
164
  editor.num_att_layers = cross_att_count
165
  editor.model = model
166
  model.editor = editor
 
129
 
130
  return forward
131
 
 
 
 
 
 
 
132
  def register_editor(net, count, place_in_unet, prefix=''):
 
 
 
 
 
133
  for name, subnet in net.named_children():
134
  if net.__class__.__name__ == 'Attention': # spatial Transformer layer
135
  net.forward = ca_forward(net, place_in_unet)
 
142
  for net_name, net in model.unet.named_children():
143
  if "down" in net_name:
144
  cross_att_count += register_editor(net, 0, "down")
 
145
  elif "mid" in net_name:
146
  cross_att_count += register_editor(net, 0, "mid")
 
147
  elif "up" in net_name:
148
  cross_att_count += register_editor(net, 0, "up")
 
 
149
  editor.num_att_layers = cross_att_count
150
  editor.model = model
151
  model.editor = editor