Norod78 commited on
Commit
93c95b3
1 Parent(s): 85e04af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -14,7 +14,7 @@ model.to(device)
14
  def generate(text = "", max_new_tokens = 128):
15
  streamer = TextIteratorStreamer(tok, timeout=10.)
16
  if len(text) == 0:
17
- text = " "
18
  inputs = tok([text], return_tensors="pt").to(device)
19
  generation_kwargs = dict(inputs, streamer=streamer, repetition_penalty=2.0, do_sample=True, top_k=40, top_p=0.97, max_new_tokens=max_new_tokens, pad_token_id = model.config.eos_token_id, early_stopping=True, no_repeat_ngram_size=4)
20
  thread = Thread(target=model.generate, kwargs=generation_kwargs)
 
14
  def generate(text = "", max_new_tokens = 128):
15
  streamer = TextIteratorStreamer(tok, timeout=10.)
16
  if len(text) == 0:
17
+ text = " "
18
  inputs = tok([text], return_tensors="pt").to(device)
19
  generation_kwargs = dict(inputs, streamer=streamer, repetition_penalty=2.0, do_sample=True, top_k=40, top_p=0.97, max_new_tokens=max_new_tokens, pad_token_id = model.config.eos_token_id, early_stopping=True, no_repeat_ngram_size=4)
20
  thread = Thread(target=model.generate, kwargs=generation_kwargs)