Spaces:
Running
on
Zero
Running
on
Zero
wondervictor
commited on
Update model.py
Browse files
model.py
CHANGED
@@ -52,8 +52,8 @@ class Model:
|
|
52 |
self.gpt_model_canny = self.load_gpt(condition_type='canny')
|
53 |
self.gpt_model_depth = self.load_gpt(condition_type='depth')
|
54 |
self.get_control_canny = CannyDetector()
|
55 |
-
|
56 |
-
self.get_control_depth = MidasDetector.from_pretrained("lllyasviel/Annotators")
|
57 |
|
58 |
def to(self, device):
|
59 |
self.gpt_model_canny.to('cuda')
|
@@ -206,12 +206,12 @@ class Model:
|
|
206 |
# condition_img = condition_img.unsqueeze(0).repeat(2, 3, 1, 1)
|
207 |
# condition_img = condition_img.to(self.device)
|
208 |
# condition_img = 2 * (condition_img / 255 - 0.5)
|
209 |
-
|
210 |
-
control_image = self.get_control_depth(
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
|
216 |
prompts = [prompt] * 2
|
217 |
caption_embs, emb_masks = self.t5_model.get_text_embeddings(prompts)
|
|
|
52 |
self.gpt_model_canny = self.load_gpt(condition_type='canny')
|
53 |
self.gpt_model_depth = self.load_gpt(condition_type='depth')
|
54 |
self.get_control_canny = CannyDetector()
|
55 |
+
self.get_control_depth = MidasDetector('cuda')
|
56 |
+
# self.get_control_depth = MidasDetector.from_pretrained("lllyasviel/Annotators")
|
57 |
|
58 |
def to(self, device):
|
59 |
self.gpt_model_canny.to('cuda')
|
|
|
206 |
# condition_img = condition_img.unsqueeze(0).repeat(2, 3, 1, 1)
|
207 |
# condition_img = condition_img.to(self.device)
|
208 |
# condition_img = 2 * (condition_img / 255 - 0.5)
|
209 |
+
condition_img = 2 * (image_tensor / 255 - 0.5)
|
210 |
+
# control_image = self.get_control_depth(
|
211 |
+
# image=image,
|
212 |
+
# image_resolution=512,
|
213 |
+
# detect_resolution=512,
|
214 |
+
# )
|
215 |
|
216 |
prompts = [prompt] * 2
|
217 |
caption_embs, emb_masks = self.t5_model.get_text_embeddings(prompts)
|