moooji commited on
Commit
0971f0d
·
1 Parent(s): cacbb05

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +1 -4
handler.py CHANGED
@@ -5,12 +5,9 @@ import base64
5
  from io import BytesIO
6
  from transformers import CLIPProcessor, CLIPModel
7
 
8
- # check for GPU
9
- device = 0 if torch.cuda.is_available() else -1
10
-
11
  class EndpointHandler():
12
  def __init__(self, path=""):
13
- self.model = CLIPModel.from_pretrained("openai/clip-vit-large-patch14-336")
14
  self.processor = CLIPProcessor.from_pretrained("openai/clip-vit-large-patch14-336")
15
 
16
  def __call__(self, data: Any) -> List[float]:
 
5
  from io import BytesIO
6
  from transformers import CLIPProcessor, CLIPModel
7
 
 
 
 
8
  class EndpointHandler():
9
  def __init__(self, path=""):
10
+ self.model = CLIPModel.from_pretrained("openai/clip-vit-large-patch14-336", device_map="auto")
11
  self.processor = CLIPProcessor.from_pretrained("openai/clip-vit-large-patch14-336")
12
 
13
  def __call__(self, data: Any) -> List[float]: