Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -574,18 +574,19 @@ scheduler.start()
|
|
574 |
# TODO shouldn't call this before gradio launch, yeah?
|
575 |
@spaces.GPU()
|
576 |
def encode_space(x, im):
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
print('encoded')
|
583 |
-
|
584 |
-
print('pali_enc')
|
585 |
-
gemb = pali.vision_tower(im.to(dtype).to('cuda')).last_hidden_state
|
586 |
|
587 |
-
|
588 |
-
|
|
|
|
|
|
|
|
|
|
|
589 |
|
590 |
demo.launch(share=True,)
|
591 |
|
|
|
574 |
# TODO shouldn't call this before gradio launch, yeah?
|
575 |
@spaces.GPU()
|
576 |
def encode_space(x, im):
|
577 |
+
with torch.no_grad():
|
578 |
+
print('encode')
|
579 |
+
im_emb, _ = pipe.encode_image(
|
580 |
+
x, DEVICE, 1, output_hidden_state
|
581 |
+
)
|
|
|
|
|
|
|
|
|
582 |
|
583 |
+
print('encoded')
|
584 |
+
|
585 |
+
print('pali_enc')
|
586 |
+
gemb = pali.vision_tower(im.to(dtype).to('cuda')).last_hidden_state
|
587 |
+
|
588 |
+
print('pali_enced')
|
589 |
+
return im_emb.to(torch.float32), gemb.to(torch.float32)
|
590 |
|
591 |
demo.launch(share=True,)
|
592 |
|