wondervictor commited on
Commit
212c199
·
verified ·
1 Parent(s): 02f9a02

Update model.py

Browse files
Files changed (1) hide show
  1. model.py +6 -4
model.py CHANGED
@@ -124,13 +124,14 @@ class Model:
124
  image=image,image_resolution=512, detect_resolution=512)
125
  elif preprocessor_name == 'No preprocess':
126
  condition_img = image
 
127
  condition_img = condition_img.resize((512,512))
128
  W, H = condition_img.size
129
 
130
- condition_img = torch.from_numpy(np.array(condition_img)).unsqueeze(0).permute(0,3,1,2).repeat(3,1,1,1)
131
  condition_img = condition_img.to(self.device)
132
  condition_img = 2*(condition_img/255 - 0.5)
133
- prompts = [prompt] * 3
134
  caption_embs, emb_masks = self.t5_model.get_text_embeddings(prompts)
135
 
136
  print(f"processing left-padding...")
@@ -214,13 +215,14 @@ class Model:
214
  )
215
  elif preprocessor_name == 'No preprocess':
216
  condition_img = image
 
217
  condition_img = condition_img.resize((512,512))
218
  W, H = condition_img.size
219
 
220
- condition_img = torch.from_numpy(np.array(condition_img)).unsqueeze(0).permute(0,3,1,2).repeat(3,1,1,1)
221
  condition_img = condition_img.to(self.device)
222
  condition_img = 2*(condition_img/255 - 0.5)
223
- prompts = [prompt] * 3
224
  caption_embs, emb_masks = self.t5_model.get_text_embeddings(prompts)
225
 
226
  print(f"processing left-padding...")
 
124
  image=image,image_resolution=512, detect_resolution=512)
125
  elif preprocessor_name == 'No preprocess':
126
  condition_img = image
127
+ print('get edge')
128
  condition_img = condition_img.resize((512,512))
129
  W, H = condition_img.size
130
 
131
+ condition_img = torch.from_numpy(np.array(condition_img)).unsqueeze(0).permute(0,3,1,2).repeat(1,1,1,1)
132
  condition_img = condition_img.to(self.device)
133
  condition_img = 2*(condition_img/255 - 0.5)
134
+ prompts = [prompt] * 1
135
  caption_embs, emb_masks = self.t5_model.get_text_embeddings(prompts)
136
 
137
  print(f"processing left-padding...")
 
215
  )
216
  elif preprocessor_name == 'No preprocess':
217
  condition_img = image
218
+ print('get depth')
219
  condition_img = condition_img.resize((512,512))
220
  W, H = condition_img.size
221
 
222
+ condition_img = torch.from_numpy(np.array(condition_img)).unsqueeze(0).permute(0,3,1,2).repeat(1,1,1,1)
223
  condition_img = condition_img.to(self.device)
224
  condition_img = 2*(condition_img/255 - 0.5)
225
+ prompts = [prompt] * 1
226
  caption_embs, emb_masks = self.t5_model.get_text_embeddings(prompts)
227
 
228
  print(f"processing left-padding...")