jonathanjordan21 commited on
Commit
fd2ed4e
·
verified ·
1 Parent(s): 0f72328

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -45,11 +45,11 @@ def invoke(
45
 
46
  tokens = tokenizer.apply_chat_template(messages, return_tensors='pt', add_generation_prompt=True)
47
 
48
- out = model.generate(tokens, eos_token_id=model.config.eos_token_id, max_new_tokens=max_tokens)
49
 
50
  res = tokenizer.batch_decode(out)
51
 
52
- return res
53
 
54
 
55
  def respond(
@@ -90,7 +90,7 @@ For information on how to customize the ChatInterface, peruse the gradio docs: h
90
  demo = gr.ChatInterface(
91
  invoke,
92
  additional_inputs=[
93
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
94
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
95
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
96
  gr.Slider(
 
45
 
46
  tokens = tokenizer.apply_chat_template(messages, return_tensors='pt', add_generation_prompt=True)
47
 
48
+ out = model.generate(tokens, eos_token_id=model.config.eos_token_id, max_new_tokens=max_tokens, repetition_penalty=1.05, temperature=temperature, top_p=top_p)
49
 
50
  res = tokenizer.batch_decode(out)
51
 
52
+ yield res
53
 
54
 
55
  def respond(
 
90
  demo = gr.ChatInterface(
91
  invoke,
92
  additional_inputs=[
93
+ gr.Textbox(value="You are a helpful assistant.", label="System message"),
94
  gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
95
  gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
96
  gr.Slider(