Spaces:
Sleeping
Sleeping
Commit
·
0a86c6a
1
Parent(s):
67603e4
Update capex numbers; Fix and revamp champs
Browse files- app.py +66 -188
- big_five_capex.jsonl +1 -2
- 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 |
-
#
|
| 12 |
-
big_five_capex
|
| 13 |
-
|
| 14 |
-
for line in file:
|
| 15 |
-
big_five_capex.append(json.loads(line))
|
| 16 |
|
| 17 |
-
|
| 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 |
-
|
| 67 |
-
colors = ['#80bb00', '#ee161f', '#0065e3'] # TODO
|
| 68 |
|
|
|
|
| 69 |
for company, color in zip(companies, colors):
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
y=df[company],
|
| 73 |
name=company,
|
|
|
|
|
|
|
| 74 |
marker_color=color
|
| 75 |
))
|
| 76 |
|
|
|
|
| 77 |
fig.update_layout(
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
)
|
| 85 |
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 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 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
|
|
|
|
|
|
| 152 |
),
|
| 153 |
-
|
| 154 |
)
|
| 155 |
|
| 156 |
-
|
| 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("
|
| 311 |
-
with gr.Tab("
|
| 312 |
-
|
| 313 |
-
with gr.Tab("
|
| 314 |
-
|
| 315 |
big_five_capex_tab.select(fn=create_big_five_capex_plot, outputs=big_five_capex_plot)
|
| 316 |
-
|
| 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":
|
|
|
|
|
|
|
| 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
|
|
|
|
|
|
|
|
|
|
|
|