rynmurdock commited on
Commit
59bcd87
·
verified ·
1 Parent(s): 62d7ec9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
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
- print('encode')
578
- im_emb, _ = pipe.encode_image(
579
- x, DEVICE, 1, output_hidden_state
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
- print('pali_enced')
588
- return im_emb.to(torch.float32), gemb.to(torch.float32)
 
 
 
 
 
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