Koshti10 commited on
Commit
ef818ff
Β·
verified Β·
1 Parent(s): 6d5b718

Upload 11 files

Browse files
README.md CHANGED
@@ -1,10 +1,10 @@
1
  ---
2
- title: TestLLMCalc
3
- emoji: πŸ“ˆ
4
- colorFrom: pink
5
- colorTo: purple
6
  sdk: gradio
7
- sdk_version: 5.12.0
8
  app_file: app.py
9
  pinned: false
10
  ---
 
1
  ---
2
+ title: LLMCalc
3
+ emoji: πŸ†
4
+ colorFrom: red
5
+ colorTo: pink
6
  sdk: gradio
7
+ sdk_version: 4.44.1
8
  app_file: app.py
9
  pinned: false
10
  ---
app.py ADDED
@@ -0,0 +1,330 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import gradio as gr
3
+ import os
4
+ from gradio_rangeslider import RangeSlider
5
+
6
+ from src.filter_utils import filter, filter_cols
7
+
8
+ # Main Leaderboard containing everything
9
+ text_leaderboard = pd.read_csv(os.path.join('assets', 'merged_data.csv'))
10
+ text_leaderboard = text_leaderboard.sort_values(by='Clemscore', ascending=False)
11
+
12
+ open_weight_df = text_leaderboard[text_leaderboard['Open Weight'] == True]
13
+ if not open_weight_df.empty: # Check if filtered df is non-empty
14
+ max_parameter_size = open_weight_df['Parameters (B)'].max()
15
+
16
+ # Short leaderboard containing fixed columns
17
+ short_leaderboard = filter_cols(text_leaderboard)
18
+
19
+ ## Extract data
20
+ langs = []
21
+ licenses = []
22
+ ip_prices = []
23
+ op_prices = []
24
+ latencies = []
25
+ parameters = []
26
+ contexts = []
27
+ dates = []
28
+
29
+ for i in range(len(text_leaderboard)):
30
+ lang_splits = text_leaderboard.iloc[i]['Languages'].split(',')
31
+ lang_splits = [s.strip() for s in lang_splits]
32
+ langs += lang_splits
33
+ license_name = text_leaderboard.iloc[i]['License Name']
34
+
35
+ licenses.append(license_name)
36
+ ip_prices.append(text_leaderboard.iloc[i]['Input $/1M tokens'])
37
+ op_prices.append(text_leaderboard.iloc[i]['Output $/1M tokens'])
38
+ latencies.append(text_leaderboard.iloc[i]['Latency (s)'])
39
+ parameters.append(text_leaderboard.iloc[i]['Parameters (B)'])
40
+ contexts.append(text_leaderboard.iloc[i]['Context Size (k)'])
41
+ dates.append(text_leaderboard.iloc[i]['Release Date'])
42
+
43
+
44
+ langs = list(set(langs))
45
+ langs.sort()
46
+
47
+ licenses = list(set(licenses))
48
+ licenses.sort()
49
+
50
+ max_input_price = max(ip_prices)
51
+ max_output_price = max(op_prices)
52
+ max_latency = max(latencies)
53
+
54
+ min_parameters = 0 if pd.isna(min(parameters)) else min(parameters)
55
+ max_parameter = max_parameter_size
56
+ parameter_step = 1
57
+ print(f"MIN {min_parameters}, MAX {max_parameter}")
58
+
59
+ min_context = min(contexts)
60
+ max_context = max(contexts)
61
+ context_step = 8
62
+
63
+ min_date = min(dates)
64
+ max_date = max(dates)
65
+
66
+ TITLE = """<h1 align="center" id="space-title"> LLM Calculator βš–οΈβš‘ πŸ“πŸ’°</h1>"""
67
+ CSS = """
68
+ #double-slider-1 {height: 100px}
69
+ #double-slider-2 {height: 100px}
70
+ #double-slider-3 {height: 100px}
71
+ #double-slider-4 {height: 100px}
72
+ """
73
+
74
+ llm_calc_app = gr.Blocks(css=CSS)
75
+ with llm_calc_app:
76
+
77
+ gr.HTML(TITLE)
78
+
79
+ ##################################################
80
+
81
+ with gr.Row():
82
+
83
+ #####################################
84
+ # First Column
85
+ ####################################
86
+ ## Language Select
87
+ with gr.Column():
88
+
89
+ with gr.Row():
90
+ lang_dropdown = gr.Dropdown(
91
+ choices=langs,
92
+ value=[],
93
+ multiselect=True,
94
+ label="Select Languages πŸ—£οΈ"
95
+ )
96
+
97
+ with gr.Row():
98
+ start_date = gr.DateTime(
99
+ value=min_date,
100
+ type="string",
101
+ label="Release Date Range πŸ“… - Start Date"
102
+ )
103
+
104
+ end_date = gr.DateTime(
105
+ value=max_date,
106
+ type="string",
107
+ label="End Date"
108
+ )
109
+
110
+ # Multiodality Select
111
+ with gr.Row():
112
+ multimodal_checkbox = gr.CheckboxGroup(
113
+ choices=['Image', 'Multi-Image', 'Audio', 'Video'],
114
+ value=[],
115
+ label="Select Additional Modalities πŸ“·πŸŽ§πŸŽ¬",
116
+ )
117
+
118
+ # Open/Commercial Selection
119
+ with gr.Row():
120
+ open_weight_checkbox = gr.CheckboxGroup(
121
+ choices=['Open', 'Commercial'],
122
+ value=['Open', 'Commercial'],
123
+ label="Filter by Model Type πŸ”“ πŸ’Ό",
124
+ )
125
+
126
+ # License selection
127
+ with gr.Row():
128
+ license_checkbox = gr.CheckboxGroup(
129
+ choices=licenses,
130
+ value=licenses,
131
+ label="License Type πŸ›‘οΈ",
132
+ )
133
+
134
+ #############################################################
135
+ # Second Column
136
+ #############################################################
137
+ with gr.Column():
138
+
139
+ ####### LOG SLIDER 1 ###########
140
+ with gr.Row():
141
+ parameter_slider = RangeSlider(
142
+ minimum=0,
143
+ maximum=max_parameter,
144
+ label=f"Select Parameter Range πŸ” {int(min_parameters)}B - {int(max_parameter)}B+",
145
+ elem_id="double-slider-1",
146
+ step=parameter_step
147
+ )
148
+
149
+
150
+ ########### LOG SLIDER 2 ################
151
+
152
+ with gr.Row():
153
+ context_slider = RangeSlider(
154
+ minimum=0,
155
+ maximum=max_context,
156
+ label="Select Context Range (k) πŸ“",
157
+ elem_id="double-slider-2",
158
+ step=context_step
159
+ )
160
+
161
+ ############# PRICE SLIDER 1 ###############
162
+ with gr.Row():
163
+ input_pricing_slider = RangeSlider(
164
+ minimum=0,
165
+ maximum=max_input_price,
166
+ value=(0, max_input_price),
167
+ label="Select Price range πŸ’²/1M input tokens",
168
+ elem_id="double-slider-3"
169
+ )
170
+
171
+ ############### PRICE SLIDER 2 ###############
172
+ with gr.Row():
173
+ output_pricing_slider = RangeSlider(
174
+ minimum=0,
175
+ maximum=max_output_price,
176
+ value=(0, max_output_price),
177
+ label="Select Price range πŸ’²/1M output tokens",
178
+ elem_id="double-slider-4"
179
+ )
180
+
181
+
182
+ with gr.Row():
183
+ """
184
+ Main Leaderboard Row
185
+ """
186
+
187
+ leaderboard_table = gr.Dataframe(
188
+ value=short_leaderboard,
189
+ elem_id="text-leaderboard-table",
190
+ interactive=False,
191
+ visible=True,
192
+ datatype=['html', 'number', 'number', 'date', 'number', 'number', 'number', 'number', 'html']
193
+ )
194
+
195
+
196
+ dummy_leaderboard_table = gr.Dataframe(
197
+ value=text_leaderboard,
198
+ elem_id="dummy-leaderboard-table",
199
+ interactive=False,
200
+ visible=False
201
+ )
202
+
203
+ lang_dropdown.change(
204
+ filter,
205
+ [dummy_leaderboard_table, lang_dropdown, parameter_slider,
206
+ input_pricing_slider, output_pricing_slider, multimodal_checkbox,
207
+ context_slider, open_weight_checkbox, start_date, end_date, license_checkbox],
208
+ [leaderboard_table],
209
+ queue=True
210
+ )
211
+
212
+ parameter_slider.change(
213
+ filter,
214
+ [dummy_leaderboard_table, lang_dropdown, parameter_slider,
215
+ input_pricing_slider, output_pricing_slider, multimodal_checkbox,
216
+ context_slider, open_weight_checkbox, start_date, end_date, license_checkbox],
217
+ [leaderboard_table],
218
+ queue=True
219
+ )
220
+
221
+ input_pricing_slider.change(
222
+ filter,
223
+ [dummy_leaderboard_table, lang_dropdown, parameter_slider,
224
+ input_pricing_slider, output_pricing_slider, multimodal_checkbox,
225
+ context_slider, open_weight_checkbox, start_date, end_date, license_checkbox],
226
+ [leaderboard_table],
227
+ queue=True
228
+ )
229
+
230
+ output_pricing_slider.change(
231
+ filter,
232
+ [dummy_leaderboard_table, lang_dropdown, parameter_slider,
233
+ input_pricing_slider, output_pricing_slider, multimodal_checkbox,
234
+ context_slider, open_weight_checkbox, start_date, end_date, license_checkbox],
235
+ [leaderboard_table],
236
+ queue=True
237
+ )
238
+
239
+ multimodal_checkbox.change(
240
+ filter,
241
+ [dummy_leaderboard_table, lang_dropdown, parameter_slider,
242
+ input_pricing_slider, output_pricing_slider, multimodal_checkbox,
243
+ context_slider, open_weight_checkbox, start_date, end_date, license_checkbox],
244
+ [leaderboard_table],
245
+ queue=True
246
+ )
247
+
248
+ open_weight_checkbox.change(
249
+ filter,
250
+ [dummy_leaderboard_table, lang_dropdown, parameter_slider,
251
+ input_pricing_slider, output_pricing_slider, multimodal_checkbox,
252
+ context_slider, open_weight_checkbox, start_date, end_date, license_checkbox],
253
+ [leaderboard_table],
254
+ queue=True
255
+ )
256
+
257
+ context_slider.change(
258
+ filter,
259
+ [dummy_leaderboard_table, lang_dropdown, parameter_slider,
260
+ input_pricing_slider, output_pricing_slider, multimodal_checkbox,
261
+ context_slider, open_weight_checkbox, start_date, end_date, license_checkbox],
262
+ [leaderboard_table],
263
+ queue=True
264
+ )
265
+
266
+ start_date.change(
267
+ filter,
268
+ [dummy_leaderboard_table, lang_dropdown, parameter_slider,
269
+ input_pricing_slider, output_pricing_slider, multimodal_checkbox,
270
+ context_slider, open_weight_checkbox, start_date, end_date, license_checkbox],
271
+ [leaderboard_table],
272
+ queue=True
273
+ )
274
+
275
+ end_date.change(
276
+ filter,
277
+ [dummy_leaderboard_table, lang_dropdown, parameter_slider,
278
+ input_pricing_slider, output_pricing_slider, multimodal_checkbox,
279
+ context_slider, open_weight_checkbox, start_date, end_date, license_checkbox],
280
+ [leaderboard_table],
281
+ queue=True
282
+ )
283
+
284
+ license_checkbox.change(
285
+ filter,
286
+ [dummy_leaderboard_table, lang_dropdown, parameter_slider,
287
+ input_pricing_slider, output_pricing_slider, multimodal_checkbox,
288
+ context_slider, open_weight_checkbox, start_date, end_date, license_checkbox],
289
+ [leaderboard_table],
290
+ queue=True
291
+ )
292
+
293
+ llm_calc_app.load()
294
+ llm_calc_app.queue()
295
+ llm_calc_app.launch()
296
+
297
+
298
+
299
+ """
300
+ model_name, input_price, output_price,
301
+ multimodality_image,multimodality_multiple_image,multimodality_audio,multimodality_video,
302
+ source,licence_name,licence_url,languages,release_date,
303
+ parameters_estimated,parameters_actual,
304
+
305
+ open_weight,context,
306
+
307
+ additional_prices_context_caching,
308
+ additional_prices_context_storage,
309
+ additional_prices_image_input,additional_prices_image_output,additional_prices_video_input,additional_prices_video_output,additional_prices_audio_input,additional_prices_audio_output,clemscore_v1.6.5_multimodal,clemscore_v1.6.5_ascii,clemscore_v1.6,latency_v1.6,latency_v1.6.5_multimodal,latency_v1.6.5_ascii,
310
+
311
+ average_clemscore,average_latency,parameters
312
+
313
+ Final list
314
+
315
+ model_name, input_price, output_price,
316
+ multimodality_image,multimodality_multiple_image,multimodality_audio,multimodality_video,
317
+ source,licence_name,licence_url,languages,release_date, open_weight,context, average_clemscore,average_latency,parameters
318
+
319
+
320
+ Filter
321
+ multimodality_image,multimodality_multiple_image,multimodality_audio,multimodality_video,
322
+ licence_name+licence_url, languages, release_date, open_weight
323
+
324
+ RR
325
+ model_name, input_price, output_price,
326
+ source, release_date
327
+
328
+ """
329
+
330
+
assets/merged_data.csv ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Model Name,Latency (s),Clemscore,Parameters (B),Release Date,Open Weight,Languages,Context Size (k),License Name,License URL,Single Image,Multiple Images,Audio,Video,Input $/1M tokens,Output $/1M tokens,License,Temp Date
2
+ o1-preview-2024-09-12,7.368572853601854,73.63,,2024-09-12,False,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,15.0,60.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-09-12
3
+ gpt-4-1106-vision-preview,4.712557435752081,73.55,,2023-11-06,False,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,10.0,30.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-11-06
4
+ claude-3-5-sonnet-20240620,2.0645066812060726,68.925,,2024-06-20,False,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,3.0,15.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-06-20
5
+ gpt-4o-2024-08-06,1.951333607454077,63.875,,2024-08-06,False,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,3.75,15.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-08-06
6
+ gpt-4o-2024-05-13,5.022646224034688,58.95,,2024-05-13,False,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,5.0,15.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-05-13
7
+ gpt-4-turbo-2024-04-09,,58.3,,2024-04-09,False,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,10.0,30.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-04-09
8
+ claude-3-opus-20240229,3.916101346449241,55.29,,2024-02-29,False,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,15.0,75.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-02-29
9
+ gpt-4-0125-preview,1.0418927523113648,52.5,,2024-01-25,False,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,10.0,30.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-01-25
10
+ Meta-Llama-3.1-405B-Instruct-Turbo,0.7886103946545819,52.11,405.0,2024-07-23,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-07-23
11
+ gpt-4-1106-preview,0.7767265743542736,51.99,,2023-11-06,False,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-11-06
12
+ gpt-4-0613,0.648441146582876,51.09,,2023-06-13,False,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-06-13
13
+ gpt-4o-mini-2024-07-18,2.08647007916325,46.55,,2024-07-18,False,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,0.3,1.2,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-07-18
14
+ Mistral-Large-Instruct-2407,1.2444667688634192,45.39,123.0,2024-07-24,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-07-24
15
+ Meta-Llama-3.1-70B-Instruct,0.8105055275945292,38.83,70.0,2024-07-23,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-07-23
16
+ InternVL2-26B,4.239272214812438,37.45,26.0,2024-07-15,True,"Chinese, English",,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-07-15
17
+ InternVL2-Llama3-76B,10.660117299385416,33.84,76.0,2024-07-15,True,"Chinese, English",,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-07-15
18
+ claude-2.1,1.6836316221022516,32.5,,2023-11-21,False,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,8.0,24.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-11-21
19
+ InternVL2-40B,6.267102418391484,32.23,40.0,2024-07-15,True,"Chinese, English",,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-07-15
20
+ claude-3-sonnet-20240229,1.4194860128225952,30.53,,2024-02-29,False,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,3.0,15.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-02-29
21
+ Qwen1.5-72B-Chat,12.689668927658191,30.37,72.0,2024-01-30,True,"Chinese, English",,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-01-30
22
+ Qwen2-72B-Instruct,0.9480584860151366,30.03,72.0,2024-05-28,True,"Chinese, English",,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-05-28
23
+ idefics-80b-instruct,6.8089303915502315,29.55,80.0,2023-07-24,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-07-24
24
+ Pixtral-12B-2409,1.4976731684122335,28.64,12.0,2024-09-11,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-09-11
25
+ mistral-large-2402,0.3967416598893965,28.17,123.0,2024-02-01,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-02-01
26
+ Qwen2.5-Coder-32B-Instruct,0.8337066960552915,27.57,32.0,2024-11-06,True,"Chinese, English",,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-11-06
27
+ gemma-2-9b-it,0.3692553324432573,27.34,9.0,2024-06-24,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-06-24
28
+ gpt-3.5-turbo-0125,,27.22,,2024-01-25,False,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.5,1.5,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-01-25
29
+ command-r-plus,0.3104016019283746,24.94,104.0,2024-04-01,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-04-01
30
+ openchat_3.5,0.3172876868462049,23.64,7.0,2023-10-30,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-10-30
31
+ InternVL2-8B,1.948600327851168,23.17,8.0,2024-07-15,True,"Chinese, English",,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-07-15
32
+ claude-3-haiku-20240307,0.8695497396191068,22.49,,2024-03-07,False,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,0.25,1.25,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-03-07
33
+ sheep-duck-llama-2-70b-v1.1,5.524607914346901,21.5,70.0,2023-09-27,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-09-27
34
+ Meta-Llama-3.1-8B-Instruct,0.206305748406081,18.36,8.0,2024-07-23,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-07-23
35
+ openchat-3.5-1210,0.280498276910299,18.22,7.0,2023-12-10,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-12-10
36
+ Idefics3-8B-Llama3,2.7247848158020003,17.52,8.0,2024-08-05,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-08-05
37
+ WizardLM-70b-v1.0,3.924977203883497,17.4,70.0,2023-08-09,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-08-09
38
+ openchat-3.5-0106,0.2920951450556648,17.1,7.0,2024-01-06,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-01-06
39
+ internlm-xcomposer2d5-7b,8.438096179522176,16.95,7.0,2024-07-02,True,"Chinese, English",,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-07-02
40
+ mistral-medium-2312,3.3167870515212083,16.43,,2023-12-01,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-12-01
41
+ Phi-3.5-vision-instruct,1.540488050470713,15.64,4.0,2024-08-17,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-08-17
42
+ codegemma-7b-it,0.3048974050865229,15.3,7.0,2024-04-09,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-04-09
43
+ CodeLlama-34b-Instruct-hf,3.851887315425933,14.35,34.0,2023-08-24,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-08-24
44
+ command-r,0.1883241491458606,14.15,35.0,2024-03-01,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-03-01
45
+ gemma-1.1-7b-it,0.1782953878345496,14.14,7.0,2024-03-26,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-03-26
46
+ SUS-Chat-34B,2.27951476106911,14.11,34.0,2023-11-29,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-11-29
47
+ aya-23-35B,0.5755088395104287,13.35,35.0,2024-05-19,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-05-19
48
+ Mixtral-8x22B-Instruct-v0.1,1.0759354563573875,12.69,141.0,2024-04-17,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-04-17
49
+ tulu-2-dpo-70b,7.848597339328536,12.62,70.0,2023-11-12,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-11-12
50
+ idefics-9b-instruct,4.156911970172687,12.29,9.0,2023-07-24,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-07-24
51
+ aya-23-8B,0.4818848185613353,11.72,8.0,2024-05-19,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-05-19
52
+ WizardLM-13b-v1.2,3.5654367625763,11.48,13.0,2023-07-25,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-07-25
53
+ vicuna-33b-v1.3,0.8235025152162306,11.27,33.0,2023-06-21,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-06-21
54
+ Llama-3.1-Nemotron-70B-Instruct-HF,1.105406813859938,10.16,70.0,2024-10-12,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-10-12
55
+ Yi-34B-Chat,1.2871676207135438,8.27,34.0,2023-11-22,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-11-22
56
+ Mixtral-8x7B-Instruct-v0.1,0.9392967660636314,8.17,46.7,2023-12-11,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-12-11
57
+ Mixtral-8x7B-Instruct-v0.1,0.9392967660636314,8.17,46.7,2023-12-11,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-12-11
58
+ Mistral-7B-Instruct-v0.1,0.2828647550771728,8.01,7.0,2023-09-27,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-09-27
59
+ vicuna-13b-v1.5,1.4753938719676598,7.01,13.0,2023-07-29,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-07-29
60
+ Starling-LM-7B-beta,1.365002297029703,6.56,7.0,2024-03-19,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-03-19
61
+ Phi-3-mini-128k-instruct,0.6615315832127354,6.33,3.8,2024-04-22,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-04-22
62
+ Qwen2-7B-Instruct,0.3589407217948714,6.18,7.0,2024-06-04,True,"Chinese, English",,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-06-04
63
+ salamandra-7b-instruct,0.3894831193548387,6.04,7.0,2024-09-30,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-09-30
64
+ sheep-duck-llama-2-13b,2.9462099794520573,5.39,13.0,2023-10-04,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-10-04
65
+ dolphin-vision-72b,10.190958003739729,4.65,72.0,2024-06-28,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,True,True,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-06-28
66
+ gemma-2-27b-it,0.9922771009345794,3.51,27.0,2024-06-24,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-06-24
67
+ gemma-1.1-2b-it,0.1192569946127946,2.91,2.0,2024-03-26,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-03-26
68
+ gemma-2-2b-it,0.3139821517919889,2.67,2.0,2024-07-16,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-07-16
69
+ Qwen1.5-7B-Chat,0.3898907690883847,2.58,7.0,2024-01-30,True,"Chinese, English",,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-01-30
70
+ gemma-7b-it,0.6112263564356434,1.82,7.0,2024-02-21,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2024-02-21
71
+ llama-2-70b-chat-hf,4.724659620079607,0.81,70.0,2023-07-18,True,English,,Apache 2.0,https://www.apache.org/licenses/LICENSE-2.0,False,False,False,False,0.0,0.0,"<a href=""https://www.apache.org/licenses/LICENSE-2.0"" style=""color: blue;"">Apache 2.0</a>",2023-07-18
assets/pricing.json ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "model_id": "gpt-4-1106-vision-preview",
4
+ "input": "10$",
5
+ "output": "30$"
6
+ },
7
+ {
8
+ "model_id": "gpt-4o-2024-05-13",
9
+ "input": "5$",
10
+ "output": "15$"
11
+ },
12
+ {
13
+ "model_id": "gpt-4o-2024-08-06",
14
+ "input": "3.750$",
15
+ "output": "15$"
16
+ },
17
+ {
18
+ "model_id": "gpt-4o-mini-2024-07-18",
19
+ "input": "0.300$",
20
+ "output": "1.200$"
21
+ },
22
+ {
23
+ "model_id": "gpt-4-turbo-2024-04-09",
24
+ "input": "10$",
25
+ "output": "30$"
26
+ },
27
+ {
28
+ "model_id": "gpt-4-1106-preview",
29
+ "input": "",
30
+ "output": ""
31
+ },
32
+ {
33
+ "model_id": "gpt-4-0125-preview",
34
+ "input": "10$",
35
+ "output": "30$"
36
+ },
37
+ {
38
+ "model_id": "o1-preview-2024-09-12",
39
+ "input": "15$",
40
+ "output": "60$"
41
+ },
42
+ {
43
+ "model_id": "o1-mini-2024-09-12",
44
+ "input": "3$",
45
+ "output": "12$"
46
+ },
47
+ {
48
+ "model_id": "gpt-3.5-turbo-0125",
49
+ "input": "0.5$",
50
+ "output": "1.5$"
51
+ },
52
+ {
53
+ "model_id": "gpt-4-0613",
54
+ "input": "",
55
+ "output": ""
56
+ },
57
+ {
58
+ "model_id": "gpt-4-0314",
59
+ "input": "",
60
+ "output": ""
61
+ },
62
+ {
63
+ "model_id": "gpt-3.5-turbo-1106",
64
+ "input": "1$",
65
+ "output": "2$"
66
+ },
67
+ {
68
+ "model_id": "gpt-3.5-turbo-0613",
69
+ "input": "1.5$",
70
+ "output": "2$"
71
+ },
72
+ {
73
+ "model_id": "command",
74
+ "input": "",
75
+ "output": ""
76
+ },
77
+ {
78
+ "model_id": "command-light",
79
+ "input": "",
80
+ "output": ""
81
+ },
82
+ {
83
+ "model_id": "claude-v1.3",
84
+ "input": "",
85
+ "output": ""
86
+ },
87
+ {
88
+ "model_id": "claude-v1.3-100k",
89
+ "input": "",
90
+ "output": ""
91
+ },
92
+ {
93
+ "model_id": "claude-instant-1.2",
94
+ "input": "",
95
+ "output": ""
96
+ },
97
+ {
98
+ "model_id": "claude-2",
99
+ "input": "8$",
100
+ "output": "24$"
101
+ },
102
+ {
103
+ "model_id": "claude-2.1",
104
+ "input": "8$",
105
+ "output": "24$"
106
+ },
107
+ {
108
+ "model_id": "claude-3-opus-20240229",
109
+ "input": "15$",
110
+ "output": "75$"
111
+ },
112
+ {
113
+ "model_id": "claude-3-sonnet-20240229",
114
+ "input": "3$",
115
+ "output": "15$"
116
+ },
117
+ {
118
+ "model_id": "claude-3-haiku-20240307",
119
+ "input": "0.25$",
120
+ "output": "1.25$"
121
+ },
122
+ {
123
+ "model_id": "claude-3-5-sonnet-20240620",
124
+ "input": "3$",
125
+ "output": "15$"
126
+ },
127
+ {
128
+ "model_id": "claude-3-5-haiku-20241022",
129
+ "input": "0.8$",
130
+ "output": "4$"
131
+ },
132
+ {
133
+ "model_id": "claude-3-5-sonnet-20241022",
134
+ "input": "3$",
135
+ "output": "15$"
136
+ },
137
+ {
138
+ "model_id": "gemini-1.0-pro-001",
139
+ "input": "0.5$",
140
+ "output": "1.5$"
141
+ },
142
+ {
143
+ "model_id": "gemini-1.0-pro-002",
144
+ "input": "0.5$",
145
+ "output": "1.5$"
146
+ },
147
+ {
148
+ "model_id": "gemini-1.0-pro-vision-latest",
149
+ "input": "0.5$",
150
+ "output": "1.5$"
151
+ },
152
+ {
153
+ "model_id": "gemini-1.5-flash-001",
154
+ "input": "0.075$",
155
+ "output": "0.3$"
156
+ },
157
+ {
158
+ "model_id": "gemini-1.5-pro-001",
159
+ "input": "1.25$",
160
+ "output": "5$"
161
+ },
162
+ {
163
+ "model_id": "gemini-1.5-pro-002",
164
+ "input": "1.25$",
165
+ "output": "5$"
166
+ },
167
+ {
168
+ "model_id": "gemini-1.5-flash-002",
169
+ "input": "0.075$",
170
+ "output": "0.3$"
171
+ },
172
+ {
173
+ "model_id": "gemini-1.5-flash-8b-001",
174
+ "input": "0.0375$",
175
+ "output": "0.15$"
176
+ },
177
+ {
178
+ "model_id": "gemini-2.0-flash-exp",
179
+ "input": "0$",
180
+ "output": "0$"
181
+ },
182
+ {
183
+ "model_id": "luminous-supreme-control",
184
+ "input": "",
185
+ "output": ""
186
+ },
187
+ {
188
+ "model_id": "luminous-supreme",
189
+ "input": "",
190
+ "output": ""
191
+ },
192
+ {
193
+ "model_id": "luminous-extended",
194
+ "input": "",
195
+ "output": ""
196
+ },
197
+ {
198
+ "model_id": "luminous-base",
199
+ "input": "",
200
+ "output": ""
201
+ },
202
+ {
203
+ "model_id": "luminous-base",
204
+ "input": "",
205
+ "output": ""
206
+ },
207
+ {
208
+ "model_id": "luminous-base",
209
+ "input": "",
210
+ "output": ""
211
+ }
212
+ ]
assets/text_content.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ CLEMBENCH_RUNS_REPO = "https://raw.githubusercontent.com/clembench/clembench-runs/main/"
4
+ REGISTRY_URL = "https://raw.githubusercontent.com/clp-research/clembench/refs/heads/refactor_model_registry/backends/model_registry.json"
5
+ BENCHMARK_FILE = "benchmark_runs.json"
6
+
7
+ LATENCY_FOLDER = os.path.join("Addenda", "Latency")
8
+ RESULT_FILE = "results.csv"
9
+ LATENCY_SUFFIX = "_latency.csv"
10
+
11
+ LANG_MAPPING = {
12
+ 'el': 'Greek',
13
+ 'id': 'Indonesian',
14
+ 'ko': 'Korean',
15
+ 'sv': 'Swedish',
16
+ 'de': 'German',
17
+ 'lv': 'Latvian',
18
+ 'am': 'Amharic',
19
+ 'fi': 'Finnish',
20
+ 'da': 'Danish',
21
+ 'pt': 'Portuguese',
22
+ 'sw': 'Swahili',
23
+ 'es': 'Spanish',
24
+ 'it': 'Italian',
25
+ 'bn': 'Bengali',
26
+ 'nl': 'Dutch',
27
+ 'lt': 'Lithuanian',
28
+ 'ro': 'Romanian',
29
+ 'sl': 'Slovenian',
30
+ 'hu': 'Hungarian',
31
+ 'hr': 'Croatian',
32
+ 'vi': 'Vietnamese',
33
+ 'hi': 'Hindi',
34
+ 'zh': 'Chinese',
35
+ 'pl': 'Polish',
36
+ 'ar': 'Arabic',
37
+ 'cs': 'Czech',
38
+ 'sk': 'Slovak',
39
+ 'ja': 'Japanese',
40
+ 'no': 'Norwegian',
41
+ 'uk': 'Ukrainian',
42
+ 'fr': 'French',
43
+ 'et': 'Estonian',
44
+ 'ru': 'Russian',
45
+ 'th': 'Thai',
46
+ 'bg': 'Bulgarian',
47
+ 'tr': 'Turkish',
48
+ 'ms': 'Malay',
49
+ 'he': 'Hebrew',
50
+ 'tl': 'Tagalog',
51
+ 'sr': 'Serbian',
52
+ 'en': 'English'
53
+ }
prepare_path.sh ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ #!/bash/bin
2
+ export PYTHONPATH=.:$PYTHONPATH
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ beautifulsoup4==4.12.3
2
+ pandas==2.2.3
3
+ gradio_rangeslider==0.0.7
4
+ gradio==4.44.1
5
+ langcodes==3.5.0
src/collect_data.py ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Collect data from the multiple sources and create a base datafranme for the LLMCalculator table
3
+ Latency - https://github.com/clembench/clembench-runs/tree/main/Addenda/Latency
4
+ Pricing - pricing.json
5
+ Model info - https://github.com/kushal-10/clembench/blob/feat/registry/backends/model_registry_updated.json
6
+ """
7
+
8
+ import pandas as pd
9
+ import json
10
+ import requests
11
+ from assets.text_content import CLEMBENCH_RUNS_REPO, REGISTRY_URL, BENCHMARK_FILE, LATENCY_FOLDER, RESULT_FILE, LATENCY_SUFFIX
12
+ import os
13
+
14
+ def validate_request(url: str, response) -> bool:
15
+ """
16
+ Validate if an HTTP request was successful.
17
+
18
+ Args:
19
+ url (str): The URL that was requested
20
+ response (requests.Response): The response object from the request
21
+
22
+ Returns:
23
+ bool: True if request was successful (status code 200), False otherwise
24
+ """
25
+
26
+ if response.status_code != 200:
27
+ print(f"Failed to read file - {url}. Status Code: {response.status_code}")
28
+ return False
29
+ return True
30
+
31
+ def fetch_benchmark_data(benchmark: str = "text", version_names: list = []) -> tuple:
32
+ """
33
+ Fetch and parse benchmark results and latency data from CSV files.
34
+
35
+ Args:
36
+ benchmark (str): Type of benchmark to fetch ('text' or 'multimodal')
37
+ version_names (list): List of version names to search through, sorted by latest first
38
+
39
+ Returns:
40
+ tuple[pd.DataFrame, pd.DataFrame]: A tuple containing:
41
+ - results_df: DataFrame with benchmark results
42
+ - latency_df: DataFrame with latency measurements
43
+ Returns (None, None) if no matching version is found or requests fail
44
+
45
+ Raises:
46
+ requests.RequestException: If there's an error fetching the data
47
+ pd.errors.EmptyDataError: If CSV file is empty
48
+ pd.errors.ParserError: If CSV parsing fails
49
+ """
50
+ for v in version_names:
51
+ # Check if version matches benchmark type
52
+ is_multimodal = 'multimodal' in v
53
+ if (benchmark == "multimodal") != is_multimodal:
54
+ continue
55
+
56
+ # Construct URLs
57
+ results_url = os.path.join(CLEMBENCH_RUNS_REPO, v, RESULT_FILE)
58
+ latency_url = os.path.join(CLEMBENCH_RUNS_REPO, LATENCY_FOLDER, v + LATENCY_SUFFIX)
59
+
60
+ try:
61
+ results = requests.get(results_url)
62
+ latency = requests.get(latency_url)
63
+
64
+ if validate_request(results_url, results) and validate_request(latency_url, latency):
65
+ # Convert the CSV content to pandas DataFrames
66
+ results_df = pd.read_csv(pd.io.common.StringIO(results.text))
67
+ latency_df = pd.read_csv(pd.io.common.StringIO(latency.text))
68
+ return results_df, latency_df
69
+
70
+ except requests.RequestException as e:
71
+ print(f"Error fetching data for version {v}: {e}")
72
+ except pd.errors.EmptyDataError:
73
+ print(f"Error: Empty CSV file found for version {v}")
74
+ except pd.errors.ParserError:
75
+ print(f"Error: Unable to parse CSV data for version {v}")
76
+
77
+ return None, None
78
+
79
+ def fetch_version_metadata() -> tuple:
80
+ """
81
+ Fetch and process benchmark metadata from the Clembench GitHub repository.
82
+
83
+ The data is sourced from: https://github.com/clembench/clembench-runs
84
+ Configure the repository path in src/assets/text_content/CLEMBENCH_RUNS_REPO
85
+
86
+ Returns:
87
+ tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame]: A tuple containing:
88
+ - mm_result: Multimodal benchmark results
89
+ - mm_latency: Multimodal latency data
90
+ - text_result: Text benchmark results
91
+ - text_latency: Text latency data
92
+ Returns (None, None, None, None) if the request fails
93
+ """
94
+ json_url = CLEMBENCH_RUNS_REPO + BENCHMARK_FILE
95
+ response = requests.get(json_url)
96
+
97
+ # Check if the JSON file request was successful
98
+ if not validate_request(json_url, response):
99
+ return None, None, None, None
100
+
101
+ json_data = response.json()
102
+ versions = json_data['versions']
103
+
104
+ # Sort the versions in benchmark by latest first
105
+ version_names = sorted(
106
+ [ver['version'] for ver in versions],
107
+ key=lambda v: list(map(int, v[1:].split('_')[0].split('.'))),
108
+ reverse=True
109
+ )
110
+
111
+ # Latency is in seconds
112
+ mm_result, mm_latency = fetch_benchmark_data("multimodal", version_names)
113
+ text_result, text_latency = fetch_benchmark_data("text", version_names)
114
+
115
+ return mm_latency, mm_result, text_latency, text_result
116
+
117
+ def fetch_registry_data() -> dict:
118
+ """
119
+ Fetch and parse model registry data from the Clembench registry URL.
120
+
121
+ The data is sourced from the model registry defined in REGISTRY_URL.
122
+ Contains information about various LLM models including their specifications
123
+ and capabilities.
124
+
125
+ Returns:
126
+ dict: Dictionary containing model registry data.
127
+ Returns None if the request fails or the JSON is invalid.
128
+
129
+ Raises:
130
+ requests.RequestException: If there's an error fetching the data
131
+ json.JSONDecodeError: If the response cannot be parsed as JSON
132
+ """
133
+ try:
134
+ response = requests.get(REGISTRY_URL)
135
+ if not validate_request(REGISTRY_URL, response):
136
+ return None
137
+
138
+ return response.json()
139
+
140
+ except requests.RequestException as e:
141
+ print(f"Error fetching registry data: {e}")
142
+ except json.JSONDecodeError as e:
143
+ print(f"Error parsing registry JSON: {e}")
144
+
145
+ return None
146
+
147
+ if __name__=="__main__":
148
+ fetch_version_metadata()
149
+ registry_data = fetch_registry_data()
150
+ print(registry_data[0])
151
+
152
+
src/filter_utils.py ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Utility functions for filtering the dataframe
2
+
3
+ import pandas as pd
4
+
5
+ def filter_cols(df):
6
+
7
+ df = df[[
8
+ 'Model Name',
9
+ 'Clemscore',
10
+ 'Input $/1M tokens',
11
+ 'Output $/1M tokens',
12
+ 'Latency (s)',
13
+ 'Context Size (k)',
14
+ 'Parameters (B)',
15
+ 'Release Date',
16
+ 'License'
17
+ ]]
18
+
19
+ return df
20
+
21
+
22
+ def filter(df, language_list, parameters, input_price, output_price, multimodal,
23
+ context, open_weight, start, end, license ):
24
+
25
+
26
+ if not df.empty: # Check if df is non-empty
27
+ df = df[df['Languages'].apply(lambda x: all(lang in x for lang in language_list))]
28
+
29
+ if not df.empty:
30
+ # Split dataframe by Open Weight
31
+ open_weight_true = df[df['Open Weight'] == True]
32
+ open_weight_false = df[df['Open Weight'] == False]
33
+
34
+ # Get max parameter size for open weight models
35
+ max_parameter_size = open_weight_true['Parameters (B)'].max() if not open_weight_true.empty else 0
36
+
37
+ # Filter only the open weight models based on parameters
38
+ if not open_weight_true.empty:
39
+ if parameters[1] >= max_parameter_size:
40
+ filtered_open = open_weight_true[
41
+ (open_weight_true['Parameters (B)'] >= parameters[0])
42
+ ]
43
+ else:
44
+ filtered_open = open_weight_true[
45
+ (open_weight_true['Parameters (B)'] >= parameters[0]) &
46
+ (open_weight_true['Parameters (B)'] <= parameters[1])
47
+ ]
48
+
49
+ # Combine filtered open weight models with unfiltered commercial models
50
+ df = pd.concat([filtered_open, open_weight_false])
51
+
52
+ if not df.empty: # Check if df is non-empty
53
+ df = df[(df['Input $/1M tokens'] >= input_price[0]) & (df['Input $/1M tokens'] <= input_price[1])]
54
+
55
+ if not df.empty: # Check if df is non-empty
56
+ df = df[(df['Output $/1M tokens'] >= output_price[0]) & (df['Output $/1M tokens'] <= output_price[1])]
57
+
58
+
59
+ print("Price")
60
+ print(df)
61
+
62
+ if not df.empty: # Check if df is non-empty
63
+ if "Image" in multimodal:
64
+ df = df[df['Image'] == True]
65
+ if "Multi-Image" in multimodal:
66
+ df = df[df['Multiple Image'] == True]
67
+ if "Audio" in multimodal:
68
+ df = df[df['Audio'] == True]
69
+ if "Video" in multimodal:
70
+ df = df[df['Video'] == True]
71
+
72
+ # if not df.empty: # Check if df is non-empty
73
+ # df = df[(df['Context Size (k)'] >= (context[0])) & (df['Context Size (k)'] <= (context[1]))]
74
+
75
+
76
+ print("Modality")
77
+ print(df)
78
+
79
+ if not df.empty: # Check if df is non-empty
80
+ if "Open" in open_weight and "Commercial" not in open_weight:
81
+ df = df[df['Open Weight'] == True]
82
+ elif "Commercial" in open_weight and "Open" not in open_weight:
83
+ df = df[df['Open Weight'] == False]
84
+ elif "Open" not in open_weight and "Commercial" not in open_weight:
85
+ # Return empty DataFrame with same columns
86
+ df = pd.DataFrame(columns=df.columns)
87
+
88
+ if not df.empty: # Check if df is non-empty
89
+ df = df[df['License Name'].apply(lambda x: any(lic in x for lic in license))]
90
+
91
+ # Convert 'Release Date' to int temporarily
92
+ if not df.empty: # Check if df is non-empty
93
+ df['Temp Date'] = pd.to_datetime(df['Temp Date']).astype(int) // 10**9 # Convert to seconds since epoch
94
+
95
+ # Convert start and end to int (seconds since epoch)
96
+ start = int(pd.to_datetime(start).timestamp())
97
+ end = int(pd.to_datetime(end).timestamp())
98
+
99
+ # Filter based on the converted 'Release Date'
100
+ if not df.empty: # Check if df is non-empty
101
+ df = df[(df['Temp Date'] >= start) & (df['Temp Date'] <= end)]
102
+
103
+ df = filter_cols(df)
104
+ df = df.sort_values(by='Clemscore', ascending=False)
105
+
106
+ print(df)
107
+
108
+ return df # Return the filtered dataframe
109
+
src/process_data.py ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import json
3
+ import os
4
+
5
+ from src.collect_data import fetch_version_metadata, fetch_registry_data
6
+ from assets.text_content import LANG_MAPPING
7
+ PRICING_PATH = os.path.join('assets', 'pricing.json')
8
+
9
+ # Convert parameters to float, handling both B and T suffixes
10
+ def convert_parameters(param):
11
+ if pd.isna(param) or param == '':
12
+ return None
13
+ param = str(param)
14
+ if 'T' in param:
15
+ return float(param.replace('T', '')) * 1000
16
+ return float(param.replace('B', ''))
17
+
18
+ # Clean price strings by removing '$' and handling empty strings
19
+ def clean_price(price):
20
+ if pd.isna(price) or price == '':
21
+ return None
22
+ return float(price.replace('$', ''))
23
+
24
+ # Handle language mapping for both string and list inputs
25
+ def map_languages(languages):
26
+ if isinstance(languages, float) and pd.isna(languages):
27
+ return None
28
+ # If it's already a list
29
+ if isinstance(languages, list):
30
+ return ', '.join([LANG_MAPPING.get(str(lang), str(lang)) for lang in languages])
31
+ # If it's a string
32
+ if isinstance(languages, str):
33
+ return ', '.join([LANG_MAPPING.get(lang.strip(), lang.strip()) for lang in languages.split(',')])
34
+ # If it's an array or any other type
35
+ try:
36
+ return ', '.join([str(lang) for lang in languages])
37
+ except:
38
+ return str(languages)
39
+
40
+ # Extract multimodality fields
41
+ def get_multimodality_field(model_data, field):
42
+ try:
43
+ return model_data.get('model_config', {}).get('multimodality', {}).get(field, False)
44
+ except:
45
+ return False
46
+
47
+
48
+ def merge_data():
49
+
50
+ mm_latency_df, mm_result_df, text_latency_df, text_result_df = fetch_version_metadata()
51
+ registry_data = fetch_registry_data()
52
+ with open(PRICING_PATH, 'r') as f:
53
+ pricing_data = json.load(f)
54
+
55
+ # Ensure the unnamed column is renamed to 'model'
56
+ mm_result_df.rename(columns={'Unnamed: 0': 'model', '-, clemscore': 'clemscore'}, inplace=True)
57
+ text_result_df.rename(columns={'Unnamed: 0': 'model', '-, clemscore': 'clemscore'}, inplace=True)
58
+ mm_result_df['model'] = mm_result_df['model'].str.split('-t0.0--').str[0]
59
+ text_result_df['model'] = text_result_df['model'].str.split('-t0.0--').str[0] # Bug in get_latency.py, split by -t0.0 instead of -t (gpt-3.5-turbo/gpt-4-turbo breaks)
60
+
61
+ # Merge datasets to compute average values
62
+ avg_latency_df = pd.concat([mm_latency_df, text_latency_df], axis=0).groupby('model')['latency'].mean().reset_index()
63
+ avg_clemscore_df = pd.concat([mm_result_df, text_result_df], axis=0).groupby('model')['clemscore'].mean().reset_index()
64
+
65
+ # Merge latency, clemscore, registry, and pricing data
66
+ lat_clem_df = pd.merge(avg_latency_df, avg_clemscore_df, on='model', how='outer')
67
+
68
+ # Convert registry_data to DataFrame for easier merging
69
+ registry_df = pd.DataFrame(registry_data)
70
+
71
+ # Extract license info
72
+ registry_df['license_name'] = registry_df['license'].apply(lambda x: x['name'])
73
+ registry_df['license_url'] = registry_df['license'].apply(lambda x: x['url'])
74
+
75
+ # Add individual multimodality columns
76
+ registry_df['single_image'] = registry_df.apply(lambda x: get_multimodality_field(x, 'single_image'), axis=1)
77
+ registry_df['multiple_images'] = registry_df.apply(lambda x: get_multimodality_field(x, 'multiple_images'), axis=1)
78
+ registry_df['audio'] = registry_df.apply(lambda x: get_multimodality_field(x, 'audio'), axis=1)
79
+ registry_df['video'] = registry_df.apply(lambda x: get_multimodality_field(x, 'video'), axis=1)
80
+
81
+ # Update columns list to include new multimodality fields
82
+ registry_df = registry_df[[
83
+ 'model_name', 'parameters', 'release_date', 'open_weight',
84
+ 'languages', 'context_size', 'license_name', 'license_url',
85
+ 'single_image', 'multiple_images', 'audio', 'video'
86
+ ]]
87
+
88
+ # Merge with previous data
89
+ merged_df = pd.merge(
90
+ lat_clem_df,
91
+ registry_df,
92
+ left_on='model',
93
+ right_on='model_name',
94
+ how='inner'
95
+ )
96
+
97
+ # Update column renaming
98
+ merged_df = merged_df.rename(columns={
99
+ 'model': 'Model Name',
100
+ 'latency': 'Latency (s)',
101
+ 'clemscore': 'Clemscore',
102
+ 'parameters': 'Parameters (B)',
103
+ 'release_date': 'Release Date',
104
+ 'open_weight': 'Open Weight',
105
+ 'languages': 'Languages',
106
+ 'context_size': 'Context Size (k)',
107
+ 'license_name': 'License Name',
108
+ 'license_url': 'License URL',
109
+ 'single_image': 'Single Image',
110
+ 'multiple_images': 'Multiple Images',
111
+ 'audio': 'Audio',
112
+ 'video': 'Video'
113
+ })
114
+
115
+ # Convert pricing_data list to DataFrame
116
+ pricing_df = pd.DataFrame(pricing_data)
117
+ pricing_df['input'] = pricing_df['input'].apply(clean_price)
118
+ pricing_df['output'] = pricing_df['output'].apply(clean_price)
119
+
120
+ # Merge pricing data with the existing dataframe
121
+ merged_df = pd.merge(
122
+ merged_df,
123
+ pricing_df,
124
+ left_on='Model Name',
125
+ right_on='model_id',
126
+ how='left'
127
+ )
128
+
129
+ # Drop duplicate model column and rename price columns
130
+ merged_df = merged_df.drop('model_id', axis=1)
131
+ merged_df = merged_df.rename(columns={
132
+ 'input': 'Input $/1M tokens',
133
+ 'output': 'Output $/1M tokens'
134
+ })
135
+
136
+ # Fill NaN values with 0.0 for pricing columns
137
+ merged_df['Input $/1M tokens'] = merged_df['Input $/1M tokens'].fillna(0.0)
138
+ merged_df['Output $/1M tokens'] = merged_df['Output $/1M tokens'].fillna(0.0)
139
+
140
+ # Convert parameters and set to None for commercial models
141
+ merged_df['Parameters (B)'] = merged_df.apply(
142
+ lambda row: None if not row['Open Weight'] else convert_parameters(row['Parameters (B)']),
143
+ axis=1
144
+ )
145
+
146
+ merged_df['License'] = merged_df.apply(lambda row: f'<a href="{row["License URL"]}" style="color: blue;">{row["License Name"]}</a>', axis=1)
147
+ merged_df['Temp Date'] = merged_df['Release Date']
148
+
149
+ merged_df['Languages'] = merged_df['Languages'].apply(map_languages)
150
+
151
+ # Sort by Clemscore in descending order
152
+ merged_df = merged_df.sort_values(by='Clemscore', ascending=False)
153
+
154
+ # Drop model_name column
155
+ merged_df.drop(columns=['model_name'], inplace=True)
156
+
157
+ return merged_df
158
+
159
+ if __name__=='__main__':
160
+ merged_df = merge_data()
161
+ # # Save to CSV
162
+ output_path = os.path.join('assets', 'merged_data.csv')
163
+ merged_df.to_csv(output_path, index=False)
tempapp.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from date_rangeslider import RangeSlider
3
+ from pathlib import Path
4
+
5
+ text = "## The selected date range is: {min} to {max}"
6
+
7
+ with gr.Blocks() as demo:
8
+ with gr.Tabs():
9
+ with gr.Tab("Demo"):
10
+ gr.Markdown("""## πŸ› Date RangeSlider
11
+
12
+ ## Drag either end and see the selected date range update in real-time.
13
+ """)
14
+ range_slider = RangeSlider(
15
+ minimum="2023-01-01",
16
+ maximum="2024-12-31",
17
+ value=("2023-01-01", "2024-12-31")
18
+ )
19
+ range_ = gr.Markdown(value=text.format(min="2023-01-01", max="2024-12-31"))
20
+ range_slider.change(
21
+ lambda s: text.format(min=s[0], max=s[1]),
22
+ range_slider,
23
+ range_,
24
+ show_progress="hide",
25
+ trigger_mode="always_last"
26
+ )
27
+ gr.Examples([
28
+ ("2023-03-01", "2023-06-30"),
29
+ ("2023-07-01", "2023-12-31")
30
+ ], inputs=[range_slider])
31
+
32
+ if __name__ == "__main__":
33
+ demo.launch()