Andrewwwwww
commited on
Commit
•
43203f0
1
Parent(s):
95923dc
Update handler.py
Browse files- handler.py +7 -4
handler.py
CHANGED
@@ -32,10 +32,13 @@ class EndpointHandler:
|
|
32 |
|
33 |
#for chat in prompts:
|
34 |
#print(chat)
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
|
|
|
|
|
|
39 |
|
40 |
"""
|
41 |
encodeds = self.tokenizer.encode(prompt, return_tensors="pt")
|
|
|
32 |
|
33 |
#for chat in prompts:
|
34 |
#print(chat)
|
35 |
+
|
36 |
+
encodeds = self.tokenizer.encode(prompt, return_tensors="pt")
|
37 |
+
model_inputs = encodeds.to(device)
|
38 |
+
self.model.to(device)
|
39 |
+
generated_ids = self.model.generate(model_inputs, max_new_tokens=1000, do_sample=True)
|
40 |
+
decoded = self.tokenizer.decode(generated_ids[0])
|
41 |
+
return decoded
|
42 |
|
43 |
"""
|
44 |
encodeds = self.tokenizer.encode(prompt, return_tensors="pt")
|