Spaces:
Runtime error
Runtime error
wondervictor
commited on
Commit
·
fc47e93
1
Parent(s):
995b367
add requirements
Browse files- condition/midas/midas/vit.py +20 -20
- model.py +2 -2
condition/midas/midas/vit.py
CHANGED
|
@@ -192,12 +192,12 @@ def _make_vit_b16_backbone(
|
|
| 192 |
pretrained = nn.Module()
|
| 193 |
|
| 194 |
pretrained.model = model
|
| 195 |
-
pretrained.model.blocks[hooks[0]].register_forward_hook(get_activation("1"))
|
| 196 |
-
pretrained.model.blocks[hooks[1]].register_forward_hook(get_activation("2"))
|
| 197 |
-
pretrained.model.blocks[hooks[2]].register_forward_hook(get_activation("3"))
|
| 198 |
-
pretrained.model.blocks[hooks[3]].register_forward_hook(get_activation("4"))
|
| 199 |
|
| 200 |
-
pretrained.activations = activations
|
| 201 |
|
| 202 |
readout_oper = get_readout_oper(vit_features, features, use_readout, start_index)
|
| 203 |
|
|
@@ -354,21 +354,21 @@ def _make_vit_b_rn50_backbone(
|
|
| 354 |
|
| 355 |
pretrained.model = model
|
| 356 |
|
| 357 |
-
if use_vit_only == True:
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
else:
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
pretrained.model.blocks[hooks[2]].register_forward_hook(get_activation("3"))
|
| 369 |
-
pretrained.model.blocks[hooks[3]].register_forward_hook(get_activation("4"))
|
| 370 |
-
|
| 371 |
-
pretrained.activations = activations
|
| 372 |
|
| 373 |
readout_oper = get_readout_oper(vit_features, features, use_readout, start_index)
|
| 374 |
|
|
|
|
| 192 |
pretrained = nn.Module()
|
| 193 |
|
| 194 |
pretrained.model = model
|
| 195 |
+
# pretrained.model.blocks[hooks[0]].register_forward_hook(get_activation("1"))
|
| 196 |
+
# pretrained.model.blocks[hooks[1]].register_forward_hook(get_activation("2"))
|
| 197 |
+
# pretrained.model.blocks[hooks[2]].register_forward_hook(get_activation("3"))
|
| 198 |
+
# pretrained.model.blocks[hooks[3]].register_forward_hook(get_activation("4"))
|
| 199 |
|
| 200 |
+
# pretrained.activations = activations
|
| 201 |
|
| 202 |
readout_oper = get_readout_oper(vit_features, features, use_readout, start_index)
|
| 203 |
|
|
|
|
| 354 |
|
| 355 |
pretrained.model = model
|
| 356 |
|
| 357 |
+
# if use_vit_only == True:
|
| 358 |
+
# pretrained.model.blocks[hooks[0]].register_forward_hook(get_activation("1"))
|
| 359 |
+
# pretrained.model.blocks[hooks[1]].register_forward_hook(get_activation("2"))
|
| 360 |
+
# else:
|
| 361 |
+
# pretrained.model.patch_embed.backbone.stages[0].register_forward_hook(
|
| 362 |
+
# get_activation("1")
|
| 363 |
+
# )
|
| 364 |
+
# pretrained.model.patch_embed.backbone.stages[1].register_forward_hook(
|
| 365 |
+
# get_activation("2")
|
| 366 |
+
# )
|
| 367 |
+
|
| 368 |
+
# pretrained.model.blocks[hooks[2]].register_forward_hook(get_activation("3"))
|
| 369 |
+
# pretrained.model.blocks[hooks[3]].register_forward_hook(get_activation("4"))
|
| 370 |
+
|
| 371 |
+
# pretrained.activations = activations
|
| 372 |
|
| 373 |
readout_oper = get_readout_oper(vit_features, features, use_readout, start_index)
|
| 374 |
|
model.py
CHANGED
|
@@ -92,7 +92,7 @@ class Model:
|
|
| 92 |
return t5_model
|
| 93 |
|
| 94 |
@torch.no_grad()
|
| 95 |
-
@spaces.GPU(enable_queue=
|
| 96 |
def process_canny(
|
| 97 |
self,
|
| 98 |
image: np.ndarray,
|
|
@@ -168,7 +168,7 @@ class Model:
|
|
| 168 |
return samples
|
| 169 |
|
| 170 |
@torch.no_grad()
|
| 171 |
-
@spaces.GPU(enable_queue=
|
| 172 |
def process_depth(
|
| 173 |
self,
|
| 174 |
image: np.ndarray,
|
|
|
|
| 92 |
return t5_model
|
| 93 |
|
| 94 |
@torch.no_grad()
|
| 95 |
+
@spaces.GPU(enable_queue=True)
|
| 96 |
def process_canny(
|
| 97 |
self,
|
| 98 |
image: np.ndarray,
|
|
|
|
| 168 |
return samples
|
| 169 |
|
| 170 |
@torch.no_grad()
|
| 171 |
+
@spaces.GPU(enable_queue=True)
|
| 172 |
def process_depth(
|
| 173 |
self,
|
| 174 |
image: np.ndarray,
|