Update handler.py
Browse files- handler.py +2 -2
handler.py
CHANGED
@@ -52,11 +52,11 @@ class EndpointHandler():
|
|
52 |
model_output = self.onnx_extractor(sentence)
|
53 |
print("E")
|
54 |
|
55 |
-
|
56 |
# Perform pooling. In this case, max pooling.
|
57 |
# embedding = mean_pooling(model_output, encoded_input['attention_mask'])
|
58 |
print("F")
|
59 |
|
60 |
-
sentence_embeddings.append(
|
61 |
print("G")
|
62 |
return sentence_embeddings
|
|
|
52 |
model_output = self.onnx_extractor(sentence)
|
53 |
print("E")
|
54 |
|
55 |
+
max_pooled_output, _ = torch.max(model_output, dim=1)
|
56 |
# Perform pooling. In this case, max pooling.
|
57 |
# embedding = mean_pooling(model_output, encoded_input['attention_mask'])
|
58 |
print("F")
|
59 |
|
60 |
+
sentence_embeddings.append(max_pooled_output)
|
61 |
print("G")
|
62 |
return sentence_embeddings
|