Feature(LLMLingua): add examples
Browse files
app.py
CHANGED
|
@@ -20,6 +20,14 @@ To use it, upload your prompt and set the compression target.
|
|
| 20 |
You can check our [repo](https://aka.ms/LLMLingua)!
|
| 21 |
"""
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
custom_css = """
|
| 24 |
#image-upload {
|
| 25 |
flex-grow: 1;
|
|
@@ -54,7 +62,7 @@ EXAMPLES = [
|
|
| 54 |
[
|
| 55 |
"lgaalves/gpt2-dolly",
|
| 56 |
"8.7x",
|
| 57 |
-
"",
|
| 58 |
"Question: can buy 4 1melon for You bought 36 fruits evenly split between of 1 $. does cost if bill $\n's think step\nIf between 3 then I 363 = 12 of fruit 1 orange then oranges506If I oranges I $66 $60 on the 2 fruit\n the of is, and that price and is 1W4AIf we know we bought 12 and 12W\n thatW can the 12 = 48\n of apple (60/The 1\n: Sam a dozen boxes with 30ighter pens each Heanged into six3 the separately of three. much in\n's boxes $120 12 =Sam then took 5 boxes × 6 highlighters/box = 30 highlighters.\nHe sold these boxes for 5 * $3 = $15\nAfter selling these 5 boxes there were 360 - 30 = 330 highlighters remaining.\nThese form 330 / 3 = 110 groups of three pens.\nHe sold each of these groups for $2 each, so made 110 * 2 = $220 from them.\nIn total, then, he earned $220 + $15 = $235.\nSince his original cost was $120, he earned $235 - $120 = $115 in profit.\nThe answer is 115",
|
| 59 |
],
|
| 60 |
[
|
|
@@ -142,7 +150,7 @@ with gr.Blocks(css=custom_css) as iface:
|
|
| 142 |
# examples=EXAMPLES,
|
| 143 |
# inputs=[model_name, compressed_prompt, saving_ratio, acc],
|
| 144 |
# )
|
| 145 |
-
gr.Markdown(
|
| 146 |
|
| 147 |
gr.Dataframe(
|
| 148 |
value=EXAMPLES,
|
|
|
|
| 20 |
You can check our [repo](https://aka.ms/LLMLingua)!
|
| 21 |
"""
|
| 22 |
|
| 23 |
+
INTRO_EXAMPLES = '''
|
| 24 |
+
## Examples in GSM8K
|
| 25 |
+
Below are some examples of compressing prompts in GSM8K using different small language models. The original prompt [1] is taken from "Complexity-Based Prompting for Multi-step Reasoning" [2], with an original length of 2,365 tokens. Black-box LLMs use GPT-3.5-Turbo-0301 with greedy decoding.
|
| 26 |
+
|
| 27 |
+
[1] https://github.com/FranxYao/chain-of-thought-hub/blob/main/gsm8k/lib_prompt/prompt_hardest.txt<br>
|
| 28 |
+
[2] Fu, Yao, et al. "Complexity-Based Prompting for Multi-step Reasoning." The Eleventh International Conference on Learning Representations. 2022.
|
| 29 |
+
'''
|
| 30 |
+
|
| 31 |
custom_css = """
|
| 32 |
#image-upload {
|
| 33 |
flex-grow: 1;
|
|
|
|
| 62 |
[
|
| 63 |
"lgaalves/gpt2-dolly",
|
| 64 |
"8.7x",
|
| 65 |
+
"78.24",
|
| 66 |
"Question: can buy 4 1melon for You bought 36 fruits evenly split between of 1 $. does cost if bill $\n's think step\nIf between 3 then I 363 = 12 of fruit 1 orange then oranges506If I oranges I $66 $60 on the 2 fruit\n the of is, and that price and is 1W4AIf we know we bought 12 and 12W\n thatW can the 12 = 48\n of apple (60/The 1\n: Sam a dozen boxes with 30ighter pens each Heanged into six3 the separately of three. much in\n's boxes $120 12 =Sam then took 5 boxes × 6 highlighters/box = 30 highlighters.\nHe sold these boxes for 5 * $3 = $15\nAfter selling these 5 boxes there were 360 - 30 = 330 highlighters remaining.\nThese form 330 / 3 = 110 groups of three pens.\nHe sold each of these groups for $2 each, so made 110 * 2 = $220 from them.\nIn total, then, he earned $220 + $15 = $235.\nSince his original cost was $120, he earned $235 - $120 = $115 in profit.\nThe answer is 115",
|
| 67 |
],
|
| 68 |
[
|
|
|
|
| 150 |
# examples=EXAMPLES,
|
| 151 |
# inputs=[model_name, compressed_prompt, saving_ratio, acc],
|
| 152 |
# )
|
| 153 |
+
gr.Markdown(INTRO_EXAMPLES)
|
| 154 |
|
| 155 |
gr.Dataframe(
|
| 156 |
value=EXAMPLES,
|