MohamedRashad commited on
Commit
f5e1c16
·
1 Parent(s): 060b07d

feat: Add Arabic-ORPO-Llama3 chatbot comparison functionality

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -70,7 +70,7 @@ def generate_both(system_prompt, input_text, chatbot_a, chatbot_b, max_new_token
70
  text_streamer_a = TextIteratorStreamer(tokenizer_a, skip_prompt=True)
71
  text_streamer_b = TextIteratorStreamer(tokenizer_b, skip_prompt=True)
72
 
73
- system_prompt_list = [{"role": "system", "content": system_prompt}]
74
  input_text_list = [{"role": "user", "content": input_text}]
75
 
76
  chat_history_a = []
@@ -161,9 +161,15 @@ def generate_both(system_prompt, input_text, chatbot_a, chatbot_b, max_new_token
161
  def clear():
162
  return [], []
163
 
 
 
 
 
 
164
  with gr.Blocks(title="Arabic-ORPO-Llama3") as demo:
165
  with gr.Column():
166
  gr.HTML("<center><h1>Arabic Chatbot Comparison</h1></center>")
 
167
  system_prompt = gr.Textbox(lines=1, label="System Prompt", value="أنت متحدث لبق باللغة العربية!", rtl=True, text_align="right", show_copy_button=True)
168
  with gr.Row(variant="panel"):
169
  model_dropdown_a = gr.Dropdown(label="Model A", choices=models_available, value=None)
 
70
  text_streamer_a = TextIteratorStreamer(tokenizer_a, skip_prompt=True)
71
  text_streamer_b = TextIteratorStreamer(tokenizer_b, skip_prompt=True)
72
 
73
+ system_prompt_list = [{"role": "system", "content": system_prompt}] if system_prompt else []
74
  input_text_list = [{"role": "user", "content": input_text}]
75
 
76
  chat_history_a = []
 
161
  def clear():
162
  return [], []
163
 
164
+ arena_notes = """Important Notes:
165
+ - `gemma-2` model doesn't have system prompt, so it's make the system prompt field empty for the model to work.
166
+ - Sometimes an error may occur when generating the response, in this case, please try again.
167
+ """
168
+
169
  with gr.Blocks(title="Arabic-ORPO-Llama3") as demo:
170
  with gr.Column():
171
  gr.HTML("<center><h1>Arabic Chatbot Comparison</h1></center>")
172
+ gr.Markdown(arena_notes)
173
  system_prompt = gr.Textbox(lines=1, label="System Prompt", value="أنت متحدث لبق باللغة العربية!", rtl=True, text_align="right", show_copy_button=True)
174
  with gr.Row(variant="panel"):
175
  model_dropdown_a = gr.Dropdown(label="Model A", choices=models_available, value=None)