Spaces:
Runtime error
Runtime error
sashavor
commited on
Commit
·
f924cbe
1
Parent(s):
bbb131b
screw forms!
Browse files
app.py
CHANGED
@@ -66,36 +66,35 @@ st.markdown('You can use this tool to calculate different aspects of your model:
|
|
66 |
|
67 |
st.markdown('### Dynamic Emissions')
|
68 |
with st.expander("Calculate the emissions produced by energy consumption of model training"):
|
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 |
-
on_click = lambda *args: write_to_csv(hardware, training_time, provider, carbon_intensity, dynamic_emissions))
|
99 |
|
100 |
|
101 |
st.markdown('### Idle Emissions')
|
|
|
66 |
|
67 |
st.markdown('### Dynamic Emissions')
|
68 |
with st.expander("Calculate the emissions produced by energy consumption of model training"):
|
69 |
+
col1, col2, col3, col4 = st.columns(4)
|
70 |
+
with col1:
|
71 |
+
hardware = st.selectbox('GPU used', TDP['name'].tolist())
|
72 |
+
gpu_tdp = TDP['tdp_watts'][TDP['name'] == hardware].tolist()[0]
|
73 |
+
st.markdown("Different GPUs have different TDP (Thermal Design Power), which impacts how much energy you use.")
|
74 |
+
with col2:
|
75 |
+
training_time = st.number_input('Total number of GPU hours')
|
76 |
+
st.markdown('This is calculated by multiplying the number of GPUs you used by the training time: '
|
77 |
+
'i.e. if you used 100 GPUs for 10 hours, this is equal to 100x10 = 1,000 GPU hours.')
|
78 |
+
with col3:
|
79 |
+
provider = st.selectbox('Provider used', providers)
|
80 |
+
st.markdown('If you can\'t find your provider here, select "Local/Private Infrastructure".')
|
81 |
+
with col4:
|
82 |
+
if provider != 'Local/Private Infastructure':
|
83 |
+
provider_instances = instances['region'][instances['provider'] == provider.lower()].unique().tolist()
|
84 |
+
region = st.selectbox('Provider used', provider_instances)
|
85 |
+
carbon_intensity = instances['impact'][(instances['provider'] == provider.lower()) & (instances['region'] == region)].tolist()[0]
|
86 |
+
|
87 |
+
else:
|
88 |
+
carbon_intensity = st.number_input('Carbon intensity of your energy grid, in grams of CO2 per kWh')
|
89 |
+
st.markdown('You can consult a resource like the [IEA](https://www.iea.org/countries) or '
|
90 |
+
' [Electricity Map](https://app.electricitymaps.com/) to get this information.')
|
91 |
+
dynamic_emissions = round(gpu_tdp * training_time * carbon_intensity/1000000)
|
92 |
+
st.metric(label="Dynamic emissions", value=str(dynamic_emissions)+' kilograms of CO2eq')
|
93 |
+
st.markdown('This is roughly equivalent to '+ str(round(dynamic_emissions/kg_per_mile,1)) + ' miles driven in an average US car'
|
94 |
+
' produced in 2021. [(Source: energy.gov)](https://www.energy.gov/eere/vehicles/articles/fotw-1223-january-31-2022-average-carbon-dioxide-emissions-2021-model-year)')
|
95 |
+
st.button(label="Anonymously share my data", help="Share the data from your model anonymously for research purposes!",\
|
96 |
+
on_click = lambda *args: write_to_csv(hardware, training_time, provider, carbon_intensity, dynamic_emissions))
|
97 |
+
|
|
|
98 |
|
99 |
|
100 |
st.markdown('### Idle Emissions')
|