Revert "[DEBUGONLY] Try returning tokens"
Browse filesThis reverts commit b957c4dfa1a7e60027ef0185247b32dfedd1aba7.
- handler.py +7 -2
handler.py
CHANGED
@@ -28,5 +28,10 @@ class EndpointHandler():
|
|
28 |
inputs = data.get("inputs", data)
|
29 |
|
30 |
# tokenize the input
|
31 |
-
encoded_inputs = self.tokenizer(inputs, padding=True, truncation=True)
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
28 |
inputs = data.get("inputs", data)
|
29 |
|
30 |
# tokenize the input
|
31 |
+
encoded_inputs = self.tokenizer(inputs, padding=True, truncation=True, return_tensors='pt')
|
32 |
+
# run the model
|
33 |
+
outputs = self.model(**encoded_inputs)
|
34 |
+
# Perform pooling
|
35 |
+
sentence_embeddings = mean_pooling(outputs, encoded_inputs['attention_mask'])
|
36 |
+
# postprocess the prediction
|
37 |
+
return sentence_embeddings.tolist()
|