Andrewwwwww
commited on
Commit
•
7f4532c
1
Parent(s):
6474746
Update handler.py
Browse files- handler.py +6 -3
handler.py
CHANGED
@@ -22,8 +22,11 @@ class EndpointHandler:
|
|
22 |
|
23 |
#for chat in prompts:
|
24 |
#print(chat)
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
28 |
|
29 |
|
|
|
22 |
|
23 |
#for chat in prompts:
|
24 |
#print(chat)
|
25 |
+
encodeds = self.tokenizer.encode(prompt, return_tensors="pt")
|
26 |
+
model_inputs = encodeds.to("cuda")
|
27 |
+
self.model.to("cuda")
|
28 |
+
generated_ids = self.model.generate(model_inputs, max_new_tokens=1000, do_sample=True)
|
29 |
+
decoded = self.tokenizer.decode(generated_ids[0])
|
30 |
+
return decoded
|
31 |
|
32 |
|