EITD commited on
Commit
db267f5
·
1 Parent(s): d895b36
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -59,10 +59,13 @@ def respond(
59
  add_generation_prompt = True, # Must add for generation
60
  return_tensors = "pt",
61
  )
62
- text_streamer = TextStreamer(tokenizer, skip_prompt = True)
63
- for response in model.generate(input_ids = inputs, streamer = text_streamer, max_new_tokens = max_tokens, use_cache = True,
64
- temperature = temperature, min_p = top_p):
65
- yield response
 
 
 
66
 
67
 
68
  """
 
59
  add_generation_prompt = True, # Must add for generation
60
  return_tensors = "pt",
61
  )
62
+ # text_streamer = TextStreamer(tokenizer, skip_prompt = True)
63
+ # for response in model.generate(input_ids = inputs, streamer = text_streamer, max_new_tokens = max_tokens, use_cache = True,
64
+ # temperature = temperature, min_p = top_p):
65
+ # yield response
66
+ outputs = model.generate(input_ids = inputs, max_new_tokens = max_tokens, use_cache = True,
67
+ temperature = temperature, min_p = top_p)
68
+ return tokenizer.batch_decode(outputs)
69
 
70
 
71
  """