kaizuberbuehler commited on
Commit
0a86c6a
·
1 Parent(s): 67603e4

Update capex numbers; Fix and revamp champs

Browse files
Files changed (3) hide show
  1. app.py +66 -188
  2. big_five_capex.jsonl +1 -2
  3. elo_results_20240915.pkl +0 -3
app.py CHANGED
@@ -1,173 +1,87 @@
1
  import json
2
- import pickle
3
  from datetime import datetime, date
4
 
5
  import gradio as gr
6
- import pandas as pd
7
  import plotly.graph_objects as go
8
 
9
 
10
- def create_big_five_capex_plot():
11
- # Capex in Millions of USD per Quarter of Microsoft, Google, Meta, Apple, Amazon
12
- big_five_capex = []
13
- with open("big_five_capex.jsonl", 'r') as file:
14
- for line in file:
15
- big_five_capex.append(json.loads(line))
16
 
17
- df = pd.DataFrame(big_five_capex)
18
-
19
- fig = go.Figure()
20
-
21
  companies = ['Microsoft', 'Google', 'Meta', 'Apple', 'Amazon']
22
  colors = ['#80bb00', '#ee161f', '#0065e3', '#000000', '#ff6200']
23
-
24
- for company, color in zip(companies, colors):
25
- fig.add_trace(go.Bar(
26
- x=df['Quarter'],
27
- y=df[company],
28
- name=company,
29
- marker_color=color
30
- ))
31
-
32
- fig.add_vline(
33
- x=df.index[df['Quarter'] == "2023 Q1"].tolist()[0] + 0.5,
34
- line_width=1,
35
- line_dash="dash",
36
- line_color="black",
37
- annotation_text="AI arms race begins",
38
- annotation_position="top right",
39
- annotation_font_size=12,
40
- annotation_font_color="black"
41
- )
42
-
43
- fig.update_layout(
44
- title='Capital Expenditure of the Big Five Tech Companies in Millions of U.S. Dollars per Quarter',
45
- xaxis_title='Quarter',
46
- yaxis_title='Capex (Millions of U.S. Dollars)',
47
- barmode='stack',
48
- legend_title='Companies',
49
- height=800
50
- )
51
-
52
- return fig
53
-
54
-
55
- def create_chip_designers_data_center_revenue_plot():
56
- # Data Center Revenue in Millions of USD per Quarter of NVIDIA, AMD and Intel
57
- data_center_revenue_by_company = []
58
- with open("chip_designers_data_center_revenue.jsonl", 'r') as file:
59
- for line in file:
60
- data_center_revenue_by_company.append(json.loads(line))
61
-
62
- df = pd.DataFrame(data_center_revenue_by_company)
63
-
64
- fig = go.Figure()
65
 
66
- companies = ['NVIDIA', 'AMD', 'Intel']
67
- colors = ['#80bb00', '#ee161f', '#0065e3'] # TODO
68
 
 
69
  for company, color in zip(companies, colors):
70
- fig.add_trace(go.Bar(
71
- x=df['Quarter'],
72
- y=df[company],
73
  name=company,
 
 
74
  marker_color=color
75
  ))
76
 
 
77
  fig.update_layout(
78
- title='Data Center Revenue of NVIDIA, AMD and Intel in Millions of U.S. Dollars per Quarter',
79
- xaxis_title='Quarter',
80
- yaxis_title='Data Center Revenue (Millions of U.S. Dollars)',
81
- barmode='stack',
82
- legend_title='Companies',
83
- height=800
 
 
 
 
84
  )
85
 
86
- return fig
87
-
88
-
89
- def create_size_for_performance_plot(category_to_display: str,
90
- parameter_type_to_display: str,
91
- model_to_compare: str) -> (go.Figure, gr.Dropdown, gr.Dropdown):
92
- with open('elo_results_20240915.pkl', 'rb') as file:
93
- elo_results = pickle.load(file)
94
- categories: list[str] = list(elo_results["text"].keys())
95
- if category_to_display not in categories:
96
- raise gr.Error(message=f"Category '{category_to_display}' not found.")
97
- elo_ratings_for_category: dict = dict(elo_results["text"][category_to_display]["elo_rating_final"])
98
-
99
- models: list[dict] = []
100
- with open("models.jsonl", 'r') as file:
101
- for line in file:
102
- models.append(json.loads(line))
103
-
104
- size_for_performance_data: list[dict] = []
105
- for model_name, model_elo_rating in elo_ratings_for_category.items():
106
- model_entries_found = [model for model in models if model["Name"] == model_name]
107
- if model_entries_found:
108
- size_for_performance_data.append({
109
- "Name": model_name,
110
- "Release Date": model_entries_found[0]["Release Date"],
111
- "ELO Rating": model_elo_rating,
112
- parameter_type_to_display: model_entries_found[0][parameter_type_to_display]
113
- })
114
- else:
115
- print(f"[WARNING] Model '{model_name}' not found in models.jsonl")
116
-
117
- comparison_model_elo_score = elo_ratings_for_category[model_to_compare]
118
- filtered_models = [model for model in size_for_performance_data
119
- if model[parameter_type_to_display] > 0 and
120
- model['ELO Rating'] >= comparison_model_elo_score]
121
-
122
- filtered_models.sort(key=lambda x: datetime.strptime(x['Release Date'], "%Y-%m-%d"))
123
-
124
- x_dates = [datetime.strptime(model['Release Date'], "%Y-%m-%d") for model in filtered_models]
125
- y_params = []
126
- min_param = float('inf')
127
- for model in filtered_models:
128
- param = model[parameter_type_to_display]
129
- if param <= min_param:
130
- min_param = param
131
- y_params.append(min_param)
132
-
133
- fig = go.Figure()
134
-
135
- fig.add_trace(go.Scatter(
136
- x=x_dates,
137
- y=y_params,
138
- mode='lines',
139
- line=dict(shape='hv', width=2),
140
- name='Model Parameters'
141
- ))
142
 
143
- fig.update_layout(
144
- title=f'Model Size Progression for Open-Weights Models Reaching Performance of "{model_to_compare}" in "{category_to_display}" Category',
145
- xaxis_title='Release Date',
146
- yaxis_title=parameter_type_to_display,
147
- yaxis_type='log',
148
- hovermode='x unified',
149
- xaxis=dict(
150
- range=[date(2023, 2, 27), date(2024, 9, 15)],
151
- type='date'
 
 
152
  ),
153
- height=800
154
  )
155
 
156
- for i, model in enumerate(filtered_models):
157
- if i == 0 or y_params[i] < y_params[i - 1]:
158
- fig.add_trace(go.Scatter(
159
- x=[x_dates[i]],
160
- y=[y_params[i]],
161
- mode='markers+text',
162
- marker=dict(size=10),
163
- text=[model['Name']],
164
- textposition="top center",
165
- name=model['Name']
166
- ))
167
-
168
- return (fig,
169
- gr.Dropdown(choices=categories, value=category_to_display, interactive=True),
170
- gr.Dropdown(choices=list(elo_ratings_for_category.keys()), value=model_to_compare, interactive=True))
171
 
172
 
173
  def create_simple_plot(data_path: str,
@@ -246,34 +160,6 @@ def create_simple_plot(data_path: str,
246
 
247
 
248
  with gr.Blocks() as demo:
249
- with gr.Tab("Finance"):
250
- with gr.Tab("Big Five Capex") as big_five_capex_tab:
251
- big_five_capex_plot: gr.Plot = gr.Plot()
252
- with gr.Tab("Chip Designers Data Center Revenue") as chip_designers_data_center_revenue_tab:
253
- chip_designers_data_center_revenue_plot: gr.Plot = gr.Plot()
254
- with gr.Tab("Model Efficiency Over Time"):
255
- with gr.Tab("Parameters Necessary for Specific Performance Level") as size_for_performance_tab:
256
- with gr.Row():
257
- size_for_performance_category_dropdown: gr.Dropdown = gr.Dropdown(label="Category",
258
- value="full",
259
- choices=["full"],
260
- interactive=False)
261
- size_for_performance_parameter_number_dropdown: gr.Dropdown = gr.Dropdown(label="Parameter Number",
262
- choices=["Total Parameters",
263
- "Active Parameters"],
264
- value="Total Parameters",
265
- interactive=True)
266
- size_for_performance_comparison_model_dropdown: gr.Dropdown = gr.Dropdown(label="Model for Comparison",
267
- value="gpt-4-0314",
268
- choices=["gpt-4-0314"],
269
- interactive=False)
270
- size_for_performance_plot: gr.Plot = gr.Plot()
271
- size_for_performance_button: gr.Button = gr.Button("Show")
272
- size_for_performance_markdown: gr.Markdown = gr.Markdown(
273
- value="""Model performance as reported on [LMSYS Chatbot Arena Leaderboard](https://lmarena.ai/?leaderboard)."""
274
- )
275
- with gr.Tab("API Cost for Specific Performance Level", interactive=False):
276
- api_cost_for_performance_plot: gr.Plot = gr.Plot()
277
  with gr.Tab("System Performance Over Time"):
278
  with gr.Tab("ARC-AGI-Pub") as arc_agi_tab:
279
  arc_agi_plot: gr.Plot = gr.Plot()
@@ -307,21 +193,13 @@ with gr.Blocks() as demo:
307
  webarena_plot: gr.Plot = gr.Plot()
308
  with gr.Tab("ZeroEval", interactive=False):
309
  zeroeval_plot: gr.Plot = gr.Plot()
310
- with gr.Tab("Frontier Language Model Training Runs", interactive=False):
311
- with gr.Tab("Street Price of GPUs Used"):
312
- gpu_street_price_plot: gr.Plot = gr.Plot()
313
- with gr.Tab("TDP of GPUs Used"):
314
- tdp_gpus_plot: gr.Plot = gr.Plot()
315
  big_five_capex_tab.select(fn=create_big_five_capex_plot, outputs=big_five_capex_plot)
316
- chip_designers_data_center_revenue_tab.select(fn=create_chip_designers_data_center_revenue_plot,
317
- outputs=chip_designers_data_center_revenue_plot)
318
- size_for_performance_button.click(fn=create_size_for_performance_plot,
319
- inputs=[size_for_performance_category_dropdown,
320
- size_for_performance_parameter_number_dropdown,
321
- size_for_performance_comparison_model_dropdown],
322
- outputs=[size_for_performance_plot,
323
- size_for_performance_category_dropdown,
324
- size_for_performance_comparison_model_dropdown])
325
  arc_agi_tab.select(fn=create_simple_plot,
326
  inputs=[gr.State("arc_agi_leaderboard.jsonl"), gr.State("ARC-AGI-Pub (Public Eval) Score"),
327
  gr.State(date(2024, 5, 13)), gr.State(date(2024, 12, 20))],
 
1
  import json
 
2
  from datetime import datetime, date
3
 
4
  import gradio as gr
 
5
  import plotly.graph_objects as go
6
 
7
 
8
+ def create_big_five_capex_plot() -> go.Figure:
9
+ # Read data from the JSON Lines file.
10
+ with open("big_five_capex.jsonl", "r") as file:
11
+ data = [json.loads(line) for line in file if line.strip()]
 
 
12
 
13
+ quarters: list[str] = [entry["Quarter"] for entry in data]
 
 
 
14
  companies = ['Microsoft', 'Google', 'Meta', 'Apple', 'Amazon']
15
  colors = ['#80bb00', '#ee161f', '#0065e3', '#000000', '#ff6200']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
+ x_positions = list(range(len(quarters)))
 
18
 
19
+ traces = []
20
  for company, color in zip(companies, colors):
21
+ y_data = [entry[company] for entry in data]
22
+ traces.append(go.Bar(
 
23
  name=company,
24
+ x=x_positions,
25
+ y=y_data,
26
  marker_color=color
27
  ))
28
 
29
+ fig = go.Figure(data=traces)
30
  fig.update_layout(
31
+ barmode="stack",
32
+ title="Capital Expenditures of the Big Five Tech Companies in Millions of USD per Quarter",
33
+ xaxis_title="Quarter",
34
+ yaxis_title="Capital Expenditures (Millions USD)",
35
+ xaxis=dict(
36
+ tickmode='array',
37
+ tickvals=x_positions,
38
+ ticktext=quarters
39
+ ),
40
+ height=600
41
  )
42
 
43
+ # Calculate the x position for the vertical dotted line.
44
+ # We want the line drawn between "2023 Q1" and "2023 Q2".
45
+ try:
46
+ idx_q1 = quarters.index("2023 Q1")
47
+ idx_q2 = quarters.index("2023 Q2")
48
+ vline_x = (idx_q1 + idx_q2) / 2 # position midway between the two quarters
49
+ except ValueError:
50
+ # Fall back if quarters not found.
51
+ vline_x = 0
52
+
53
+ # Add a vertical dotted line spanning the full height
54
+ fig.add_shape(
55
+ type="line",
56
+ xref="x",
57
+ yref="paper",
58
+ x0=vline_x,
59
+ y0=0,
60
+ x1=vline_x,
61
+ y1=1,
62
+ line=dict(
63
+ color="black",
64
+ dash="dot",
65
+ width=2
66
+ )
67
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
+ # Add an annotation label above the vertical line.
70
+ fig.add_annotation(
71
+ x=vline_x,
72
+ y=1.05, # place just above the top of the plotting area
73
+ xref="x",
74
+ yref="paper",
75
+ text="AI arms race begins",
76
+ showarrow=False,
77
+ font=dict(
78
+ color="black",
79
+ size=12
80
  ),
81
+ align="center"
82
  )
83
 
84
+ return fig
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
 
86
 
87
  def create_simple_plot(data_path: str,
 
160
 
161
 
162
  with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  with gr.Tab("System Performance Over Time"):
164
  with gr.Tab("ARC-AGI-Pub") as arc_agi_tab:
165
  arc_agi_plot: gr.Plot = gr.Plot()
 
193
  webarena_plot: gr.Plot = gr.Plot()
194
  with gr.Tab("ZeroEval", interactive=False):
195
  zeroeval_plot: gr.Plot = gr.Plot()
196
+ with gr.Tab("Finance") as finance_tab:
197
+ with gr.Tab("Big Five Capex") as big_five_capex_tab:
198
+ big_five_capex_plot: gr.Plot = gr.Plot()
199
+ with gr.Tab("NVIDIA Revenue", interactive=False) as nvidia_revenue:
200
+ nvidia_revenue_plot: gr.Plot = gr.Plot()
201
  big_five_capex_tab.select(fn=create_big_five_capex_plot, outputs=big_five_capex_plot)
202
+ finance_tab.select(fn=create_big_five_capex_plot, outputs=big_five_capex_plot)
 
 
 
 
 
 
 
 
203
  arc_agi_tab.select(fn=create_simple_plot,
204
  inputs=[gr.State("arc_agi_leaderboard.jsonl"), gr.State("ARC-AGI-Pub (Public Eval) Score"),
205
  gr.State(date(2024, 5, 13)), gr.State(date(2024, 12, 20))],
big_five_capex.jsonl CHANGED
@@ -1,4 +1,3 @@
1
- {"Quarter": "2014 Q4", "Microsoft": 1490, "Google": 3606, "Meta": 517, "Apple": 3217, "Amazon": 1145}
2
  {"Quarter": "2015 Q1", "Microsoft": 1391, "Google": 2927, "Meta": 502, "Apple": 2369, "Amazon": 871}
3
  {"Quarter": "2015 Q2", "Microsoft": 1781, "Google": 2515, "Meta": 549, "Apple": 2043, "Amazon": 1213}
4
  {"Quarter": "2015 Q3", "Microsoft": 1356, "Google": 2406, "Meta": 780, "Apple": 3618, "Amazon": 1195}
@@ -38,4 +37,4 @@
38
  {"Quarter": "2024 Q1", "Microsoft": 10952, "Google": 12012, "Meta": 6400, "Apple": 1996, "Amazon": 14925}
39
  {"Quarter": "2024 Q2", "Microsoft": 13873, "Google": 13186, "Meta": 8173, "Apple": 2151, "Amazon": 17620}
40
  {"Quarter": "2024 Q3", "Microsoft": 14923, "Google": 13016, "Meta": 8258, "Apple": 0, "Amazon": 22620}
41
- {"Quarter": "2024 Q4", "Microsoft": 0, "Google": 0, "Meta": 14425, "Apple": 0, "Amazon": 0}
 
 
1
  {"Quarter": "2015 Q1", "Microsoft": 1391, "Google": 2927, "Meta": 502, "Apple": 2369, "Amazon": 871}
2
  {"Quarter": "2015 Q2", "Microsoft": 1781, "Google": 2515, "Meta": 549, "Apple": 2043, "Amazon": 1213}
3
  {"Quarter": "2015 Q3", "Microsoft": 1356, "Google": 2406, "Meta": 780, "Apple": 3618, "Amazon": 1195}
 
37
  {"Quarter": "2024 Q1", "Microsoft": 10952, "Google": 12012, "Meta": 6400, "Apple": 1996, "Amazon": 14925}
38
  {"Quarter": "2024 Q2", "Microsoft": 13873, "Google": 13186, "Meta": 8173, "Apple": 2151, "Amazon": 17620}
39
  {"Quarter": "2024 Q3", "Microsoft": 14923, "Google": 13016, "Meta": 8258, "Apple": 0, "Amazon": 22620}
40
+ {"Quarter": "2024 Q4", "Microsoft": 15804, "Google": 14276, "Meta": 14425, "Apple": 0, "Amazon": 27834}
elo_results_20240915.pkl DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:bdce5fbf7a50d53ce549fd2c6c230627397856c4b62807b0e97a7f2c8554045e
3
- size 3707205