iofu728 commited on
Commit
ba5df81
1 Parent(s): 0ca26f4

Feature(LLMLingua): add examples

Browse files
Files changed (1) hide show
  1. app.py +11 -14
app.py CHANGED
@@ -52,22 +52,22 @@ custom_css = """
52
 
53
  EXAMPLES = [
54
  [
55
- "vicgalle/gpt2-alpaca",
56
- "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",
57
  "8.7x",
58
  "",
 
59
  ],
60
  [
61
  "vicgalle/alpaca-7b",
62
- "Question: Sam bought a dozen boxes, each 30 highl pens inside, $10 each. He reanged five of boxes into of sixlters each sold $3. He sold the theters separately at the of three $2. How much did make in total, in\nLets think step\nSam bought boxes x0 = $10 oflters.\nHe 2 300ters in\nSam then 5 boxes 6ters0ters\nHe sold these boxes for 55\nAfterelling these boxes there300lters remaining\nThese form 330 310 of three pens\nHe sold each of these groups for2 each, so made 0 *0 from\nIn total, he $ $155\nSince his original $1, he earned $20 = $115 in profit.\nThe answer is 115\n\n",
63
  "13.8x",
64
  "78.32",
 
65
  ],
66
  [
67
  "vicgalle/alpaca-7b",
68
- "Question: Sam bought a dozen boxes, each with 30 highl pens inside, for $10 each.\nHe reanged five of boxes into of sixlters each sold them $3 per package.\nHe sold the rest of thelters separately at the of three pens for $2.\nHow much profit did make in total, in dollars\nLet's think step by step\nSam then took 5 boxes × 6lighters/box = 30 highlighters.\nThese form 330 / 3 = 110 groups of three pens.\nThe answer is 115\n\n",
69
  "20.2x",
70
  "77.94",
 
71
  ],
72
  ]
73
 
@@ -88,16 +88,19 @@ with gr.Blocks(css=custom_css) as iface:
88
  label="Instruction",
89
  lines=1,
90
  value="",
 
91
  )
92
  context = gr.Textbox(
93
  label="Context",
94
  lines=3,
95
  value="",
 
96
  )
97
  question = gr.Textbox(
98
  label="Question",
99
  lines=1,
100
  value="",
 
101
  )
102
  with gr.Column(elem_id="params", scale=1):
103
  with gr.Tab('Compression Target'):
@@ -109,10 +112,6 @@ with gr.Blocks(css=custom_css) as iface:
109
  label="Compression Ratio (To use this, set Target Token to -1)",
110
  value=0,
111
  )
112
- # model_name = gr.Textbox(
113
- # label="Small Language Model (only support lgaalves/gpt2-dolly now)",
114
- # value="lgaalves/gpt2-dolly",
115
- # )
116
 
117
  gen_button = gr.Button(value="Compress Prompt!", variant="primary")
118
 
@@ -121,7 +120,7 @@ with gr.Blocks(css=custom_css) as iface:
121
  with gr.Tab('Compressed Prompts'):
122
  compressed_prompt = gr.Textbox(
123
  label="compressed_prompt",
124
- lines=5,
125
  )
126
  with gr.Column(elem_id="Results_2", scale=1):
127
  with gr.Tab('Saving'):
@@ -137,20 +136,18 @@ with gr.Blocks(css=custom_css) as iface:
137
  saving = gr.Textbox(
138
  label="Saving Cost",
139
  )
140
- # acc = gr.Textbox(
141
- # label="GSM8K Acc using GPT-3.5-Turbo",
142
- # )
143
 
144
 
145
  # gr.Examples(
146
  # examples=EXAMPLES,
147
  # inputs=[model_name, compressed_prompt, saving_ratio, acc],
148
  # )
 
149
 
150
  gr.Dataframe(
151
  value=EXAMPLES,
152
- headers=["Small Language Model", "Compressed Prompts", "Actual Compression Ratio", "GSM8K Acc using GPT-3.5-Turbo"],
153
- datatype=["str", "str", "str", "str", "str"],
154
  ),
155
 
156
  gen_button.click(
 
52
 
53
  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
  [
61
  "vicgalle/alpaca-7b",
 
62
  "13.8x",
63
  "78.32",
64
+ "Question: Sam bought a dozen boxes, each 30 highl pens inside, $10 each. He reanged five of boxes into of sixlters each sold $3. He sold the theters separately at the of three $2. How much did make in total, in\nLets think step\nSam bought boxes x0 = $10 oflters.\nHe 2 300ters in\nSam then 5 boxes 6ters0ters\nHe sold these boxes for 55\nAfterelling these boxes there300lters remaining\nThese form 330 310 of three pens\nHe sold each of these groups for2 each, so made 0 *0 from\nIn total, he $ $155\nSince his original $1, he earned $20 = $115 in profit.\nThe answer is 115\n\n",
65
  ],
66
  [
67
  "vicgalle/alpaca-7b",
 
68
  "20.2x",
69
  "77.94",
70
+ "Question: Sam bought a dozen boxes, each with 30 highl pens inside, for $10 each.\nHe reanged five of boxes into of sixlters each sold them $3 per package.\nHe sold the rest of thelters separately at the of three pens for $2.\nHow much profit did make in total, in dollars\nLet's think step by step\nSam then took 5 boxes × 6lighters/box = 30 highlighters.\nThese form 330 / 3 = 110 groups of three pens.\nThe answer is 115\n\n",
71
  ],
72
  ]
73
 
 
88
  label="Instruction",
89
  lines=1,
90
  value="",
91
+ placeholder="This module consists of directives given by the user to the LLMs, such as task descriptions.",
92
  )
93
  context = gr.Textbox(
94
  label="Context",
95
  lines=3,
96
  value="",
97
+ placeholder="This module provides the supplementary context needed to address the question, such as documents, demonstrations, web search results, or API call results.",
98
  )
99
  question = gr.Textbox(
100
  label="Question",
101
  lines=1,
102
  value="",
103
+ placeholder="This refers to the directives given by the user to the LLMs, such as inquiries, questions, or requests.",
104
  )
105
  with gr.Column(elem_id="params", scale=1):
106
  with gr.Tab('Compression Target'):
 
112
  label="Compression Ratio (To use this, set Target Token to -1)",
113
  value=0,
114
  )
 
 
 
 
115
 
116
  gen_button = gr.Button(value="Compress Prompt!", variant="primary")
117
 
 
120
  with gr.Tab('Compressed Prompts'):
121
  compressed_prompt = gr.Textbox(
122
  label="compressed_prompt",
123
+ lines=10,
124
  )
125
  with gr.Column(elem_id="Results_2", scale=1):
126
  with gr.Tab('Saving'):
 
136
  saving = gr.Textbox(
137
  label="Saving Cost",
138
  )
 
 
 
139
 
140
 
141
  # gr.Examples(
142
  # examples=EXAMPLES,
143
  # inputs=[model_name, compressed_prompt, saving_ratio, acc],
144
  # )
145
+ gr.Markdown("## Examples in GSM8K")
146
 
147
  gr.Dataframe(
148
  value=EXAMPLES,
149
+ headers=["Small Language Model", "Compression Ratio", "GSM8K Acc using GPT-3.5-Turbo", "Compressed Prompts",],
150
+ datatype=["str", "str", "str", "str"],
151
  ),
152
 
153
  gen_button.click(