Spaces:
Running on Zero
Running on Zero
Upload 3 files
Browse files
app.py
CHANGED
|
@@ -252,10 +252,22 @@ with gr.Blocks(title="Context Window Extender - Chat") as demo:
|
|
| 252 |
)
|
| 253 |
|
| 254 |
with gr.Row():
|
| 255 |
-
max_new_tokens = gr.Slider(minimum=10, maximum=
|
| 256 |
temperature = gr.Slider(minimum=0.0, maximum=2.0, value=0.7, step=0.1, label="Temperature")
|
| 257 |
top_p = gr.Slider(minimum=0.0, maximum=1.0, value=0.9, step=0.05, label="Top-p")
|
| 258 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 259 |
# Hide/show RoPE options based on extension method
|
| 260 |
def update_rope_visibility(method):
|
| 261 |
return gr.update(visible=method == "rope"), gr.update(visible=method == "rope")
|
|
|
|
| 252 |
)
|
| 253 |
|
| 254 |
with gr.Row():
|
| 255 |
+
max_new_tokens = gr.Slider(minimum=10, maximum=32768, value=256, step=10, label="Max New Tokens")
|
| 256 |
temperature = gr.Slider(minimum=0.0, maximum=2.0, value=0.7, step=0.1, label="Temperature")
|
| 257 |
top_p = gr.Slider(minimum=0.0, maximum=1.0, value=0.9, step=0.05, label="Top-p")
|
| 258 |
|
| 259 |
+
# Update max_new_tokens slider max based on context multiplier
|
| 260 |
+
def update_max_tokens(multiplier):
|
| 261 |
+
base = 32768
|
| 262 |
+
max_tokens = calculate_context_length(base, multiplier)
|
| 263 |
+
return gr.update(maximum=max_tokens)
|
| 264 |
+
|
| 265 |
+
context_multiplier.change(
|
| 266 |
+
fn=update_max_tokens,
|
| 267 |
+
inputs=[context_multiplier],
|
| 268 |
+
outputs=[max_new_tokens]
|
| 269 |
+
)
|
| 270 |
+
|
| 271 |
# Hide/show RoPE options based on extension method
|
| 272 |
def update_rope_visibility(method):
|
| 273 |
return gr.update(visible=method == "rope"), gr.update(visible=method == "rope")
|