MichaelAI23 commited on
Commit
4c71332
1 Parent(s): be3cd01

Update handler file

Browse files
Files changed (1) hide show
  1. handler.py +4 -4
handler.py CHANGED
@@ -25,14 +25,14 @@ class EndpointHandler:
25
  inputs = f"[INST] {inputs} [/INST]"
26
 
27
  # preprocess
28
- input_ids = self.tokenizer(inputs, return_tensors="pt").input_ids
29
- input_ids = input_ids.to(self.model.device)
30
 
31
  # pass inputs with all kwargs in data
32
  if parameters is not None:
33
- outputs = self.model.generate(input_ids, **parameters)
34
  else:
35
- outputs = self.model.generate(input_ids)
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)