Update handler.py
Browse files- handler.py +1 -1
handler.py
CHANGED
|
@@ -41,7 +41,7 @@ class EndpointHandler:
|
|
| 41 |
return features / features.norm(dim=-1, keepdim=True)
|
| 42 |
|
| 43 |
def _get_text_embeddings(self, texts: List[str]) -> torch.Tensor:
|
| 44 |
-
inputs = self.processor(text=texts, padding="max_length", return_tensors="pt").to(self.device)
|
| 45 |
with torch.no_grad():
|
| 46 |
features = self.model.get_text_features(**inputs)
|
| 47 |
return features / features.norm(dim=-1, keepdim=True)
|
|
|
|
| 41 |
return features / features.norm(dim=-1, keepdim=True)
|
| 42 |
|
| 43 |
def _get_text_embeddings(self, texts: List[str]) -> torch.Tensor:
|
| 44 |
+
inputs = self.processor(text=texts, padding="max_length", truncation=True, return_tensors="pt").to(self.device)
|
| 45 |
with torch.no_grad():
|
| 46 |
features = self.model.get_text_features(**inputs)
|
| 47 |
return features / features.norm(dim=-1, keepdim=True)
|