5to9 commited on
Commit
2509698
1 Parent(s): 827f420

0.42 Layout tweaks.

Browse files
Files changed (1) hide show
  1. app.py +8 -13
app.py CHANGED
@@ -42,7 +42,7 @@ try:
42
  device_map="auto",
43
  trust_remote_code=True,
44
  )
45
- #model_a.tie_weights()
46
  tokenizer_b = AutoTokenizer.from_pretrained(model_info[1]['id'])
47
  model_b = AutoModelForCausalLM.from_pretrained(
48
  model_info[1]['id'],
@@ -50,7 +50,7 @@ try:
50
  device_map="auto",
51
  trust_remote_code=True,
52
  )
53
- model_b.tie_weights()
54
  except Exception as e:
55
  logging.error(f'{SPACER} Error: {e}, Traceback {traceback.format_exc()}')
56
 
@@ -197,17 +197,12 @@ def reveal_bot(selection, chatbot_a, chatbot_b):
197
  chatbot_b.append(["🤝", f"Dunno. I am {model_info[1]['name']}"])
198
  return chatbot_a, chatbot_b
199
 
200
- arena_notes = """## Important Notes:
201
- - Sometimes an error may occur when generating the response, in this case, please try again.
202
- """
203
-
204
  with gr.Blocks() as demo:
205
  try:
206
  with gr.Column():
207
- gr.HTML("<center><h1>🤖le Royale</h1></center>")
208
- gr.Markdown(arena_notes)
209
- with gr.Row(variant="panel"):
210
- with gr.Column(scale=1):
211
  language_dropdown = gr.Dropdown(
212
  choices=["English", "German", "French", "Spanish"],
213
  label="Select Language for System Prompt",
@@ -233,9 +228,9 @@ with gr.Blocks() as demo:
233
  with gr.Row(variant="panel"):
234
  better_bot = gr.Radio(["Bot A kicks ass!", "Bot B crushes it!", "It's a draw."], label="Rate the output!")
235
  with gr.Accordion(label="Generation Configurations", open=False):
236
- max_new_tokens = gr.Slider(minimum=128, maximum=4096, value=2048, label="Max New Tokens", step=128)
237
  temperature = gr.Slider(minimum=0.0, maximum=1.0, value=0.7, label="Temperature", step=0.01)
238
- top_p = gr.Slider(minimum=0.0, maximum=1.0, value=1.0, label="Top-p", step=0.01)
239
  repetition_penalty = gr.Slider(minimum=0.1, maximum=2.0, value=1.1, label="Repetition Penalty", step=0.1)
240
 
241
 
@@ -245,7 +240,7 @@ with gr.Blocks() as demo:
245
  outputs=[system_prompt]
246
  )
247
 
248
- better_bot.select(reveal_bot, inputs=[better_bot, chatbot_a, chatbot_b], outputs=[chatbot_a, chatbot_b]) #fckp outputs=[chatbot_a, chatbot_b]
249
  input_text.submit(generate_both, inputs=[system_prompt, input_text, chatbot_a, chatbot_b, max_new_tokens, temperature, top_p, repetition_penalty], outputs=[chatbot_a, chatbot_b])
250
  submit_btn.click(generate_both, inputs=[system_prompt, input_text, chatbot_a, chatbot_b, max_new_tokens, temperature, top_p, repetition_penalty], outputs=[chatbot_a, chatbot_b])
251
  clear_btn.click(clear, outputs=[chatbot_a, chatbot_b])
 
42
  device_map="auto",
43
  trust_remote_code=True,
44
  )
45
+
46
  tokenizer_b = AutoTokenizer.from_pretrained(model_info[1]['id'])
47
  model_b = AutoModelForCausalLM.from_pretrained(
48
  model_info[1]['id'],
 
50
  device_map="auto",
51
  trust_remote_code=True,
52
  )
53
+
54
  except Exception as e:
55
  logging.error(f'{SPACER} Error: {e}, Traceback {traceback.format_exc()}')
56
 
 
197
  chatbot_b.append(["🤝", f"Dunno. I am {model_info[1]['name']}"])
198
  return chatbot_a, chatbot_b
199
 
 
 
 
 
200
  with gr.Blocks() as demo:
201
  try:
202
  with gr.Column():
203
+ gr.HTML("<center><h1>Bot Battle Royale</h1><p>Try a prompt in a language you like. Set the parameters and vote for the best answers. Finally, the bots reveal their identity.</p></center>")
204
+ with gr.Row(variant="compact"):
205
+ with gr.Column(scale=0):
 
206
  language_dropdown = gr.Dropdown(
207
  choices=["English", "German", "French", "Spanish"],
208
  label="Select Language for System Prompt",
 
228
  with gr.Row(variant="panel"):
229
  better_bot = gr.Radio(["Bot A kicks ass!", "Bot B crushes it!", "It's a draw."], label="Rate the output!")
230
  with gr.Accordion(label="Generation Configurations", open=False):
231
+ max_new_tokens = gr.Slider(minimum=128, maximum=4096, value=512, label="Max new tokens", step=128)
232
  temperature = gr.Slider(minimum=0.0, maximum=1.0, value=0.7, label="Temperature", step=0.01)
233
+ top_p = gr.Slider(minimum=0.0, maximum=1.0, value=1.0, label="Top_p", step=0.01)
234
  repetition_penalty = gr.Slider(minimum=0.1, maximum=2.0, value=1.1, label="Repetition Penalty", step=0.1)
235
 
236
 
 
240
  outputs=[system_prompt]
241
  )
242
 
243
+ better_bot.select(reveal_bot, inputs=[better_bot, chatbot_a, chatbot_b], outputs=[chatbot_a, chatbot_b])
244
  input_text.submit(generate_both, inputs=[system_prompt, input_text, chatbot_a, chatbot_b, max_new_tokens, temperature, top_p, repetition_penalty], outputs=[chatbot_a, chatbot_b])
245
  submit_btn.click(generate_both, inputs=[system_prompt, input_text, chatbot_a, chatbot_b, max_new_tokens, temperature, top_p, repetition_penalty], outputs=[chatbot_a, chatbot_b])
246
  clear_btn.click(clear, outputs=[chatbot_a, chatbot_b])