jauntybrain commited on
Commit
42c44d1
1 Parent(s): fa4523a

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +4 -8
handler.py CHANGED
@@ -25,14 +25,10 @@ class EndpointHandler:
25
  return_tensors="pt",).to("cuda")
26
 
27
  # pass inputs with all kwargs in data
28
- if parameters is not None:
29
- with torch.autocast("cuda"):
30
- outputs = self.model.generate(**inputs, **parameters)
31
- else:
32
- with torch.autocast("cuda"):
33
- outputs = self.model.generate(**inputs,)
34
 
35
  # postprocess the prediction
36
- prediction = outputs[0].cpu().numpy().tolist()
37
 
38
- return [{"generated_audio": prediction}]
 
25
  return_tensors="pt",).to("cuda")
26
 
27
  # pass inputs with all kwargs in data
28
+ with torch.autocast("cuda"):
29
+ outputs = self.model.generate(**inputs, do_sample=False, max_new_tokens=400)
 
 
 
 
30
 
31
  # postprocess the prediction
32
+ prediction = outputs[0].cpu().numpy().tobytes()
33
 
34
+ return prediction