Pierce Maloney commited on
Commit
d1e4ec5
1 Parent(s): 75114fc

only return new generated tokens, bad_words = comments

Browse files
Files changed (1) hide show
  1. handler.py +2 -1
handler.py CHANGED
@@ -22,7 +22,8 @@ class EndpointHandler():
22
  """
23
  inputs = data.pop("inputs", data)
24
 
25
- prediction = self.pipeline(inputs, stopping_criteria=self.stopping_criteria, max_new_tokens=100)
 
26
  return prediction
27
 
28
 
 
22
  """
23
  inputs = data.pop("inputs", data)
24
 
25
+ # Bad word: id 3070 corresponds to "(*", and we do not want to output a comment
26
+ prediction = self.pipeline(inputs, stopping_criteria=self.stopping_criteria, max_new_tokens=50, return_full_text=False, bad_words_ids=[[3070]])
27
  return prediction
28
 
29