Spaces:
Running
Running
File size: 6,837 Bytes
726379a 03f436a 726379a 664fad5 812d54a 726379a 5e4bebf 812d54a 726379a 5e4bebf 726379a 1c1daf9 726379a 812d54a 726379a d1dca78 726379a b1137c3 d42fa3e c37f8fa 726379a bdc79a5 d42fa3e 8ed1e58 726379a bdc79a5 752c2b9 b8a90e2 2e0d42a 7f16259 dbac45c cd7dd97 2e0d42a 752c2b9 2e0d42a 093f8d9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
import gradio as gr
import pandas as pd
import plotly.express as px
merged_df = pd.read_csv("data/merged_cloud_data.csv")
options = [
"CPU type",
"CPU TDP",
"Memory",
"GPU Type",
"GPU Cost",
"GPU Total Cost",
"GPU number",
"TDP (W)",
"GPU Year",
"Total TDP (W)",
"$/Hour",
"provider",
"GPU TDP",
"vCPU",
"CPU Type",
"GPU Memory",
"vCPU(s)",
]
### TDP figs
#
tdp_fig = px.scatter(
merged_df,
x="Total TDP (W)",
y="$/Hour",
color="provider",
log_x=True,
log_y=True,
)
tdp_fig_gpu = px.scatter(
merged_df,
x="Total TDP (W)",
y="$/Hour",
color="GPU Type",
log_x=True,
log_y=True,
)
cost_fig = px.scatter(
merged_df,
x="GPU Total Cost",
y="$/Hour",
color="provider",
log_y=True,
log_x=True,
)
cost_fig_gpu = px.scatter(
merged_df,
x="GPU Total Cost",
y="$/Hour",
color="GPU Type",
log_y=True,
log_x=True,
)
def generate_figure(factor1, factor2, color, logx, logy):
fig = px.scatter(
merged_df,
x=factor1,
y=factor2,
color=color,
log_y=logx,
log_x=logy,
)
return fig
with gr.Blocks() as demo:
gr.Markdown("# Cloud Compute βοΈ, Energy β‘ and Cost π² - Comparison Tool")
gr.Markdown(
"## Explore the data from the blog post ['When we pay for cloud compute, what are we really paying for?'](https://huggingface.co/blog/sasha/energy-cost-compute)"
)
with gr.Accordion("Methodology", open=False):
gr.Markdown(
"""
In order to do our analysis, we gathered data from 5 major cloud compute providers β Microsoft Azure, Amazon Web Services, Google Cloud Platform,
Scaleway Cloud, and OVH Cloud β about the price and nature of their AI-specific compute offerings (i.e. all instances that have GPUs).
For each instance, we looked at its characteristics β the type and number of GPUs and CPUs that it contains, as well as the quantity of memory
it contains and its storage capacity. For each CPU and GPU model, we looked up its **TDP (Thermal Design Potential)** -- its power consumption
under the maximum theoretical load), which is an indicator of the operating expenses required to power it. For GPUs specifically, we also looked
at the **Manufacturer's Suggested Retail Price (MSRP)**, i.e. how much that particular GPU model cost at the time of its launch, as an indicator
of the capital expenditure required for the compute provider to buy the GPUs to begin with.
"""
)
with gr.Row():
with gr.Column():
gr.Markdown("## Energy β‘ vs Hourly Cost π²")
gr.Markdown(
"### In our analysis, we found that there is also a strong positive correlation between the two factors, across different compute providers:"
)
with gr.Row():
with gr.Column():
gr.Markdown(
"Double click the names of cloud providers to see the trend per company"
)
plt1 = gr.Plot(tdp_fig)
with gr.Column():
gr.Markdown(
"Double click the names of GPU models to see the trends per GPU"
)
plt1 = gr.Plot(tdp_fig_gpu)
with gr.Row():
with gr.Column():
gr.Markdown("## CapEx π° vs Hourly Cost π²")
gr.Markdown(
"### We also found that there is also a strong positive correlation the initial cost of the GPU and its cost per hour:"
)
with gr.Row():
with gr.Column():
gr.Markdown(
"Double click the names of cloud providers to see the trend per company"
)
plt1 = gr.Plot(cost_fig)
with gr.Column():
gr.Markdown(
"Double click the names of GPU models to see the trends per GPU"
)
plt1 = gr.Plot(cost_fig_gpu)
with gr.Row():
with gr.Column(scale=1):
gr.Markdown("## Generate your own plot π")
x_choice = gr.Dropdown(
options,
value="Memory",
label="X axis",
info="Pick a characteristic to plot on the X (horizontal) axis",
interactive=True,
allow_custom_value=True,
)
y_choice = gr.Dropdown(
options,
value="$/Hour",
label="Y axis",
info="Pick a characteristic to plot on the Y (vertical) axis",
interactive=True,
allow_custom_value=True,
)
color_choice = gr.Dropdown(
options,
value="provider",
label="Plot color",
info="Pick a characteristic for the colors/labels",
interactive=True,
allow_custom_value=True,
)
logx = gr.Checkbox(
label="Logarithmic X axis",
info="Plot the X (horizontal) axis in logarithmic scale",
value=True,
interactive=True,
)
logy = gr.Checkbox(
label="Logarithmic Y axis",
info="Plot the Y (vertical) axis in logarithmic scale",
value=True,
interactive=True,
)
with gr.Column(scale=3):
gr.Markdown(
"### Choose from the dropdown lists on the left to plot different characteristics and find new trends π΅π»ββοΈ"
)
gr.Markdown(
"N.B. Not all combinations are possible -- if you get a blank figure, try another combination!"
)
fig = generate_figure("Memory", "$/Hour", "provider", True, True)
plt = gr.Plot(fig)
x_choice.select(
generate_figure,
inputs=[x_choice, y_choice, color_choice, logx, logy],
outputs=[plt],
)
y_choice.select(
generate_figure,
inputs=[x_choice, y_choice, color_choice, logx, logy],
outputs=[plt],
)
color_choice.select(
generate_figure,
inputs=[x_choice, y_choice, color_choice, logx, logy],
outputs=[plt],
)
logx.select(
generate_figure,
inputs=[x_choice, y_choice, color_choice, logx, logy],
outputs=[plt],
)
logy.select(
generate_figure,
inputs=[x_choice, y_choice, color_choice, logx, logy],
outputs=[plt],
)
demo.launch()
|