Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
a22a57f
1
Parent(s):
c15090e
Add sampling option to prediction and update demo title with snowflake emoji
Browse files- app.py +15 -5
- samples/6.jpeg +0 -0
app.py
CHANGED
|
@@ -192,12 +192,13 @@ def predict(message,
|
|
| 192 |
temperature=1.0,
|
| 193 |
max_output_tokens=700,
|
| 194 |
top_p=0.7,
|
| 195 |
-
repetition_penalty=2.5
|
|
|
|
| 196 |
|
| 197 |
history = state.get_prompt()
|
| 198 |
logger.info(f"==== History ====\n{history}")
|
| 199 |
|
| 200 |
-
generation_config = dict(temperature=temperature, max_new_tokens= max_output_tokens, top_p=top_p, do_sample=
|
| 201 |
|
| 202 |
question = message
|
| 203 |
pixel_values = None
|
|
@@ -425,8 +426,8 @@ def build_demo():
|
|
| 425 |
)
|
| 426 |
|
| 427 |
with gr.Blocks(
|
| 428 |
-
title="
|
| 429 |
-
theme=
|
| 430 |
css=block_css,
|
| 431 |
js=js,
|
| 432 |
) as demo:
|
|
@@ -450,6 +451,12 @@ def build_demo():
|
|
| 450 |
interactive=True,
|
| 451 |
label="Temperature",
|
| 452 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 453 |
top_p = gr.Slider(
|
| 454 |
minimum=0.0,
|
| 455 |
maximum=1.0,
|
|
@@ -511,7 +518,7 @@ def build_demo():
|
|
| 511 |
[
|
| 512 |
{
|
| 513 |
"files": [
|
| 514 |
-
"samples/
|
| 515 |
],
|
| 516 |
"text": "Hãy viết trích xuất nội dung của hoá đơn dạng JSON.",
|
| 517 |
}
|
|
@@ -582,6 +589,7 @@ def build_demo():
|
|
| 582 |
[
|
| 583 |
state,
|
| 584 |
temperature,
|
|
|
|
| 585 |
top_p,
|
| 586 |
repetition_penalty,
|
| 587 |
max_output_tokens,
|
|
@@ -600,6 +608,7 @@ def build_demo():
|
|
| 600 |
[
|
| 601 |
state,
|
| 602 |
temperature,
|
|
|
|
| 603 |
top_p,
|
| 604 |
repetition_penalty,
|
| 605 |
max_output_tokens,
|
|
@@ -616,6 +625,7 @@ def build_demo():
|
|
| 616 |
[
|
| 617 |
state,
|
| 618 |
temperature,
|
|
|
|
| 619 |
top_p,
|
| 620 |
repetition_penalty,
|
| 621 |
max_output_tokens,
|
|
|
|
| 192 |
temperature=1.0,
|
| 193 |
max_output_tokens=700,
|
| 194 |
top_p=0.7,
|
| 195 |
+
repetition_penalty=2.5,
|
| 196 |
+
do_sample=False):
|
| 197 |
|
| 198 |
history = state.get_prompt()
|
| 199 |
logger.info(f"==== History ====\n{history}")
|
| 200 |
|
| 201 |
+
generation_config = dict(temperature=temperature, max_new_tokens= max_output_tokens, top_p=top_p, do_sample=do_sample, num_beams = 3, repetition_penalty=repetition_penalty)
|
| 202 |
|
| 203 |
question = message
|
| 204 |
pixel_values = None
|
|
|
|
| 426 |
)
|
| 427 |
|
| 428 |
with gr.Blocks(
|
| 429 |
+
title="❄️ Vintern-1B-v3_5-Demo ❄️",
|
| 430 |
+
theme=gr.themes.Ocean(),
|
| 431 |
css=block_css,
|
| 432 |
js=js,
|
| 433 |
) as demo:
|
|
|
|
| 451 |
interactive=True,
|
| 452 |
label="Temperature",
|
| 453 |
)
|
| 454 |
+
do_sample = gr.Checkbox(
|
| 455 |
+
label="Sampling",
|
| 456 |
+
default=False,
|
| 457 |
+
interactive=True,
|
| 458 |
+
)
|
| 459 |
+
|
| 460 |
top_p = gr.Slider(
|
| 461 |
minimum=0.0,
|
| 462 |
maximum=1.0,
|
|
|
|
| 518 |
[
|
| 519 |
{
|
| 520 |
"files": [
|
| 521 |
+
"samples/6.jpeg",
|
| 522 |
],
|
| 523 |
"text": "Hãy viết trích xuất nội dung của hoá đơn dạng JSON.",
|
| 524 |
}
|
|
|
|
| 589 |
[
|
| 590 |
state,
|
| 591 |
temperature,
|
| 592 |
+
do_sample,
|
| 593 |
top_p,
|
| 594 |
repetition_penalty,
|
| 595 |
max_output_tokens,
|
|
|
|
| 608 |
[
|
| 609 |
state,
|
| 610 |
temperature,
|
| 611 |
+
do_sample,
|
| 612 |
top_p,
|
| 613 |
repetition_penalty,
|
| 614 |
max_output_tokens,
|
|
|
|
| 625 |
[
|
| 626 |
state,
|
| 627 |
temperature,
|
| 628 |
+
do_sample,
|
| 629 |
top_p,
|
| 630 |
repetition_penalty,
|
| 631 |
max_output_tokens,
|
samples/6.jpeg
ADDED
|