viethoangtranduong
commited on
Commit
•
d998cf3
1
Parent(s):
a679b46
Update handler.py
Browse files- handler.py +3 -3
handler.py
CHANGED
@@ -28,11 +28,11 @@ class EndpointHandler():
|
|
28 |
prompts = [f"<human>: {prompt}\n<bot>:" for prompt in data["inputs"]]
|
29 |
|
30 |
|
31 |
-
inputs = tokenizer(prompts, padding=True, return_tensors='pt').to(model.device)
|
32 |
input_length = inputs.input_ids.shape[1]
|
33 |
-
outputs = model.generate(
|
34 |
**inputs, max_new_tokens=512, do_sample=True, temperature=0.7, top_p=0.7, top_k=50
|
35 |
)
|
36 |
-
output_strs = tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
37 |
|
38 |
return output_strs
|
|
|
28 |
prompts = [f"<human>: {prompt}\n<bot>:" for prompt in data["inputs"]]
|
29 |
|
30 |
|
31 |
+
inputs = self.tokenizer(prompts, padding=True, return_tensors='pt').to(model.device)
|
32 |
input_length = inputs.input_ids.shape[1]
|
33 |
+
outputs = self.model.generate(
|
34 |
**inputs, max_new_tokens=512, do_sample=True, temperature=0.7, top_p=0.7, top_k=50
|
35 |
)
|
36 |
+
output_strs = self.tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
37 |
|
38 |
return output_strs
|