E-Hospital
commited on
Commit
•
66cf7a8
1
Parent(s):
df17865
Update handler.py
Browse files- handler.py +4 -2
handler.py
CHANGED
@@ -23,11 +23,13 @@ class EndpointHandler:
|
|
23 |
# preprocess
|
24 |
input_ids = self.tokenizer(inputs, return_tensors="pt").input_ids
|
25 |
|
|
|
|
|
26 |
# pass inputs with all kwargs in data
|
27 |
if parameters is not None:
|
28 |
-
|
29 |
else:
|
30 |
-
|
31 |
|
32 |
# postprocess the prediction
|
33 |
prediction = self.tokenizer.decode(outputs[0], skip_special_tokens=True)
|
|
|
23 |
# preprocess
|
24 |
input_ids = self.tokenizer(inputs, return_tensors="pt").input_ids
|
25 |
|
26 |
+
# postprocess the prediction
|
27 |
+
prediction = self.tokenizer.decode(outputs[0], skip_special_tokens=True)
|
28 |
# pass inputs with all kwargs in data
|
29 |
if parameters is not None:
|
30 |
+
outputs = self.model.generate(inputs, device=0, **parameters)
|
31 |
else:
|
32 |
+
outputs = self.model.generate(inputs, device=0)
|
33 |
|
34 |
# postprocess the prediction
|
35 |
prediction = self.tokenizer.decode(outputs[0], skip_special_tokens=True)
|