sashavor commited on
Commit
f924cbe
1 Parent(s): bbb131b

screw forms!

Browse files
Files changed (1) hide show
  1. app.py +29 -30
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
- with st.form(key='dynamic_emissions'):
70
- col1, col2, col3, col4 = st.columns(4)
71
- with col1:
72
- hardware = st.selectbox('GPU used', TDP['name'].tolist())
73
- gpu_tdp = TDP['tdp_watts'][TDP['name'] == hardware].tolist()[0]
74
- st.markdown("Different GPUs have different TDP (Thermal Design Power), which impacts how much energy you use.")
75
- with col2:
76
- training_time = st.number_input('Total number of GPU hours')
77
- st.markdown('This is calculated by multiplying the number of GPUs you used by the training time: '
78
- 'i.e. if you used 100 GPUs for 10 hours, this is equal to 100x10 = 1,000 GPU hours.')
79
- with col3:
80
- provider = st.selectbox('Provider used', providers)
81
- st.markdown('If you can\'t find your provider here, select "Local/Private Infrastructure".')
82
- with col4:
83
- if provider != 'Local/Private Infastructure':
84
- provider_instances = instances['region'][instances['provider'] == provider.lower()].unique().tolist()
85
- region = st.selectbox('Provider used', provider_instances)
86
- carbon_intensity = instances['impact'][(instances['provider'] == provider.lower()) & (instances['region'] == region)].tolist()[0]
87
-
88
- else:
89
- carbon_intensity = st.number_input('Carbon intensity of your energy grid, in grams of CO2 per kWh')
90
- st.markdown('You can consult a resource like the [IEA](https://www.iea.org/countries) or '
91
- ' [Electricity Map](https://app.electricitymaps.com/) to get this information.')
92
-
93
- dynamic_emissions = round(gpu_tdp * training_time * carbon_intensity/1000000)
94
- st.metric(label="Dynamic emissions", value=str(dynamic_emissions)+' kilograms of CO2eq')
95
- st.markdown('This is roughly equivalent to '+ str(round(dynamic_emissions/kg_per_mile,1)) + ' miles driven in an average US car'
96
- ' 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)')
97
- st.form_submit_button(label="Anonymously share my data", help="Share the data from your model anonymously for research purposes!",\
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')