andrewluo commited on
Commit
2e2e642
1 Parent(s): 3550d34

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +2 -0
handler.py CHANGED
@@ -22,5 +22,7 @@ class EndpointHandler():
22
  instruction = data.pop("instruction",data)
23
  text = data.pop("text", data)
24
  inputs = [[s, instruction] for s in text]
 
 
25
  embeddings = self.model.encode(inputs)
26
  return embeddings.tolist()
 
22
  instruction = data.pop("instruction",data)
23
  text = data.pop("text", data)
24
  inputs = [[s, instruction] for s in text]
25
+ if (self.device):
26
+ inputs = torch.tensor(inputs).to(self.device) # Move inputs to the GPU
27
  embeddings = self.model.encode(inputs)
28
  return embeddings.tolist()