Update handler.py
Browse files- handler.py +4 -4
handler.py
CHANGED
|
@@ -7,14 +7,14 @@ class EndpointHandler():
|
|
| 7 |
def __init__(self, path=""):
|
| 8 |
# load the optimized model
|
| 9 |
self.model = ORTModelForSequenceClassification.from_pretrained(path)
|
| 10 |
-
self.tokenizer = AutoTokenizer.from_pretrained(
|
| 11 |
|
| 12 |
|
| 13 |
def __call__(self, data):
|
| 14 |
-
answers = data.pop("
|
| 15 |
-
paraphrases = data.pop("paraphrases")
|
| 16 |
|
| 17 |
-
inputs = self.tokenizer(answers,
|
| 18 |
|
| 19 |
with torch.no_grad():
|
| 20 |
outputs = self.model(**inputs)
|
|
|
|
| 7 |
def __init__(self, path=""):
|
| 8 |
# load the optimized model
|
| 9 |
self.model = ORTModelForSequenceClassification.from_pretrained(path)
|
| 10 |
+
self.tokenizer = AutoTokenizer.from_pretrained(path)
|
| 11 |
|
| 12 |
|
| 13 |
def __call__(self, data):
|
| 14 |
+
answers = data.pop("inputs")
|
| 15 |
+
#paraphrases = data.pop("paraphrases")
|
| 16 |
|
| 17 |
+
inputs = self.tokenizer(answers, max_length=253, padding=True, truncation=True, return_tensors='pt')
|
| 18 |
|
| 19 |
with torch.no_grad():
|
| 20 |
outputs = self.model(**inputs)
|