Update handler.py
Browse files- handler.py +2 -3
handler.py
CHANGED
@@ -5,8 +5,7 @@ from transformers import BertModel, BertTokenizerFast
|
|
5 |
|
6 |
|
7 |
class EndpointHandler():
|
8 |
-
|
9 |
-
def __init__(self, path_to_model: str = '.'):
|
10 |
# Preload all the elements you are going to need at inference.
|
11 |
# pseudo:
|
12 |
self.tokenizer = BertTokenizerFast.from_pretrained(path_to_model)
|
@@ -25,4 +24,4 @@ class EndpointHandler():
|
|
25 |
with torch.no_grad():
|
26 |
outputs = self.model(**inputs)
|
27 |
|
28 |
-
return outputs.pooler_output
|
|
|
5 |
|
6 |
|
7 |
class EndpointHandler():
|
8 |
+
def __init__(self, path_to_model: str):
|
|
|
9 |
# Preload all the elements you are going to need at inference.
|
10 |
# pseudo:
|
11 |
self.tokenizer = BertTokenizerFast.from_pretrained(path_to_model)
|
|
|
24 |
with torch.no_grad():
|
25 |
outputs = self.model(**inputs)
|
26 |
|
27 |
+
return outputs.pooler_output.tolist()
|