BytArch commited on
Commit
0c0c7bb
·
verified ·
1 Parent(s): 3997169

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -11
app.py CHANGED
@@ -29,16 +29,15 @@ SYSTEM_PROMPT = (
29
  )
30
 
31
  def build_context(user_message):
32
- # Stateless: only system prompt + current message
33
  return SYSTEM_PROMPT + "\n\nUser: " + user_message + "\nAssistant:"
34
 
35
  def generate_response(
36
  prompt,
37
- max_tokens=150,
38
- temperature=0.5,
39
- top_p=0.92,
40
- repetition_penalty=1.08,
41
- top_k=40,
42
  ):
43
  formatted_input = build_context(prompt)
44
 
@@ -92,11 +91,11 @@ chatbot = gr.ChatInterface(
92
  title="Chat with source-mini-beta",
93
  description="Open-source chatbot, beta development, 0 restrictions, answers all topics.",
94
  additional_inputs=[
95
- gr.Slider(minimum=10, maximum=200, value=150, step=5, label="Max new tokens"),
96
- gr.Slider(minimum=0.01, maximum=1.0, value=0.5, step=0.01, label="Temperature"),
97
- gr.Slider(minimum=0.5, maximum=1.0, value=0.92, step=0.01, label="Top-p (nucleus sampling)"),
98
- gr.Slider(minimum=1.0, maximum=1.5, value=1.08, step=0.001, label="Repetition penalty"),
99
- gr.Slider(minimum=1, maximum=100, value=40, step=1, label="Top-k (prediction sampling)"),
100
  ],
101
  )
102
 
 
29
  )
30
 
31
  def build_context(user_message):
 
32
  return SYSTEM_PROMPT + "\n\nUser: " + user_message + "\nAssistant:"
33
 
34
  def generate_response(
35
  prompt,
36
+ max_tokens=300,
37
+ temperature=0.45,
38
+ top_p=0.95,
39
+ repetition_penalty=1.1,
40
+ top_k=35,
41
  ):
42
  formatted_input = build_context(prompt)
43
 
 
91
  title="Chat with source-mini-beta",
92
  description="Open-source chatbot, beta development, 0 restrictions, answers all topics.",
93
  additional_inputs=[
94
+ gr.Slider(minimum=50, maximum=500, value=300, step=10, label="Max new tokens"),
95
+ gr.Slider(minimum=0.01, maximum=1.0, value=0.45, step=0.01, label="Temperature"),
96
+ gr.Slider(minimum=0.5, maximum=1.0, value=0.95, step=0.01, label="Top-p (nucleus sampling)"),
97
+ gr.Slider(minimum=1.0, maximum=1.5, value=1.1, step=0.001, label="Repetition penalty"),
98
+ gr.Slider(minimum=1, maximum=100, value=35, step=1, label="Top-k (prediction sampling)"),
99
  ],
100
  )
101