Spaces:
Running
on
Zero
Running
on
Zero
AbstractPhil
commited on
Commit
·
e7eb866
1
Parent(s):
206ca02
oauth
Browse files
app.py
CHANGED
@@ -341,47 +341,47 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
341 |
)
|
342 |
|
343 |
# Sign-in note
|
344 |
-
login_status = gr.Markdown(
|
345 |
-
|
346 |
-
)
|
347 |
|
348 |
-
with gr.Row():
|
349 |
-
system_prompt = gr.Textbox(label="System", value=SYSTEM_DEF)
|
350 |
-
with gr.Accordion("Generation settings", open=False):
|
351 |
-
with gr.Row():
|
352 |
-
temperature = gr.Slider(0.0, 2.0, value=0.7, step=0.05, label="temperature")
|
353 |
-
top_p = gr.Slider(0.1, 1.0, value=0.9, step=0.01, label="top_p")
|
354 |
-
top_k = gr.Slider(0, 200, value=0, step=1, label="top_k (0=off)")
|
355 |
-
max_new = gr.Slider(16, 2048, value=MAX_DEF, step=8, label="max_new_tokens")
|
356 |
-
do_sample = gr.Checkbox(value=True, label="do_sample")
|
357 |
-
seed = gr.Number(value=None, label="seed (optional)")
|
358 |
-
with gr.Accordion("Rose guidance (optional)", open=False):
|
359 |
with gr.Row():
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
)
|
373 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
|
|
|
375 |
|
376 |
-
gr.Markdown(
|
|
|
|
|
|
|
|
|
|
|
|
|
377 |
"""
|
378 |
-
|
379 |
-
- Set env `ZEROGPU=1` for just-in-time GPU allocation via @spaces.GPU.
|
380 |
-
- Set `ADAPTER_ID=AbstractPhil/mirel-gpt-oss-20b` and `ADAPTER_SUBFOLDER=checkpoints/checkpoint-516` to use the provided adapter.
|
381 |
-
- Use `torch==2.4.0` for ZeroGPU.
|
382 |
-
- Rose guidance biases logits; it does not change weights.
|
383 |
-
"""
|
384 |
-
)
|
385 |
|
386 |
if __name__ == "__main__":
|
387 |
demo.queue(max_size=8 if ZEROGPU else 32).launch(server_name="0.0.0.0", server_port=7860)
|
|
|
341 |
)
|
342 |
|
343 |
# Sign-in note
|
344 |
+
login_status = gr.Markdown(
|
345 |
+
"If you're logged into huggingface.co in this browser, ZeroGPU will use *your* quota automatically."
|
346 |
+
)
|
347 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
348 |
with gr.Row():
|
349 |
+
system_prompt = gr.Textbox(label="System", value=SYSTEM_DEF)
|
350 |
+
with gr.Accordion("Generation settings", open=False):
|
351 |
+
with gr.Row():
|
352 |
+
temperature = gr.Slider(0.0, 2.0, value=0.7, step=0.05, label="temperature")
|
353 |
+
top_p = gr.Slider(0.1, 1.0, value=0.9, step=0.01, label="top_p")
|
354 |
+
top_k = gr.Slider(0, 200, value=0, step=1, label="top_k (0=off)")
|
355 |
+
max_new = gr.Slider(16, 2048, value=MAX_DEF, step=8, label="max_new_tokens")
|
356 |
+
do_sample = gr.Checkbox(value=True, label="do_sample")
|
357 |
+
seed = gr.Number(value=None, label="seed (optional)")
|
358 |
+
with gr.Accordion("Rose guidance (optional)", open=False):
|
359 |
+
with gr.Row():
|
360 |
+
rose_enable = gr.Checkbox(value=False, label="Enable Rose bias at decode")
|
361 |
+
rose_alpha = gr.Slider(0.0, 5.0, value=1.0, step=0.05, label="rose alpha (strength)")
|
362 |
+
rose_score = gr.Slider(0.0, 1.0, value=1.0, step=0.01, label="rose score (0–1)")
|
363 |
+
rose_tokens = gr.Textbox(label="token:weight list (comma-separated)", value="")
|
364 |
+
rose_json = gr.Textbox(label="JSON {token: weight}", value="")
|
365 |
+
|
366 |
+
chat = gr.ChatInterface(
|
367 |
+
fn=generate_stream,
|
368 |
+
type="messages",
|
369 |
+
additional_inputs=[system_prompt, temperature, top_p, top_k, max_new, do_sample, seed, rose_enable, rose_alpha, rose_score, rose_tokens, rose_json],
|
370 |
+
title="Mirel",
|
371 |
+
cache_examples=False,
|
372 |
+
)
|
373 |
|
374 |
+
|
375 |
|
376 |
+
gr.Markdown(
|
377 |
+
"""
|
378 |
+
**Notes**
|
379 |
+
- Set env `ZEROGPU=1` for just-in-time GPU allocation via @spaces.GPU.
|
380 |
+
- Set `ADAPTER_ID=AbstractPhil/mirel-gpt-oss-20b` and `ADAPTER_SUBFOLDER=checkpoints/checkpoint-516` to use the provided adapter.
|
381 |
+
- Use `torch==2.4.0` for ZeroGPU.
|
382 |
+
- Rose guidance biases logits; it does not change weights.
|
383 |
"""
|
384 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
|
386 |
if __name__ == "__main__":
|
387 |
demo.queue(max_size=8 if ZEROGPU else 32).launch(server_name="0.0.0.0", server_port=7860)
|