Commit ·
4c71332
1
Parent(s): be3cd01
Update handler file
Browse files- handler.py +4 -4
handler.py
CHANGED
|
@@ -25,14 +25,14 @@ class EndpointHandler:
|
|
| 25 |
inputs = f"[INST] {inputs} [/INST]"
|
| 26 |
|
| 27 |
# preprocess
|
| 28 |
-
|
| 29 |
-
|
| 30 |
|
| 31 |
# pass inputs with all kwargs in data
|
| 32 |
if parameters is not None:
|
| 33 |
-
outputs = self.model.generate(
|
| 34 |
else:
|
| 35 |
-
outputs = self.model.generate(
|
| 36 |
|
| 37 |
# postprocess the prediction
|
| 38 |
prediction = self.tokenizer.decode(outputs[0], skip_special_tokens=True)
|
|
|
|
| 25 |
inputs = f"[INST] {inputs} [/INST]"
|
| 26 |
|
| 27 |
# preprocess
|
| 28 |
+
inputs = self.tokenizer(inputs, return_tensors="pt")
|
| 29 |
+
inputs = inputs.to(self.model.device)
|
| 30 |
|
| 31 |
# pass inputs with all kwargs in data
|
| 32 |
if parameters is not None:
|
| 33 |
+
outputs = self.model.generate(inputs, **parameters)
|
| 34 |
else:
|
| 35 |
+
outputs = self.model.generate(inputs)
|
| 36 |
|
| 37 |
# postprocess the prediction
|
| 38 |
prediction = self.tokenizer.decode(outputs[0], skip_special_tokens=True)
|