Andrewwwwww commited on
Commit
7f4532c
1 Parent(s): 6474746

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +6 -3
handler.py CHANGED
@@ -22,8 +22,11 @@ class EndpointHandler:
22
 
23
  #for chat in prompts:
24
  #print(chat)
25
- inputs = self.tokenizer(prompt, return_tensors="pt")
26
- outputs = self.model.generate(**inputs, max_new_tokens=20)
27
- return self.tokenizer.decode(outputs[0], skip_special_tokens=True)
 
 
 
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