integrated water consumption calculation with new code on ecologits

#9
by WayToGoHe - opened
data/electricity_mix.csv CHANGED
@@ -1,4 +1,7 @@
1
  name,unit,source,WOR,EEE,ZWE,ZMB,ZAF,YEM,VNM,VEN,UZB,URY,USA,UKR,TZA,TWN,TTO,TUR,TUN,TKM,TJK,THA,TGO,SYR,SLV,SEN,SVK,SVN,SGP,SWE,SDN,SAU,RUS,SCG,ROU,QAT,PRY,PRT,POL,PAK,PHL,PER,PAN,OMN,NZL,NPL,NOR,NLD,NIC,NGA,NAM,MOZ,MYS,MEX,MLT,MNG,MMR,MKD,MDA,MAR,LBY,LVA,LUX,LTU,LKA,LBN,KAZ,KWT,KOR,PRK,KHM,KGZ,KEN,JPN,JOR,JAM,ITA,ISL,IRN,IRQ,IND,ISR,IRL,IDN,HUN,HTI,HRV,HND,HKG,GTM,GRC,GIB,GHA,GEO,GBR,GAB,FRA,FIN,ETH,ESP,ERI,EGY,EST,ECU,DZA,DOM,DNK,DEU,CZE,CYP,CUB,CRI,COL,CHN,CMR,CHL,CIV,CHE,COG,COD,CAN,BLR,BWA,BRA,BOL,BRN,BEN,BHR,BGR,BEL,BGD,BIH,AZE,AUS,AUT,ARG,AGO,ANT,ARM,ALB,ARE
2
  adpe,kg éq. Sb,ADEME Base IMPACTS ®,0.0000000737708,0.0000000642317,0.000000109502,0.000000162193,0.0000000862445,0.0000000163908,0.0000000945573,0.000000112811,0.000000103681,0.000000104586,0.0000000985548,0.0000000647907,0.000000132261,0.0000000578088,0.000000064552,0.0000000749765,0.0000000177021,0.000000131822,0.000000152621,0.0000000569593,0.000000134255,0.0000000268396,0.0000000472135,0.0000000470662,0.0000000606109,0.0000000992283,0.0000000198459,0.0000000777062,0.0000000955701,0.0000000134206,0.0000000960312,0.000000132772,0.0000000981761,0.00000001324,0.000000149181,0.0000000341863,0.000000101946,0.0000000842952,0.0000000595304,0.0000000952688,0.0000000790553,0.0000000374073,0.0000000720474,0.000000238273,0.000000127486,0.0000000329318,0.0000000414983,0.0000000621,0.000000128285,0.000000148382,0.000000044938,0.0000000578358,0.000000049475,0.000000176361,0.000000152699,0.000000119873,0.000000110674,0.0000000641089,0.0000000206592,0.000000153757,0.000000105692,0.0000000294596,0.0000000986932,0.0000000182134,0.000000135386,0.0000000141168,0.0000000518017,0.000000117457,0.0000000319202,0.000000181827,0.0000000958533,0.0000000596578,0.0000000147031,0.0000000196047,0.00000005439,0.0000000781905,0.0000000220304,0.0000000404306,0.000000100099,0.0000000610194,0.0000000219257,0.0000000610451,0.0000000644587,0.0000000937057,0.000000153989,0.0000000649373,0.0000000816213,0.0000000803251,0.0000000691645,0.0000000286211,0.000000156003,0.000000137999,0.0000000370973,0.000000113843,0.0000000485798,0.0000000805114,0.000000174161,0.0000000518326,0.0000000512406,0.000000033925,0.0000000990171,0.000000127168,0.0000000216438,0.0000000429285,0.0000000157411,0.0000000878733,0.0000000817565,0.0000000448771,0.0000000299542,0.0000000863908,0.000000122031,0.0000000851552,0.000000146313,0.000000105851,0.0000000949004,0.000000100467,0.000000265575,0.000000174647,0.0000000993179,0.0000000840478,0.0000000866014,0.00000010962,0.0000000969793,0.0000000185641,0.0000000239702,0.0000000135014,0.0000000823611,0.0000000337201,0.0000000394158,0.000000148007,0.000000092567,0.0000000790846,0.000000141124,0.0000000768612,0.000000124074,0.0000000449103,0.0000000854245,0.000000229556,0.0000000141548
3
  pe,MJ,ADPf / (1-%renewable_energy),9.988,12.873,16.122,1.798,11.732,16.250,11.238,15.163,17.367,107.570,11.358,12.936,9.305,11.439,14.289,16.150,12.902,23.300,19.165,10.414,21.978,16.989,13.012,14.516,11.680,12.146,10.477,11.026,29.629,14.058,13.200,14.242,15.585,11.916,0.020,14.153,13.178,16.175,11.120,8.211,16.364,22.306,24.731,0.396,4.952,8.511,24.696,11.279,468.150,0.206,12.268,11.775,19.374,15.114,14.132,19.120,18.429,11.702,19.116,8.249,10.128,21.043,12.116,12.341,13.260,12.753,10.199,32.793,34.655,15.380,68.996,10.718,13.677,14.799,12.656,0.013,15.022,20.372,20.363,10.023,10.706,11.603,11.784,20.167,18.548,15.762,,14.340,14.487,,10.097,10.425,13.579,28.341,11.289,11.275,36.133,12.090,13.289,10.195,16.334,20.908,16.376,12.412,16.824,16.260,12.517,13.118,17.317,45.996,7.312,14.119,10.807,11.348,14.783,11.782,34.147,0.097,11.987,13.194,19.642,9.031,11.587,15.689,14.337,14.036,14.375,10.776,12.935,21.705,12.831,16.908,11.036,10.049,16.972,,13.380,0.201,19.032
4
- gwp,kg éq. CO2,ADEME Base IMPACTS ®,0.590478,0.509427,0.842811,0.0141304,1.17562,1.06777,0.555572,0.497373,0.81178,0.296953,0.67978,0.646745,0.475635,0.845351,0.933059,0.706988,0.80722,1.38296,0.0426743,0.646174,0.545455,1.08778,0.473128,1.1195,0.309341,0.498523,0.655825,0.0464664,1.12472,0.913677,0.66131,1.07808,0.664245,0.722125,0.241601,0.571172,1.15075,0.748727,0.761317,0.284364,0.53403,1.41292,0.293397,0.0841323,0.023754,0.544803,0.941626,0.693123,0.357253,0.00880732,0.832206,0.739214,1.31149,1.47192,0.48193,1.24074,1.04213,0.933694,1.35361,0.234273,0.490016,0.154229,0.709185,0.883627,1.128,0.885084,0.599585,0.797361,1.41054,0.156039,0.589603,0.540891,0.781372,1.07345,0.621329,0.0194609,0.930385,1.48728,1.58299,0.901842,0.648118,0.875394,0.541558,1.3858,0.535759,0.692837,0.95888,0.645801,1.13127,0.977477,0.540126,0.132046,0.602137,0.732511,0.0813225,0.322068,0.251299,0.467803,1.13153,0.587775,1.51492,0.627714,1.02318,0.909252,0.633534,0.657374,0.799077,0.978041,1.28325,0.224471,0.214014,1.05738,0.456622,0.574415,0.928583,0.0448568,0.904053,0.0613102,0.238191,0.795697,2.12572,0.278647,0.585131,0.997577,1.19128,0.804567,0.827087,0.256537,0.795168,1.56025,0.726126,1.12326,0.245573,0.476811,0.412014,1.13161,0.252002,0.0207635,1.09088
 
 
 
 
1
  name,unit,source,WOR,EEE,ZWE,ZMB,ZAF,YEM,VNM,VEN,UZB,URY,USA,UKR,TZA,TWN,TTO,TUR,TUN,TKM,TJK,THA,TGO,SYR,SLV,SEN,SVK,SVN,SGP,SWE,SDN,SAU,RUS,SCG,ROU,QAT,PRY,PRT,POL,PAK,PHL,PER,PAN,OMN,NZL,NPL,NOR,NLD,NIC,NGA,NAM,MOZ,MYS,MEX,MLT,MNG,MMR,MKD,MDA,MAR,LBY,LVA,LUX,LTU,LKA,LBN,KAZ,KWT,KOR,PRK,KHM,KGZ,KEN,JPN,JOR,JAM,ITA,ISL,IRN,IRQ,IND,ISR,IRL,IDN,HUN,HTI,HRV,HND,HKG,GTM,GRC,GIB,GHA,GEO,GBR,GAB,FRA,FIN,ETH,ESP,ERI,EGY,EST,ECU,DZA,DOM,DNK,DEU,CZE,CYP,CUB,CRI,COL,CHN,CMR,CHL,CIV,CHE,COG,COD,CAN,BLR,BWA,BRA,BOL,BRN,BEN,BHR,BGR,BEL,BGD,BIH,AZE,AUS,AUT,ARG,AGO,ANT,ARM,ALB,ARE
2
  adpe,kg éq. Sb,ADEME Base IMPACTS ®,0.0000000737708,0.0000000642317,0.000000109502,0.000000162193,0.0000000862445,0.0000000163908,0.0000000945573,0.000000112811,0.000000103681,0.000000104586,0.0000000985548,0.0000000647907,0.000000132261,0.0000000578088,0.000000064552,0.0000000749765,0.0000000177021,0.000000131822,0.000000152621,0.0000000569593,0.000000134255,0.0000000268396,0.0000000472135,0.0000000470662,0.0000000606109,0.0000000992283,0.0000000198459,0.0000000777062,0.0000000955701,0.0000000134206,0.0000000960312,0.000000132772,0.0000000981761,0.00000001324,0.000000149181,0.0000000341863,0.000000101946,0.0000000842952,0.0000000595304,0.0000000952688,0.0000000790553,0.0000000374073,0.0000000720474,0.000000238273,0.000000127486,0.0000000329318,0.0000000414983,0.0000000621,0.000000128285,0.000000148382,0.000000044938,0.0000000578358,0.000000049475,0.000000176361,0.000000152699,0.000000119873,0.000000110674,0.0000000641089,0.0000000206592,0.000000153757,0.000000105692,0.0000000294596,0.0000000986932,0.0000000182134,0.000000135386,0.0000000141168,0.0000000518017,0.000000117457,0.0000000319202,0.000000181827,0.0000000958533,0.0000000596578,0.0000000147031,0.0000000196047,0.00000005439,0.0000000781905,0.0000000220304,0.0000000404306,0.000000100099,0.0000000610194,0.0000000219257,0.0000000610451,0.0000000644587,0.0000000937057,0.000000153989,0.0000000649373,0.0000000816213,0.0000000803251,0.0000000691645,0.0000000286211,0.000000156003,0.000000137999,0.0000000370973,0.000000113843,0.0000000485798,0.0000000805114,0.000000174161,0.0000000518326,0.0000000512406,0.000000033925,0.0000000990171,0.000000127168,0.0000000216438,0.0000000429285,0.0000000157411,0.0000000878733,0.0000000817565,0.0000000448771,0.0000000299542,0.0000000863908,0.000000122031,0.0000000851552,0.000000146313,0.000000105851,0.0000000949004,0.000000100467,0.000000265575,0.000000174647,0.0000000993179,0.0000000840478,0.0000000866014,0.00000010962,0.0000000969793,0.0000000185641,0.0000000239702,0.0000000135014,0.0000000823611,0.0000000337201,0.0000000394158,0.000000148007,0.000000092567,0.0000000790846,0.000000141124,0.0000000768612,0.000000124074,0.0000000449103,0.0000000854245,0.000000229556,0.0000000141548
3
  pe,MJ,ADPf / (1-%renewable_energy),9.988,12.873,16.122,1.798,11.732,16.250,11.238,15.163,17.367,107.570,11.358,12.936,9.305,11.439,14.289,16.150,12.902,23.300,19.165,10.414,21.978,16.989,13.012,14.516,11.680,12.146,10.477,11.026,29.629,14.058,13.200,14.242,15.585,11.916,0.020,14.153,13.178,16.175,11.120,8.211,16.364,22.306,24.731,0.396,4.952,8.511,24.696,11.279,468.150,0.206,12.268,11.775,19.374,15.114,14.132,19.120,18.429,11.702,19.116,8.249,10.128,21.043,12.116,12.341,13.260,12.753,10.199,32.793,34.655,15.380,68.996,10.718,13.677,14.799,12.656,0.013,15.022,20.372,20.363,10.023,10.706,11.603,11.784,20.167,18.548,15.762,,14.340,14.487,,10.097,10.425,13.579,28.341,11.289,11.275,36.133,12.090,13.289,10.195,16.334,20.908,16.376,12.412,16.824,16.260,12.517,13.118,17.317,45.996,7.312,14.119,10.807,11.348,14.783,11.782,34.147,0.097,11.987,13.194,19.642,9.031,11.587,15.689,14.337,14.036,14.375,10.776,12.935,21.705,12.831,16.908,11.036,10.049,16.972,,13.380,0.201,19.032
4
+ gwp,kg éq. CO2,ADEME Base IMPACTS ®,0.590478,0.509427,0.842811,0.0141304,1.17562,1.06777,0.555572,0.497373,0.81178,0.296953,0.67978,0.646745,0.475635,0.845351,0.933059,0.706988,0.80722,1.38296,0.0426743,0.646174,0.545455,1.08778,0.473128,1.1195,0.309341,0.498523,0.655825,0.0464664,1.12472,0.913677,0.66131,1.07808,0.664245,0.722125,0.241601,0.571172,1.15075,0.748727,0.761317,0.284364,0.53403,1.41292,0.293397,0.0841323,0.023754,0.544803,0.941626,0.693123,0.357253,0.00880732,0.832206,0.739214,1.31149,1.47192,0.48193,1.24074,1.04213,0.933694,1.35361,0.234273,0.490016,0.154229,0.709185,0.883627,1.128,0.885084,0.599585,0.797361,1.41054,0.156039,0.589603,0.540891,0.781372,1.07345,0.621329,0.0194609,0.930385,1.48728,1.58299,0.901842,0.648118,0.875394,0.541558,1.3858,0.535759,0.692837,0.95888,0.645801,1.13127,0.977477,0.540126,0.132046,0.602137,0.732511,0.0813225,0.322068,0.251299,0.467803,1.13153,0.587775,1.51492,0.627714,1.02318,0.909252,0.633534,0.657374,0.799077,0.978041,1.28325,0.224471,0.214014,1.05738,0.456622,0.574415,0.928583,0.0448568,0.904053,0.0613102,0.238191,0.795697,2.12572,0.278647,0.585131,0.997577,1.19128,0.804567,0.827087,0.256537,0.795168,1.56025,0.726126,1.12326,0.245573,0.476811,0.412014,1.13161,0.252002,0.0207635,1.09088
5
+ water_wwf,L/kWh,World Resource Institute Guidance for Calculating Water Use Embedded in Purchased Electricity 2020 ,2216,2705.4,,,,,,,,,386,942,,,,1374,,,,833,,,,,1033,14807,,3777,,,2067,,454,,,1472,216,,,,,,1741,,8285,696,,,,,2472,469,87,,,,,,,7525,1393,3051,,,,,257,,,,,1855,,,3524,,,,2373,,212,1605,1525,,,,,,519,,,,167,,2464,2161,,295,,,765,,,,1374,1419,791,57,,,,606,,458,,8331,,,2850,,,893,,,,,379,621,,,,155,14145,1.291,,,,,0
6
+ water_wcf,L/kWh,World Resource Institute Guidance for Calculating Water Use Embedded in Purchased Electricity 2020,5.04,4.48,,,,,,,,,3.14,2.12,,,,4.92,,,,2.88,,,,,5.79,2.99,,6.02,,,3.44,,7.34,,,9.58,2.5,,,,,,14.95,,6.66,3.44,,,,,1.67,5.3,1.14,,,,,,,2.54,12.79,5.9,,,,,1.89,,,,,2.31,,,4.84,,,,3.44,,1.48,2.27,3.67,,,,,,5.15,,,,2.35,,3.67,4.54,,6.21,,,2.2,,,,3.18,1.93,3.22,1.29,,,,6.02,,10.52,,5.68,,,8.18,,,18.58,,,,,4.62,2.61,,,,4.73,5.72,11.47,,,,,0
7
+
src/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (651 Bytes). View file
 
src/__pycache__/calculator.cpython-311.pyc ADDED
Binary file (6.09 kB). View file
 
src/__pycache__/constants.cpython-311.pyc ADDED
Binary file (2.7 kB). View file
 
src/__pycache__/content.cpython-311.pyc ADDED
Binary file (19.6 kB). View file
 
src/__pycache__/electricity_mix.cpython-311.pyc ADDED
Binary file (6.26 kB). View file
 
src/__pycache__/expert.cpython-311.pyc ADDED
Binary file (18.1 kB). View file
 
src/__pycache__/impacts.cpython-311.pyc ADDED
Binary file (12.8 kB). View file
 
src/__pycache__/models.cpython-311.pyc ADDED
Binary file (5.28 kB). View file
 
src/__pycache__/token_estimator.cpython-311.pyc ADDED
Binary file (2.15 kB). View file
 
src/__pycache__/utils.cpython-311.pyc ADDED
Binary file (13.4 kB). View file
 
src/calculator.py CHANGED
@@ -21,7 +21,7 @@ def calculator_mode():
21
  label = 'Provider',
22
  options = [x for x in df['provider_clean'].unique()],
23
  index = 7
24
- )
25
 
26
  with col2:
27
  model = st.selectbox(
@@ -45,28 +45,28 @@ def calculator_mode():
45
  if df_filtered['warning_arch'].values[0] and df_filtered['warning_multi_modal'].values[0]:
46
  st.warning(WARNING_BOTH)
47
 
48
- try:
49
 
50
- impacts = llm_impacts(
51
- provider=provider_raw,
52
- model_name=model_raw,
53
- output_token_count=[x[1] for x in PROMPTS if x[0] == output_tokens][0],
54
- request_latency=100000
55
- )
56
 
57
- impacts, _, _ = format_impacts(impacts)
58
-
59
- with st.container(border=True):
60
 
61
- st.markdown('<h3 align = "center">Environmental impacts</h3>', unsafe_allow_html=True)
62
- st.markdown('<p align = "center">To understand how the environmental impacts are computed go to the 📖 Methodology tab.</p>', unsafe_allow_html=True)
63
- display_impacts(impacts)
 
 
64
 
65
- with st.container(border=True):
66
-
67
- st.markdown('<h3 align = "center">That\'s equivalent to ...</h3>', unsafe_allow_html=True)
68
- st.markdown('<p align = "center">Making this request to the LLM is equivalent to the following actions :</p>', unsafe_allow_html=True)
69
- display_equivalent(impacts)
70
 
71
- except Exception as e:
72
- st.error('Could not find the model in the repository. Please try another model.')
 
21
  label = 'Provider',
22
  options = [x for x in df['provider_clean'].unique()],
23
  index = 7
24
+ ) #une liste de proviseurs à selectioner
25
 
26
  with col2:
27
  model = st.selectbox(
 
45
  if df_filtered['warning_arch'].values[0] and df_filtered['warning_multi_modal'].values[0]:
46
  st.warning(WARNING_BOTH)
47
 
48
+ #try:
49
 
50
+ impacts = llm_impacts(
51
+ provider=provider_raw,
52
+ model_name=model_raw,
53
+ output_token_count=[x[1] for x in PROMPTS if x[0] == output_tokens][0],
54
+ request_latency=100000
55
+ )
56
 
57
+ impacts, _, _ = format_impacts(impacts)
58
+
59
+ with st.container(border=True):
60
 
61
+ st.markdown('<h3 align = "center">Environmental impacts</h3>', unsafe_allow_html=True)
62
+ st.markdown('<p align = "center">To understand how the environmental impacts are computed go to the 📖 Methodology tab.</p>', unsafe_allow_html=True)
63
+ display_impacts(impacts, provider, location="🌎 World")
64
+
65
+ with st.container(border=True):
66
 
67
+ st.markdown('<h3 align = "center">That\'s equivalent to ...</h3>', unsafe_allow_html=True)
68
+ st.markdown('<p align = "center">Making this request to the LLM is equivalent to the following actions :</p>', unsafe_allow_html=True)
69
+ display_equivalent(impacts, provider, location="🌎 World")
 
 
70
 
71
+ # except Exception as e:
72
+ # st.error('Could not find the model in the repository. Please try another model.')
src/content.py CHANGED
@@ -72,7 +72,7 @@ ABOUT_TEXT = r"""
72
  The rapid evolution of generative AI is reshaping numerous industries and aspects of our daily lives. While these
73
  advancements offer some benefits, they also **pose substantial environmental challenges that cannot be overlooked**.
74
  Plus the issue of AI's environmental footprint has been mainly discussed at training stage but rarely at the inference
75
- stage. That is an issue because **inference impacts for LLMs can largely overcome the training impacts when deployed
76
  at large scales**.
77
  At **[GenAI Impact](https://genai-impact.org/) we are dedicated to understanding and mitigating the environmental
78
  impacts of generative AI** through rigorous research, innovative tools, and community engagement. Especially, in early
@@ -146,38 +146,44 @@ Leaderboard.
146
  For general question on the project, please use the [GitHub thread](https://github.com/genai-impact/ecologits/discussions/45).
147
  Otherwise use our contact form on [genai-impact.org/contact](https://genai-impact.org/contact/).
148
  """
149
-
 
150
 
151
  METHODOLOGY_TEXT = r"""
152
  ## 📖 Methodology
153
  We have developed a methodology to **estimate the energy consumption and environmental impacts for an LLM inference**
154
  based on request parameters and hypotheses on the data center location, the hardware used, the model architecture and
155
  more.
156
- In this section we will only cover the principles of the methodology related to the 🧮 **EcoLogits Calculator**. If
157
- you wish to learn more on the environmental impacts modeling of an LLM request checkout the
158
  🌱 [EcoLogits documentation page](https://ecologits.ai/methodology/).
159
  ### Modeling impacts of an LLM request
160
- The environmental impacts of an LLM inference are split into the **usage impacts** $I_{request}^u$ to account for
161
- electricity consumption and the **embodied impacts** $I_{request}^e$ that relates to resource extraction, hardware
162
- manufacturing and transportation. In general terms it can be expressed as follow:
163
  $$ I_{request} = I_{request}^u + I_{request}^e $$
164
  $$ I_{request} = E_{request}*F_{em}+\frac{\Delta T}{\Delta L}*I_{server}^e $$
165
- With,
166
  * $E_{request}$ the estimated energy consumption of the server and its cooling system.
167
  * $F_{em}$ the electricity mix that depends on the country and time.
168
  * $\frac{\Delta T}{\Delta L}$ the hardware usage ratio i.e. the computation time over the lifetime of the hardware.
169
  * $I_{server}^e$ the embodied impacts of the server.
170
- Additionally, to ⚡️ **direct energy consumption** the environmental impacts are expressed in **three dimensions
171
- (multi-criteria impacts)** that are:
172
- * 🌍 **Global Warming Potential** (GWP): Potential impact on global warming in kgCO2eq (commonly known as GHG/carbon
173
- emissions).
174
- * 🪨 **Abiotic Depletion Potential for Elements** (ADPe): Impact on the depletion of non-living resources such as
175
- minerals or metals in kgSbeq.
176
- * ⛽️ **Primary Energy** (PE): Total energy consumed from primary sources in MJ.
 
 
 
 
 
177
  ### Principles, Data and Hypotheses
178
- We use a **bottom-up methodology** to model impacts, meaning that we will estimate the impacts of low-level physical
179
- components to then estimate the impacts at software level (in that case an LLM inference). We also rely on **Life
180
- Cycle Approach (LCA) proxies and approach** to model both usage and embodied phases with multi-criteria impacts.
181
  If you are interested in this approach we recommend you to read the following [Boavizta](https://boavizta.org/)
182
  resources.
183
  * [Digital & environment: How to evaluate server manufacturing footprint, beyond greenhouse gas emissions?](https://boavizta.org/en/blog/empreinte-de-la-fabrication-d-un-serveur)
@@ -189,14 +195,16 @@ and latency based on the model architecture and number of output tokens.
189
  * [Boavizta API](https://github.com/Boavizta/boaviztapi) to estimate server embodied impacts and base energy
190
  consumption.
191
  * [ADEME Base Empreinte®](https://base-empreinte.ademe.fr/) for electricity mix impacts per country.
 
 
192
  Finally here are the **main hypotheses** we have made to compute the impacts.
193
  * ⚠️ **We *"guesstimate"* the model architecture of proprietary LLMs when not disclosed by the provider.**
194
  * Production setup: quantized models running on data center grade servers and GPUs such as A100.
195
  * Electricity mix does not depend on time (help us enhance EcoLogits and work on this [issue](https://github.com/genai-impact/ecologits/issues/42))
196
- * Ignore the following impacts: unused cloud resources, data center building, network and end-user devices... (for now)
197
  ## Equivalents
198
  We have integrated impact equivalents to help people better understand the impacts and have reference points for
199
- standard use cases and everyday activities.
200
  ### Request impacts
201
  These equivalents are computed based on the request impacts only.
202
  #### 🚶‍♂️‍➡️ Walking or 🏃‍♂️‍➡️ running distance
@@ -206,8 +214,8 @@ physical activity (for someone weighing 70kg):
206
  * 🚶‍♂️‍➡️ walking: $ 196\ kJ/km $ (speed of $ 3\ km/h $)
207
  * 🏃‍♂️‍➡️ running: $ 294\ kJ/km $ (speed of $ 10\ km/h $)
208
  We divide the request energy consumption by these values to compute the distance traveled.
209
- #### 🔋 Electric Vehicle distance
210
- We compare the ⚡️ direct energy consumption with the energy consumer by a EV car. From
211
  [selectra.info](https://selectra.info/energie/actualites/insolite/consommation-vehicules-electriques-france-2040) or
212
  [tesla.com](https://www.tesla.com/fr_fr/support/power-consumption) we consider an average value of energy consumed per
213
  kilometer of: $ 0.17\ kWh/km $.
@@ -217,43 +225,47 @@ We compare the 🌍 GHG emissions of the request and of streaming a video. From
217
  [impactco2.fr](https://impactco2.fr/outils/comparateur?value=1&comparisons=streamingvideo), we consider that
218
  $ 1\ kgCO2eq $ is equivalent to $ 15.6\ h $ of streaming.
219
  We multiply that value by the GHG emissions of the request to get an equivalent in hours of video streaming.
 
 
220
  ### Scaled impacts
221
  These equivalents are computed based on the request impacts scaled to a worldwide adoption use case. We imply that the
222
- same request is done 1% of the planet everyday for 1 year, and then compute impact equivalents.
223
  $$
224
- I_{scaled} = I_{request} * [1 \\% \ \text{of}\ 8B\ \text{people on earth}] * 365\ \text{days}
225
  $$
226
  #### Number of 💨 wind turbines or ☢️ nuclear plants
227
- We compare the ⚡️ direct energy consumption (scaled) by the energy production of wind turbines and nuclear power
228
  plants. From [ecologie.gouv.fr](https://www.ecologie.gouv.fr/eolien-terrestre) we consider that a $ 2\ MW $ wind
229
  turbine produces $ 4.2\ GWh $ a year. And from [edf.fr](https://www.edf.fr/groupe-edf/espaces-dedies/jeunes-enseignants/pour-les-jeunes/lenergie-de-a-a-z/produire-de-lelectricite/le-nucleaire-en-chiffres)
230
  we learn that a $ 900\ MW $ nuclear power plant produces $ 6\ TWh $ a year.
231
  We divide the scaled energy consumption by these values to get the number of wind turbines or nuclear power plants
232
  needed.
233
  #### Multiplier of 🇮🇪 Ireland electricity consumption
234
- We compare the ⚡️ direct energy consumption (scaled) by the electricity consumption of Ireland per year. From
235
  [wikipedia.org](https://en.wikipedia.org/wiki/List_of_countries_by_electricity_consumption) we consider the Ireland
236
  electricity consumption to be $ 33\ TWh $ a year for a population of 5M.
237
- We divide the scaled energy consumption by this value to get the equivalent number of "Ireland countries".
238
  #### Number of ✈️ Paris ↔ New York City flights
239
- We compare the 🌍 GHG emissions (scaled) of the request and of a return flight Paris ↔ New York City. From
240
  [impactco2.fr](https://impactco2.fr/outils/comparateur?value=1&comparisons=&equivalent=avion-pny) we consider that a
241
  return flight Paris → New York City → Paris for one passenger emits $ 1,770\ kgCO2eq $ and we consider an overall
242
  average load of 100 passengers per flight.
243
  We divide the scaled GHG emissions by this value to get the equivalent number of return flights.
244
-
 
 
245
  #### If you are motivated to help us test and enhance this methodology [contact us](https://genai-impact.org/contact/)! 💪
246
  """
247
 
248
  CITATION_LABEL = "BibTeX citation for EcoLogits Calculator and the EcoLogits library:"
249
  CITATION_TEXT = r"""@misc{ecologits-calculator,
250
- author={Samuel Rincé, Adrien Banse and Valentin Defour},
251
  title={EcoLogits Calculator},
252
  year={2025},
253
  howpublished= {\url{https://huggingface.co/spaces/genai-impact/ecologits-calculator}},
254
  }
255
  @software{ecologits,
256
- author = {Samuel Rincé, Adrien Banse, Vinh Nguyen and Luc Berton},
257
  publisher = {GenAI Impact},
258
  title = {EcoLogits: track the energy consumption and environmental footprint of using generative AI models through APIs.},
259
  }"""
 
72
  The rapid evolution of generative AI is reshaping numerous industries and aspects of our daily lives. While these
73
  advancements offer some benefits, they also **pose substantial environmental challenges that cannot be overlooked**.
74
  Plus the issue of AI's environmental footprint has been mainly discussed at training stage but rarely at the inference
75
+ stage. That is an issue because **inference impacts for large langauge models (LLMs) can largely overcome the training impacts when deployed
76
  at large scales**.
77
  At **[GenAI Impact](https://genai-impact.org/) we are dedicated to understanding and mitigating the environmental
78
  impacts of generative AI** through rigorous research, innovative tools, and community engagement. Especially, in early
 
146
  For general question on the project, please use the [GitHub thread](https://github.com/genai-impact/ecologits/discussions/45).
147
  Otherwise use our contact form on [genai-impact.org/contact](https://genai-impact.org/contact/).
148
  """
149
+ #TODO ajoute des mots sur water use. embodied vs per request use
150
+ #TODO ajuster la partie sur embodied electricité. c'est pas du tout clair
151
 
152
  METHODOLOGY_TEXT = r"""
153
  ## 📖 Methodology
154
  We have developed a methodology to **estimate the energy consumption and environmental impacts for an LLM inference**
155
  based on request parameters and hypotheses on the data center location, the hardware used, the model architecture and
156
  more.
157
+ In this section, we will only cover the principles of the methodology related to the 🧮 **EcoLogits Calculator**. If
158
+ you would like to learn more about the environmental impacts modeling of an LLM request, consider checking out the
159
  🌱 [EcoLogits documentation page](https://ecologits.ai/methodology/).
160
  ### Modeling impacts of an LLM request
161
+ The environmental impacts of an LLM inference are split into **usage impacts** $I_{request}^u$ to account for
162
+ electricity consumption and **embodied impacts** $I_{request}^e$ that relate to resource extraction, hardware
163
+ manufacturing and transportation. It can be expressed as the following:
164
  $$ I_{request} = I_{request}^u + I_{request}^e $$
165
  $$ I_{request} = E_{request}*F_{em}+\frac{\Delta T}{\Delta L}*I_{server}^e $$
166
+ Where
167
  * $E_{request}$ the estimated energy consumption of the server and its cooling system.
168
  * $F_{em}$ the electricity mix that depends on the country and time.
169
  * $\frac{\Delta T}{\Delta L}$ the hardware usage ratio i.e. the computation time over the lifetime of the hardware.
170
  * $I_{server}^e$ the embodied impacts of the server.
171
+
172
+ Additionally, the environmental impacts are expressed in **four dimensions
173
+ (multi-criteria impacts)**:
174
+ * 🌍 **Global Warming Potential** (GWP): Potential impact on Climate Change in kilograms of CO2 equivalent,
175
+ or kgCO2eq, also commonly known as green house gases (GHG) or carbon emissions.
176
+ * 🪨 **Abiotic Depletion Potential for Elements** (ADPe): Mesures the impact on the depletion of non-organic resources such as
177
+ minerals or metals in kilograms of antimony equivalent. This is to say the impact equating to that amount of antimony extracted.
178
+ * ⛽️ **Primary Energy** (PE): Total energy consumed from primary sources in megajoules.
179
+ * 💧 **Water Use** : Water consumption from this request.
180
+
181
+ Again, if you are interested in seeing the detailed calculations we employ, please consider checking out the methodology page on our website for [ecologits]https://ecologits.ai/latest/methodology/llm_inference/)!
182
+
183
  ### Principles, Data and Hypotheses
184
+ We use a **bottom-up methodology** to model impacts, meaning that we estimate the impacts of low-level physical
185
+ components to then estimate the impacts at software level (in our case an LLM inference). We also rely on **Life
186
+ Cycle Approach (LCA) proxies** to model both usage and embodied phases with multi-criteria impacts.
187
  If you are interested in this approach we recommend you to read the following [Boavizta](https://boavizta.org/)
188
  resources.
189
  * [Digital & environment: How to evaluate server manufacturing footprint, beyond greenhouse gas emissions?](https://boavizta.org/en/blog/empreinte-de-la-fabrication-d-un-serveur)
 
195
  * [Boavizta API](https://github.com/Boavizta/boaviztapi) to estimate server embodied impacts and base energy
196
  consumption.
197
  * [ADEME Base Empreinte®](https://base-empreinte.ademe.fr/) for electricity mix impacts per country.
198
+ * [World Resource Institute](https://www.wri.org/research/guidance-calculating-water-use-embedded-purchased-electricity) for the water withdrawal factor (WWF) and water consumption factor (WCF) for different countries.
199
+ * [Various sources from companies' sustainability reports](https://docs.google.com/spreadsheets/d/1XvKNhqJJ3e0wlUlSOcv-HS8jIwjCJBEQYgNhkVwA7ac/edit?usp=sharing) for their on-site water usage efficiencies and power usage efficiencies.
200
  Finally here are the **main hypotheses** we have made to compute the impacts.
201
  * ⚠️ **We *"guesstimate"* the model architecture of proprietary LLMs when not disclosed by the provider.**
202
  * Production setup: quantized models running on data center grade servers and GPUs such as A100.
203
  * Electricity mix does not depend on time (help us enhance EcoLogits and work on this [issue](https://github.com/genai-impact/ecologits/issues/42))
204
+ * We are ignoring the following impacts: unused cloud resources, data center building, network and end-user devices... (for now)
205
  ## Equivalents
206
  We have integrated impact equivalents to help people better understand the impacts and have reference points for
207
+ standard use cases in everyday activities.
208
  ### Request impacts
209
  These equivalents are computed based on the request impacts only.
210
  #### 🚶‍♂️‍➡️ Walking or 🏃‍♂️‍➡️ running distance
 
214
  * 🚶‍♂️‍➡️ walking: $ 196\ kJ/km $ (speed of $ 3\ km/h $)
215
  * 🏃‍♂️‍➡️ running: $ 294\ kJ/km $ (speed of $ 10\ km/h $)
216
  We divide the request energy consumption by these values to compute the distance traveled.
217
+ #### 🔋 Electric vehicle distance
218
+ We compare the ⚡️ direct energy consumption with the energy consumer by an EV car. From
219
  [selectra.info](https://selectra.info/energie/actualites/insolite/consommation-vehicules-electriques-france-2040) or
220
  [tesla.com](https://www.tesla.com/fr_fr/support/power-consumption) we consider an average value of energy consumed per
221
  kilometer of: $ 0.17\ kWh/km $.
 
225
  [impactco2.fr](https://impactco2.fr/outils/comparateur?value=1&comparisons=streamingvideo), we consider that
226
  $ 1\ kgCO2eq $ is equivalent to $ 15.6\ h $ of streaming.
227
  We multiply that value by the GHG emissions of the request to get an equivalent in hours of video streaming.
228
+ #### 🚰 Bottled waters
229
+ We compare the water consumption to a standard 75cL water bottle.
230
  ### Scaled impacts
231
  These equivalents are computed based on the request impacts scaled to a worldwide adoption use case. We imply that the
232
+ same request is done by 1% of the world population everyday for 1 year, and then compute impact equivalents.
233
  $$
234
+ I_{scaled} = I_{request} * [1 \% \ \text{of 8 billion people on earth}] * 365\ \text{days}
235
  $$
236
  #### Number of 💨 wind turbines or ☢️ nuclear plants
237
+ We compare the ⚡️ scaled direct energy consumption by the energy production of wind turbines and nuclear power
238
  plants. From [ecologie.gouv.fr](https://www.ecologie.gouv.fr/eolien-terrestre) we consider that a $ 2\ MW $ wind
239
  turbine produces $ 4.2\ GWh $ a year. And from [edf.fr](https://www.edf.fr/groupe-edf/espaces-dedies/jeunes-enseignants/pour-les-jeunes/lenergie-de-a-a-z/produire-de-lelectricite/le-nucleaire-en-chiffres)
240
  we learn that a $ 900\ MW $ nuclear power plant produces $ 6\ TWh $ a year.
241
  We divide the scaled energy consumption by these values to get the number of wind turbines or nuclear power plants
242
  needed.
243
  #### Multiplier of 🇮🇪 Ireland electricity consumption
244
+ We compare the ⚡️ scaled direct energy consumption by the electricity consumption of Ireland per year. From
245
  [wikipedia.org](https://en.wikipedia.org/wiki/List_of_countries_by_electricity_consumption) we consider the Ireland
246
  electricity consumption to be $ 33\ TWh $ a year for a population of 5M.
247
+ We divide the scaled energy consumption by this value to get the equivalent number of "Irelands".
248
  #### Number of ✈️ Paris ↔ New York City flights
249
+ We compare the 🌍 scaled GHG emissions of the request and of a return flight Paris ↔ New York City. From
250
  [impactco2.fr](https://impactco2.fr/outils/comparateur?value=1&comparisons=&equivalent=avion-pny) we consider that a
251
  return flight Paris → New York City → Paris for one passenger emits $ 1,770\ kgCO2eq $ and we consider an overall
252
  average load of 100 passengers per flight.
253
  We divide the scaled GHG emissions by this value to get the equivalent number of return flights.
254
+ #### Number of Olympic-sized swimming pools 🏊🏼
255
+ We compare the scaled water consumption to the number of Olympic-sized swimming pools it can fill. According to the [Phinizy Center for Water Sciences](https://phinizycenter.org/olympic-swimming-pools/),
256
+ an Olympic-sized swimming pool holds about 2.5 million liters of water.
257
  #### If you are motivated to help us test and enhance this methodology [contact us](https://genai-impact.org/contact/)! 💪
258
  """
259
 
260
  CITATION_LABEL = "BibTeX citation for EcoLogits Calculator and the EcoLogits library:"
261
  CITATION_TEXT = r"""@misc{ecologits-calculator,
262
+ author={Samuel Rincé, Adrien Banse, Valentin Defour, and Chieh Hsu},
263
  title={EcoLogits Calculator},
264
  year={2025},
265
  howpublished= {\url{https://huggingface.co/spaces/genai-impact/ecologits-calculator}},
266
  }
267
  @software{ecologits,
268
+ author = {Samuel Rincé, Adrien Banse, Vinh Nguyen, Luc Berton, and Chieh Hsu},
269
  publisher = {GenAI Impact},
270
  title = {EcoLogits: track the energy consumption and environmental footprint of using generative AI models through APIs.},
271
  }"""
src/data/electricity_mix.csv CHANGED
@@ -1,4 +1,7 @@
1
  name,unit,source,WOR,EEE,ZWE,ZMB,ZAF,YEM,VNM,VEN,UZB,URY,USA,UKR,TZA,TWN,TTO,TUR,TUN,TKM,TJK,THA,TGO,SYR,SLV,SEN,SVK,SVN,SGP,SWE,SDN,SAU,RUS,SCG,ROU,QAT,PRY,PRT,POL,PAK,PHL,PER,PAN,OMN,NZL,NPL,NOR,NLD,NIC,NGA,NAM,MOZ,MYS,MEX,MLT,MNG,MMR,MKD,MDA,MAR,LBY,LVA,LUX,LTU,LKA,LBN,KAZ,KWT,KOR,PRK,KHM,KGZ,KEN,JPN,JOR,JAM,ITA,ISL,IRN,IRQ,IND,ISR,IRL,IDN,HUN,HTI,HRV,HND,HKG,GTM,GRC,GIB,GHA,GEO,GBR,GAB,FRA,FIN,ETH,ESP,ERI,EGY,EST,ECU,DZA,DOM,DNK,DEU,CZE,CYP,CUB,CRI,COL,CHN,CMR,CHL,CIV,CHE,COG,COD,CAN,BLR,BWA,BRA,BOL,BRN,BEN,BHR,BGR,BEL,BGD,BIH,AZE,AUS,AUT,ARG,AGO,ANT,ARM,ALB,ARE
2
- adpe,kg éq. Sb,ADEME Base IMPACTS ®,0.0000000737708,0.0000000642317,0.000000109502,0.000000162193,0.0000000862445,0.0000000163908,0.0000000945573,0.000000112811,0.000000103681,0.000000104586,0.0000000985548,0.0000000647907,0.000000132261,0.0000000578088,0.000000064552,0.0000000749765,0.0000000177021,0.000000131822,0.000000152621,0.0000000569593,0.000000134255,0.0000000268396,0.0000000472135,0.0000000470662,0.0000000606109,0.0000000992283,0.0000000198459,0.0000000777062,0.0000000955701,0.0000000134206,0.0000000960312,0.000000132772,0.0000000981761,0.00000001324,0.000000149181,0.0000000341863,0.000000101946,0.0000000842952,0.0000000595304,0.0000000952688,0.0000000790553,0.0000000374073,0.0000000720474,0.000000238273,0.000000127486,0.0000000329318,0.0000000414983,0.0000000621,0.000000128285,0.000000148382,0.000000044938,0.0000000578358,0.000000049475,0.000000176361,0.000000152699,0.000000119873,0.000000110674,0.0000000641089,0.0000000206592,0.000000153757,0.000000105692,0.0000000294596,0.0000000986932,0.0000000182134,0.000000135386,0.0000000141168,0.0000000518017,0.000000117457,0.0000000319202,0.000000181827,0.0000000958533,0.0000000596578,0.0000000147031,0.0000000196047,0.00000005439,0.0000000781905,0.0000000220304,0.0000000404306,0.000000100099,0.0000000610194,0.0000000219257,0.0000000610451,0.0000000644587,0.0000000937057,0.000000153989,0.0000000649373,0.0000000816213,0.0000000803251,0.0000000691645,0.0000000286211,0.000000156003,0.000000137999,0.0000000370973,0.000000113843,0.0000000485798,0.0000000805114,0.000000174161,0.0000000518326,0.0000000512406,0.000000033925,0.0000000990171,0.000000127168,0.0000000216438,0.0000000429285,0.0000000157411,0.0000000878733,0.0000000817565,0.0000000448771,0.0000000299542,0.0000000863908,0.000000122031,0.0000000851552,0.000000146313,0.000000105851,0.0000000949004,0.000000100467,0.000000265575,0.000000174647,0.0000000993179,0.0000000840478,0.0000000866014,0.00000010962,0.0000000969793,0.0000000185641,0.0000000239702,0.0000000135014,0.0000000823611,0.0000000337201,0.0000000394158,0.000000148007,0.000000092567,0.0000000790846,0.000000141124,0.0000000768612,0.000000124074,0.0000000449103,0.0000000854245,0.000000229556,0.0000000141548
3
  pe,MJ,ADPf / (1-%renewable_energy),9.988,12.873,16.122,1.798,11.732,16.250,11.238,15.163,17.367,107.570,11.358,12.936,9.305,11.439,14.289,16.150,12.902,23.300,19.165,10.414,21.978,16.989,13.012,14.516,11.680,12.146,10.477,11.026,29.629,14.058,13.200,14.242,15.585,11.916,0.020,14.153,13.178,16.175,11.120,8.211,16.364,22.306,24.731,0.396,4.952,8.511,24.696,11.279,468.150,0.206,12.268,11.775,19.374,15.114,14.132,19.120,18.429,11.702,19.116,8.249,10.128,21.043,12.116,12.341,13.260,12.753,10.199,32.793,34.655,15.380,68.996,10.718,13.677,14.799,12.656,0.013,15.022,20.372,20.363,10.023,10.706,11.603,11.784,20.167,18.548,15.762,,14.340,14.487,,10.097,10.425,13.579,28.341,11.289,11.275,36.133,12.090,13.289,10.195,16.334,20.908,16.376,12.412,16.824,16.260,12.517,13.118,17.317,45.996,7.312,14.119,10.807,11.348,14.783,11.782,34.147,0.097,11.987,13.194,19.642,9.031,11.587,15.689,14.337,14.036,14.375,10.776,12.935,21.705,12.831,16.908,11.036,10.049,16.972,,13.380,0.201,19.032
4
- gwp,kg éq. CO2,ADEME Base IMPACTS ®,0.590478,0.509427,0.842811,0.0141304,1.17562,1.06777,0.555572,0.497373,0.81178,0.296953,0.67978,0.646745,0.475635,0.845351,0.933059,0.706988,0.80722,1.38296,0.0426743,0.646174,0.545455,1.08778,0.473128,1.1195,0.309341,0.498523,0.655825,0.0464664,1.12472,0.913677,0.66131,1.07808,0.664245,0.722125,0.241601,0.571172,1.15075,0.748727,0.761317,0.284364,0.53403,1.41292,0.293397,0.0841323,0.023754,0.544803,0.941626,0.693123,0.357253,0.00880732,0.832206,0.739214,1.31149,1.47192,0.48193,1.24074,1.04213,0.933694,1.35361,0.234273,0.490016,0.154229,0.709185,0.883627,1.128,0.885084,0.599585,0.797361,1.41054,0.156039,0.589603,0.540891,0.781372,1.07345,0.621329,0.0194609,0.930385,1.48728,1.58299,0.901842,0.648118,0.875394,0.541558,1.3858,0.535759,0.692837,0.95888,0.645801,1.13127,0.977477,0.540126,0.132046,0.602137,0.732511,0.0813225,0.322068,0.251299,0.467803,1.13153,0.587775,1.51492,0.627714,1.02318,0.909252,0.633534,0.657374,0.799077,0.978041,1.28325,0.224471,0.214014,1.05738,0.456622,0.574415,0.928583,0.0448568,0.904053,0.0613102,0.238191,0.795697,2.12572,0.278647,0.585131,0.997577,1.19128,0.804567,0.827087,0.256537,0.795168,1.56025,0.726126,1.12326,0.245573,0.476811,0.412014,1.13161,0.252002,0.0207635,1.09088
 
 
 
 
1
  name,unit,source,WOR,EEE,ZWE,ZMB,ZAF,YEM,VNM,VEN,UZB,URY,USA,UKR,TZA,TWN,TTO,TUR,TUN,TKM,TJK,THA,TGO,SYR,SLV,SEN,SVK,SVN,SGP,SWE,SDN,SAU,RUS,SCG,ROU,QAT,PRY,PRT,POL,PAK,PHL,PER,PAN,OMN,NZL,NPL,NOR,NLD,NIC,NGA,NAM,MOZ,MYS,MEX,MLT,MNG,MMR,MKD,MDA,MAR,LBY,LVA,LUX,LTU,LKA,LBN,KAZ,KWT,KOR,PRK,KHM,KGZ,KEN,JPN,JOR,JAM,ITA,ISL,IRN,IRQ,IND,ISR,IRL,IDN,HUN,HTI,HRV,HND,HKG,GTM,GRC,GIB,GHA,GEO,GBR,GAB,FRA,FIN,ETH,ESP,ERI,EGY,EST,ECU,DZA,DOM,DNK,DEU,CZE,CYP,CUB,CRI,COL,CHN,CMR,CHL,CIV,CHE,COG,COD,CAN,BLR,BWA,BRA,BOL,BRN,BEN,BHR,BGR,BEL,BGD,BIH,AZE,AUS,AUT,ARG,AGO,ANT,ARM,ALB,ARE
2
+ adpe,kg eq. Sb,ADEME Base IMPACTS ®,0.0000000737708,0.0000000642317,0.000000109502,0.000000162193,0.0000000862445,0.0000000163908,0.0000000945573,0.000000112811,0.000000103681,0.000000104586,0.0000000985548,0.0000000647907,0.000000132261,0.0000000578088,0.000000064552,0.0000000749765,0.0000000177021,0.000000131822,0.000000152621,0.0000000569593,0.000000134255,0.0000000268396,0.0000000472135,0.0000000470662,0.0000000606109,0.0000000992283,0.0000000198459,0.0000000777062,0.0000000955701,0.0000000134206,0.0000000960312,0.000000132772,0.0000000981761,0.00000001324,0.000000149181,0.0000000341863,0.000000101946,0.0000000842952,0.0000000595304,0.0000000952688,0.0000000790553,0.0000000374073,0.0000000720474,0.000000238273,0.000000127486,0.0000000329318,0.0000000414983,0.0000000621,0.000000128285,0.000000148382,0.000000044938,0.0000000578358,0.000000049475,0.000000176361,0.000000152699,0.000000119873,0.000000110674,0.0000000641089,0.0000000206592,0.000000153757,0.000000105692,0.0000000294596,0.0000000986932,0.0000000182134,0.000000135386,0.0000000141168,0.0000000518017,0.000000117457,0.0000000319202,0.000000181827,0.0000000958533,0.0000000596578,0.0000000147031,0.0000000196047,0.00000005439,0.0000000781905,0.0000000220304,0.0000000404306,0.000000100099,0.0000000610194,0.0000000219257,0.0000000610451,0.0000000644587,0.0000000937057,0.000000153989,0.0000000649373,0.0000000816213,0.0000000803251,0.0000000691645,0.0000000286211,0.000000156003,0.000000137999,0.0000000370973,0.000000113843,0.0000000485798,0.0000000805114,0.000000174161,0.0000000518326,0.0000000512406,0.000000033925,0.0000000990171,0.000000127168,0.0000000216438,0.0000000429285,0.0000000157411,0.0000000878733,0.0000000817565,0.0000000448771,0.0000000299542,0.0000000863908,0.000000122031,0.0000000851552,0.000000146313,0.000000105851,0.0000000949004,0.000000100467,0.000000265575,0.000000174647,0.0000000993179,0.0000000840478,0.0000000866014,0.00000010962,0.0000000969793,0.0000000185641,0.0000000239702,0.0000000135014,0.0000000823611,0.0000000337201,0.0000000394158,0.000000148007,0.000000092567,0.0000000790846,0.000000141124,0.0000000768612,0.000000124074,0.0000000449103,0.0000000854245,0.000000229556,0.0000000141548
3
  pe,MJ,ADPf / (1-%renewable_energy),9.988,12.873,16.122,1.798,11.732,16.250,11.238,15.163,17.367,107.570,11.358,12.936,9.305,11.439,14.289,16.150,12.902,23.300,19.165,10.414,21.978,16.989,13.012,14.516,11.680,12.146,10.477,11.026,29.629,14.058,13.200,14.242,15.585,11.916,0.020,14.153,13.178,16.175,11.120,8.211,16.364,22.306,24.731,0.396,4.952,8.511,24.696,11.279,468.150,0.206,12.268,11.775,19.374,15.114,14.132,19.120,18.429,11.702,19.116,8.249,10.128,21.043,12.116,12.341,13.260,12.753,10.199,32.793,34.655,15.380,68.996,10.718,13.677,14.799,12.656,0.013,15.022,20.372,20.363,10.023,10.706,11.603,11.784,20.167,18.548,15.762,,14.340,14.487,,10.097,10.425,13.579,28.341,11.289,11.275,36.133,12.090,13.289,10.195,16.334,20.908,16.376,12.412,16.824,16.260,12.517,13.118,17.317,45.996,7.312,14.119,10.807,11.348,14.783,11.782,34.147,0.097,11.987,13.194,19.642,9.031,11.587,15.689,14.337,14.036,14.375,10.776,12.935,21.705,12.831,16.908,11.036,10.049,16.972,,13.380,0.201,19.032
4
+ gwp,kg eq. CO2,ADEME Base IMPACTS ®,0.590478,0.509427,0.842811,0.0141304,1.17562,1.06777,0.555572,0.497373,0.81178,0.296953,0.67978,0.646745,0.475635,0.845351,0.933059,0.706988,0.80722,1.38296,0.0426743,0.646174,0.545455,1.08778,0.473128,1.1195,0.309341,0.498523,0.655825,0.0464664,1.12472,0.913677,0.66131,1.07808,0.664245,0.722125,0.241601,0.571172,1.15075,0.748727,0.761317,0.284364,0.53403,1.41292,0.293397,0.0841323,0.023754,0.544803,0.941626,0.693123,0.357253,0.00880732,0.832206,0.739214,1.31149,1.47192,0.48193,1.24074,1.04213,0.933694,1.35361,0.234273,0.490016,0.154229,0.709185,0.883627,1.128,0.885084,0.599585,0.797361,1.41054,0.156039,0.589603,0.540891,0.781372,1.07345,0.621329,0.0194609,0.930385,1.48728,1.58299,0.901842,0.648118,0.875394,0.541558,1.3858,0.535759,0.692837,0.95888,0.645801,1.13127,0.977477,0.540126,0.132046,0.602137,0.732511,0.0813225,0.322068,0.251299,0.467803,1.13153,0.587775,1.51492,0.627714,1.02318,0.909252,0.633534,0.657374,0.799077,0.978041,1.28325,0.224471,0.214014,1.05738,0.456622,0.574415,0.928583,0.0448568,0.904053,0.0613102,0.238191,0.795697,2.12572,0.278647,0.585131,0.997577,1.19128,0.804567,0.827087,0.256537,0.795168,1.56025,0.726126,1.12326,0.245573,0.476811,0.412014,1.13161,0.252002,0.0207635,1.09088
5
+ water_wwf,L/kWh,World Resource Institute Guidance for Calculating Water Use Embedded in Purchased Electricity 2020 ,2216,2705.4,,,,,,,,,386,942,,,,1374,,,,833,,,,,1033,14807,,3777,,,2067,,454,,,1472,216,,,,,,1741,,8285,696,,,,,2472,469,87,,,,,,,7525,1393,3051,,,,,257,,,,,1855,,,3524,,,,2373,,212,1605,1525,,,,,,519,,,,167,,2464,2161,,295,,,765,,,,1374,1419,791,57,,,,606,,458,,8331,,,2850,,,893,,,,,379,621,,,,155,14145,1.291,,,,,0
6
+ water_wcf,L/kWh,World Resource Institute Guidance for Calculating Water Use Embedded in Purchased Electricity 2020,5.04,4.48,,,,,,,,,3.14,2.12,,,,4.92,,,,2.88,,,,,5.79,2.99,,6.02,,,3.44,,7.34,,,9.58,2.5,,,,,,14.95,,6.66,3.44,,,,,1.67,5.3,1.14,,,,,,,2.54,12.79,5.9,,,,,1.89,,,,,2.31,,,4.84,,,,3.44,,1.48,2.27,3.67,,,,,,5.15,,,,2.35,,3.67,4.54,,6.21,,,2.2,,,,3.18,1.93,3.22,1.29,,,,6.02,,10.52,,5.68,,,8.18,,,18.58,,,,,4.62,2.61,,,,4.73,5.72,11.47,,,,,0
7
+
src/electricity_mix.py CHANGED
@@ -2,6 +2,8 @@ from csv import DictReader
2
  import pandas as pd
3
 
4
  PATH = "src/data/electricity_mix.csv"
 
 
5
 
6
  COUNTRY_CODES = [
7
  ("🌎 World", "WOR"),
@@ -145,7 +147,8 @@ COUNTRY_CODES = [
145
  ("🇦🇪 United Arab Emirates", "ARE")
146
  ]
147
 
148
-
 
149
  def find_electricity_mix(code: str):
150
  # TODO: Maybe more optimal to construct database at the beginning of the app
151
  # in the same fashion as find_model
@@ -153,7 +156,7 @@ def find_electricity_mix(code: str):
153
  with open(PATH) as fd:
154
  csv = DictReader(fd)
155
  for row in csv:
156
- res += [float(row[code])]
157
  return res
158
 
159
  def dataframe_electricity_mix(countries: list):
@@ -172,4 +175,5 @@ def dataframe_electricity_mix(countries: list):
172
  index='country',
173
  values='value')
174
 
175
- return df
 
 
2
  import pandas as pd
3
 
4
  PATH = "src/data/electricity_mix.csv"
5
+ #ATTENTION ! Il a deux fichiers avec le même nom, un dans data/electricity_mix.csv et l'autre dans src/data/electricity_mix.csv
6
+ #vérifie que je modifie le bon fichier
7
 
8
  COUNTRY_CODES = [
9
  ("🌎 World", "WOR"),
 
147
  ("🇦🇪 United Arab Emirates", "ARE")
148
  ]
149
 
150
+ #faut que j'acquris plus de données sur ça. on manque des données sur beacoup de pays
151
+ #pour les pays qui manquent des centres de données, comme beaucoup en Afrique, qui mène leurs requêts ?
152
  def find_electricity_mix(code: str):
153
  # TODO: Maybe more optimal to construct database at the beginning of the app
154
  # in the same fashion as find_model
 
156
  with open(PATH) as fd:
157
  csv = DictReader(fd)
158
  for row in csv:
159
+ res += [row[code]]
160
  return res
161
 
162
  def dataframe_electricity_mix(countries: list):
 
175
  index='country',
176
  values='value')
177
 
178
+ return df
179
+
src/expert.py CHANGED
@@ -32,6 +32,8 @@ def expert_mode():
32
  key = 1
33
  )
34
 
 
 
35
  with col2:
36
  model_exp = st.selectbox(
37
  label = 'Model',
@@ -79,15 +81,40 @@ def expert_mode():
79
 
80
  location = st.selectbox('Location', [x[0] for x in COUNTRY_CODES])
81
 
82
- col4, col5, col6 = st.columns(3)
83
 
84
  with col4:
85
- mix_gwp = st.number_input('Electricity mix - GHG emissions [kgCO2eq / kWh]', find_electricity_mix([x[1] for x in COUNTRY_CODES if x[0] ==location][0])[2], format="%0.6f")
 
86
  #disp_ranges = st.toggle('Display impact ranges', False)
 
 
 
 
 
87
  with col5:
88
- mix_adpe = st.number_input('Electricity mix - Abiotic resources [kgSbeq / kWh]', find_electricity_mix([x[1] for x in COUNTRY_CODES if x[0] ==location][0])[0], format="%0.13f")
 
 
 
 
 
 
 
89
  with col6:
90
- mix_pe = st.number_input('Electricity mix - Primary energy [MJ / kWh]', find_electricity_mix([x[1] for x in COUNTRY_CODES if x[0] ==location][0])[1], format="%0.3f")
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
  impacts = compute_llm_impacts(model_active_parameter_count=active_params,
93
  model_total_parameter_count=total_params,
@@ -95,7 +122,9 @@ def expert_mode():
95
  request_latency=100000,
96
  if_electricity_mix_gwp=mix_gwp,
97
  if_electricity_mix_adpe=mix_adpe,
98
- if_electricity_mix_pe=mix_pe
 
 
99
  )
100
 
101
  impacts, usage, embodied = format_impacts(impacts)
@@ -104,7 +133,7 @@ def expert_mode():
104
 
105
  st.markdown('<h3 align="center">Environmental Impacts</h2>', unsafe_allow_html = True)
106
 
107
- display_impacts(impacts)
108
 
109
  with st.expander('⚖️ Usage vs Embodied'):
110
 
@@ -121,9 +150,11 @@ def expert_mode():
121
  names = ['usage', 'embodied'],
122
  title = 'GHG emissions',
123
  color_discrete_sequence=["#00BF63", "#0B3B36"],
124
- width = 100
125
  )
126
- fig_gwp.update_layout(showlegend=False, title_x=0.5)
 
 
127
 
128
  st.plotly_chart(fig_gwp)
129
 
@@ -133,10 +164,11 @@ def expert_mode():
133
  names = ['usage', 'embodied'],
134
  title = 'Abiotic depletion',
135
  color_discrete_sequence=["#0B3B36","#00BF63"],
136
- width = 100)
 
137
  fig_adpe.update_layout(
138
  showlegend=False,
139
- title_x=0.5)
140
 
141
  st.plotly_chart(fig_adpe)
142
 
@@ -146,8 +178,11 @@ def expert_mode():
146
  names = ['usage', 'embodied'],
147
  title = 'Primary energy',
148
  color_discrete_sequence=["#00BF63", "#0B3B36"],
149
- width = 100)
150
- fig_pe.update_layout(showlegend=False, title_x=0.5)
 
 
 
151
 
152
  st.plotly_chart(fig_pe)
153
 
@@ -165,23 +200,59 @@ def expert_mode():
165
 
166
  df_comp = dataframe_electricity_mix(countries_to_compare)
167
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
168
  impact_type = st.selectbox(
169
  label='Select an impact type to compare',
170
- options=[x for x in df_comp.columns if x!='country'],
171
- index=1)
 
 
 
172
 
173
- df_comp.sort_values(by = impact_type, inplace = True)
174
 
175
  fig_2 = px.bar(
176
  df_comp,
177
  x = df_comp.index,
178
- y = impact_type,
179
- text = impact_type,
180
- color = impact_type
181
  )
182
 
183
  st.plotly_chart(fig_2)
184
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  except:
186
 
187
  st.warning("Can't display chart with no values.")
 
32
  key = 1
33
  )
34
 
35
+ provider_selected = st.session_state[1].lower()
36
+
37
  with col2:
38
  model_exp = st.selectbox(
39
  label = 'Model',
 
81
 
82
  location = st.selectbox('Location', [x[0] for x in COUNTRY_CODES])
83
 
84
+ col4, col5 = st.columns(2)
85
 
86
  with col4:
87
+ try:
88
+ mix_gwp = st.number_input('Electricity mix - GHG emissions [kgCO2eq / kWh]', float(find_electricity_mix([x[1] for x in COUNTRY_CODES if x[0] ==location][0])[2]), format="%0.6f")
89
  #disp_ranges = st.toggle('Display impact ranges', False)
90
+
91
+ except:
92
+ mix_gwp = st.number_input('Electricity mix - GHG emissions [kgCO2eq / kWh]', float(find_electricity_mix(["WOR"][0])[2]), format="%0.6f")
93
+ st.warning(f"Lacking data on {location}, showing global average data.")
94
+
95
  with col5:
96
+ try:
97
+ mix_adpe = st.number_input('Electricity mix - Abiotic resources [kgSbeq / kWh]', float(find_electricity_mix([x[1] for x in COUNTRY_CODES if x[0] ==location][0])[0]), format="%0.13f")
98
+ except:
99
+ mix_adpe = st.number_input('Electricity mix - Abiotic resources [kgSbeq / kWh]', float(find_electricity_mix(["WOR"][0])[0]), format="%0.13f")
100
+ st.warning(f"Lacking data on {location}, showing global average data.")
101
+
102
+ col6, col7 = st.columns(2)
103
+
104
  with col6:
105
+ try:
106
+ mix_pe = st.number_input('Electricity mix - Primary energy [MJ / kWh]', float(find_electricity_mix([x[1] for x in COUNTRY_CODES if x[0] ==location][0])[1]), format="%0.3f")
107
+ except:
108
+ mix_pe = st.number_input('Electricity mix - Primary energy [MJ / kWh]', float(find_electricity_mix(["WOR"][0])[1]), format="%0.3f")
109
+ st.warning(f"Lacking data on {location}, showing global average data.")
110
+
111
+ with col7:
112
+ try:
113
+ mix_water = st.number_input('Electricity mix - Water consumption factor [L / kWh]', float(find_electricity_mix([x[1] for x in COUNTRY_CODES if x[0] ==location][0])[4]), format="%0.3f")
114
+ except:
115
+ mix_water = st.number_input('Electricity mix - Water consumption factor [L / kWh]', float(find_electricity_mix(["WOR"][0])[4]), format="%0.3f")
116
+ st.warning(f"Lacking data on {location}, showing global average data.")
117
+
118
 
119
  impacts = compute_llm_impacts(model_active_parameter_count=active_params,
120
  model_total_parameter_count=total_params,
 
122
  request_latency=100000,
123
  if_electricity_mix_gwp=mix_gwp,
124
  if_electricity_mix_adpe=mix_adpe,
125
+ if_electricity_mix_pe=mix_pe,
126
+ if_electricity_mix_wcf=mix_water,
127
+ provider = provider_selected
128
  )
129
 
130
  impacts, usage, embodied = format_impacts(impacts)
 
133
 
134
  st.markdown('<h3 align="center">Environmental Impacts</h2>', unsafe_allow_html = True)
135
 
136
+ display_impacts(impacts, provider_exp, location)
137
 
138
  with st.expander('⚖️ Usage vs Embodied'):
139
 
 
150
  names = ['usage', 'embodied'],
151
  title = 'GHG emissions',
152
  color_discrete_sequence=["#00BF63", "#0B3B36"],
153
+ width = 400
154
  )
155
+ fig_gwp.update_layout(
156
+ showlegend=False,
157
+ title_x=0.25)
158
 
159
  st.plotly_chart(fig_gwp)
160
 
 
164
  names = ['usage', 'embodied'],
165
  title = 'Abiotic depletion',
166
  color_discrete_sequence=["#0B3B36","#00BF63"],
167
+ width = 400
168
+ )
169
  fig_adpe.update_layout(
170
  showlegend=False,
171
+ title_x=0.25)
172
 
173
  st.plotly_chart(fig_adpe)
174
 
 
178
  names = ['usage', 'embodied'],
179
  title = 'Primary energy',
180
  color_discrete_sequence=["#00BF63", "#0B3B36"],
181
+ width = 400
182
+ )
183
+ fig_pe.update_layout(
184
+ showlegend=False,
185
+ title_x=0.25)
186
 
187
  st.plotly_chart(fig_pe)
188
 
 
200
 
201
  df_comp = dataframe_electricity_mix(countries_to_compare)
202
 
203
+
204
+ impact_metrices = [
205
+ "Abiotic Depletion Potential for Elements (Kilograms of antimony equivalent)",
206
+ "Primary energy demand (Megajoules)",
207
+ "Global Warming Potential (Kilograms of CO2 equivalent)",
208
+ "Water Withdrawal Factor (Liters/Kilowatt-hour)",
209
+ "Water Consumption Factor (Liters/Kilowatt-hour)"
210
+ ]
211
+
212
+ impact_labels = {
213
+ impact_metrices[0] : "adpe (kg eq. Sb)",
214
+ impact_metrices[1] : "pe (MJ)",
215
+ impact_metrices[2] : "gwp (kg eq. CO2)",
216
+ impact_metrices[3] : "water_wwf (L/kWh)",
217
+ impact_metrices[4] : "water_wcf (L/kWh)"
218
+ }
219
+
220
  impact_type = st.selectbox(
221
  label='Select an impact type to compare',
222
+ options=[x for x in impact_labels], # les noms affichés à l'utilisateur
223
+ index=1
224
+ )
225
+
226
+ impact_type_used = impact_labels[impact_type]
227
 
228
+ df_comp.sort_values(by = impact_type_used, inplace = True)
229
 
230
  fig_2 = px.bar(
231
  df_comp,
232
  x = df_comp.index,
233
+ y = impact_type_used,
234
+ text = impact_type_used,
235
+ color = impact_type_used
236
  )
237
 
238
  st.plotly_chart(fig_2)
239
 
240
+ impact_explanations = {
241
+ impact_metrices[0]:
242
+ "Measures the depletion of non-renewable resources (metals, minerals), expressed in kg of antimony equivalent (Sb). \
243
+ The enviornmental impact equates to that amount of antimony being extracted.",
244
+ impact_metrices[1]:
245
+ "Total amount of primary energy used (both renewable and non-renewable), expressed in megajoules (MJ).",
246
+ impact_metrices[2]:
247
+ "Potential contribution to climate change over a 100-year time horizon, expressed in kilograms of CO₂ equivalent.",
248
+ impact_metrices[3]:
249
+ "Total volume of water withdrawn throughout the process, expressed in liters (L).",
250
+ impact_metrices[4]:
251
+ "Volume of water actually consumed (not returned to the source), expressed in liters (L)."
252
+ }
253
+
254
+ st.info(impact_explanations[impact_type])
255
+
256
  except:
257
 
258
  st.warning("Can't display chart with no values.")
src/impacts.py CHANGED
@@ -7,9 +7,16 @@ from src.utils import (
7
  format_energy_eq_physical_activity,
8
  format_gwp_eq_airplane_paris_nyc,
9
  format_gwp_eq_streaming,
 
 
10
  PhysicalActivity,
11
- EnergyProduction
 
 
 
12
  )
 
 
13
 
14
  ############################################################################################################
15
 
@@ -20,40 +27,83 @@ def get_impacts(model, active_params, total_params, mix_ghg, mix_adpe, mix_pe):
20
  ############################################################################################################
21
 
22
 
23
- def display_impacts(impacts):
24
 
25
  st.divider()
26
 
27
  col_energy, col_ghg, col_adpe, col_pe, col_water = st.columns(5)
28
 
29
  with col_energy:
30
- st.markdown('<h4 align="center">⚡️ Energy</h4>', unsafe_allow_html = True)
 
 
 
 
 
31
  st.latex(f'\Large {impacts.energy.magnitude:.3g} \ \large {impacts.energy.units}')
32
- st.markdown(f'<p align="center"><i>Evaluates the electricity consumption<i></p>', unsafe_allow_html = True)
 
 
 
 
33
 
34
  with col_ghg:
35
- st.markdown('<h4 align="center">🌍️ GHG Emissions</h4>', unsafe_allow_html = True)
 
 
 
 
 
36
  st.latex(f'\Large {impacts.gwp.magnitude:.3g} \ \large {impacts.gwp.units}')
37
- st.markdown(f'<p align="center"><i>Evaluates the effect on global warming<i></p>', unsafe_allow_html = True)
 
 
 
38
 
39
  with col_adpe:
40
- st.markdown('<h4 align="center">🪨 Abiotic Resources</h4>', unsafe_allow_html = True)
 
 
 
 
 
41
  st.latex(f'\Large {impacts.adpe.magnitude:.3g} \ \large {impacts.adpe.units}')
42
- st.markdown(f'<p align="center"><i>Evaluates the use of metals and minerals<i></p>', unsafe_allow_html = True)
 
 
 
43
 
44
  with col_pe:
45
- st.markdown('<h4 align="center">⛽️ Primary Energy</h4>', unsafe_allow_html = True)
 
 
 
 
 
46
  st.latex(f'\Large {impacts.pe.magnitude:.3g} \ \large {impacts.pe.units}')
47
- st.markdown(f'<p align="center"><i>Evaluates the use of energy resources<i></p>', unsafe_allow_html = True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
- with col_water:
50
- st.markdown('<h4 align="center">🚰 Water</h4>', unsafe_allow_html = True)
51
- st.latex('\Large Upcoming...')
52
- st.markdown(f'<p align="center"><i>Evaluates the use of water<i></p>', unsafe_allow_html = True)
53
 
54
  ############################################################################################################
55
 
56
- def display_equivalent(impacts):
57
 
58
  st.divider()
59
 
@@ -61,39 +111,69 @@ def display_equivalent(impacts):
61
 
62
  streaming_eq = format_gwp_eq_streaming(impacts.gwp)
63
 
64
- col1, col2, col3 = st.columns(3)
65
 
66
  with col1:
67
  physical_activity, distance = format_energy_eq_physical_activity(impacts.energy)
68
  if physical_activity == PhysicalActivity.WALKING:
69
- physical_activity = "🚶 " + physical_activity.capitalize()
 
70
  if physical_activity == PhysicalActivity.RUNNING:
71
- physical_activity = "🏃 " + physical_activity.capitalize()
72
-
73
- st.markdown(f'<h4 align="center">{physical_activity}</h4>', unsafe_allow_html = True)
 
 
 
 
 
 
74
  st.latex(f'\Large {distance.magnitude:.3g} \ \large {distance.units}')
75
  st.markdown(f'<p align="center"><i>Based on energy consumption<i></p>', unsafe_allow_html = True)
76
 
77
  with col2:
78
  ev_eq = format_energy_eq_electric_vehicle(impacts.energy)
79
- st.markdown(f'<h4 align="center">🔋 Electric Vehicle</h4>', unsafe_allow_html = True)
 
 
 
 
 
80
  st.latex(f'\Large {ev_eq.magnitude:.3g} \ \large {ev_eq.units}')
81
  st.markdown(f'<p align="center"><i>Based on energy consumption<i></p>', unsafe_allow_html = True)
82
 
83
  with col3:
84
  streaming_eq = format_gwp_eq_streaming(impacts.gwp)
85
- st.markdown(f'<h4 align="center">⏯️ Streaming</h4>', unsafe_allow_html = True)
 
 
 
 
 
86
  st.latex(f'\Large {streaming_eq.magnitude:.3g} \ \large {streaming_eq.units}')
87
  st.markdown(f'<p align="center"><i>Based on GHG emissions<i></p>', unsafe_allow_html = True)
88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
  st.divider()
90
 
91
  st.markdown('<h3 align="center">What if 1% of the planet does this request everyday for 1 year ?</h3>', unsafe_allow_html = True)
92
  st.markdown('<p align="center">If this use case is largely deployed around the world, the equivalent impacts would be the impacts of this request x 1% of 8 billion people x 365 days in a year.</p>', unsafe_allow_html = True)
93
 
94
- col4, col5, col6 = st.columns(3)
95
 
96
- with col4:
97
 
98
  electricity_production, count = format_energy_eq_electricity_production(impacts.energy)
99
  if electricity_production == EnergyProduction.NUCLEAR:
@@ -102,15 +182,21 @@ def display_equivalent(impacts):
102
  if electricity_production == EnergyProduction.WIND:
103
  emoji = "💨️ "
104
  name = "Wind turbines"
105
- st.markdown(f'<h4 align="center">{emoji} {count.magnitude:.0f} {name} (yearly)</h4>', unsafe_allow_html = True)
106
  st.markdown(f'<p align="center"><i>Based on energy consumption<i></p>', unsafe_allow_html = True)
107
 
108
- with col5:
109
  ireland_count = format_energy_eq_electricity_consumption_ireland(impacts.energy)
110
- st.markdown(f'<h4 align="center">🇮🇪 {ireland_count.magnitude:.3f} x Ireland <span style="font-size: 12px">(yearly ⚡️ cons.)</span></h2></h4>', unsafe_allow_html = True)
111
  st.markdown(f'<p align="center"><i>Based on energy consumption<i></p>', unsafe_allow_html = True)
112
 
113
- with col6:
114
  paris_nyc_airplane = format_gwp_eq_airplane_paris_nyc(impacts.gwp)
115
  st.markdown(f'<h4 align="center">✈️ {round(paris_nyc_airplane.magnitude):,} Paris ↔ NYC</h4>', unsafe_allow_html = True)
116
- st.markdown(f'<p align="center"><i>Based on GHG emissions<i></p>', unsafe_allow_html = True)
 
 
 
 
 
 
 
7
  format_energy_eq_physical_activity,
8
  format_gwp_eq_airplane_paris_nyc,
9
  format_gwp_eq_streaming,
10
+ format_water_eq_bottled_waters,
11
+ format_water_eq_olympic_sized_swimming_pool,
12
  PhysicalActivity,
13
+ EnergyProduction,
14
+ AI_COMPANY_TO_DATA_CENTER_PROVIDER,
15
+ PROVIDER_PUE,
16
+ PROVIDER_WUE_ONSITE
17
  )
18
+ from src.electricity_mix import COUNTRY_CODES, find_electricity_mix, dataframe_electricity_mix
19
+
20
 
21
  ############################################################################################################
22
 
 
27
  ############################################################################################################
28
 
29
 
30
+ def display_impacts(impacts, provider, location):
31
 
32
  st.divider()
33
 
34
  col_energy, col_ghg, col_adpe, col_pe, col_water = st.columns(5)
35
 
36
  with col_energy:
37
+ st.markdown("""
38
+ <div style="text-align: center;">
39
+ <div style="font-size: 30px;">⚡️</div>
40
+ <div style="font-size: 25px;">Energy</div>
41
+ </div>
42
+ """, unsafe_allow_html = True)
43
  st.latex(f'\Large {impacts.energy.magnitude:.3g} \ \large {impacts.energy.units}')
44
+ st.markdown("""
45
+ <div style="height: 10px;"></div>
46
+ <div style="text-align: center;"><i>Evaluates the electricity consumption<i>
47
+ </div>
48
+ """, unsafe_allow_html = True)
49
 
50
  with col_ghg:
51
+ st.markdown("""
52
+ <div style="text-align: center;">
53
+ <div style="font-size: 30px;">🌍️</div>
54
+ <div style="font-size: 18px;">GHG Emissions</div>
55
+ </div>
56
+ """, unsafe_allow_html = True)
57
  st.latex(f'\Large {impacts.gwp.magnitude:.3g} \ \large {impacts.gwp.units}')
58
+ st.markdown("""
59
+ <div style="text-align: center;"><i>Evaluates the effect on climate change<i>
60
+ </div>
61
+ """, unsafe_allow_html = True)
62
 
63
  with col_adpe:
64
+ st.markdown("""
65
+ <div style="text-align: center;">
66
+ <div style="font-size: 30px;">🪨</div>
67
+ <div style="font-size: 16px;">Abiotic Resources</div>
68
+ </div>
69
+ """, unsafe_allow_html = True)
70
  st.latex(f'\Large {impacts.adpe.magnitude:.3g} \ \large {impacts.adpe.units}')
71
+ st.markdown("""
72
+ <div style="text-align: center;"><i>Evaluates the use of metals and minerals<i>
73
+ </div>
74
+ """, unsafe_allow_html = True)
75
 
76
  with col_pe:
77
+ st.markdown("""
78
+ <div style="text-align: center;">
79
+ <div style="font-size: 30px;">⛽️</div>
80
+ <div style="font-size: 18px;">Primary Energy</div>
81
+ </div>
82
+ """, unsafe_allow_html = True)
83
  st.latex(f'\Large {impacts.pe.magnitude:.3g} \ \large {impacts.pe.units}')
84
+ st.markdown("""
85
+ <div style="height: 10px;"></div>
86
+ <div style="text-align: center;"><i>Evaluates the use of energy resources<i>
87
+ </div>
88
+ """, unsafe_allow_html = True)
89
+
90
+ with col_water:
91
+ st.markdown("""
92
+ <div style="text-align: center;">
93
+ <div style="font-size: 30px;">🚰</div>
94
+ <div style="font-size: 25px;">Water</div>
95
+ </div>
96
+ """, unsafe_allow_html = True)
97
+ st.latex(f'\Large {impacts.water.magnitude:.3g} \ \large {impacts.water.units}')
98
+ st.markdown("""
99
+ <div style="text-align: center;"><i>Evaluates the use of water<i>
100
+ </div>
101
+ """, unsafe_allow_html = True)
102
 
 
 
 
 
103
 
104
  ############################################################################################################
105
 
106
+ def display_equivalent(impacts, provider, location):
107
 
108
  st.divider()
109
 
 
111
 
112
  streaming_eq = format_gwp_eq_streaming(impacts.gwp)
113
 
114
+ col1, col2, col3, col4 = st.columns(4)
115
 
116
  with col1:
117
  physical_activity, distance = format_energy_eq_physical_activity(impacts.energy)
118
  if physical_activity == PhysicalActivity.WALKING:
119
+ physical_activity_emoji = "🚶 "
120
+ physical_activity = physical_activity.capitalize()
121
  if physical_activity == PhysicalActivity.RUNNING:
122
+ physical_activity_emoji = "🏃 "
123
+ physical_activity = physical_activity.capitalize()
124
+
125
+ st.markdown(f"""
126
+ <div style="text-align: center;">
127
+ <div style="font-size: 30px;">{physical_activity_emoji}</div>
128
+ <div style="font-size: 25px;">{physical_activity}</div>
129
+ </div>
130
+ """, unsafe_allow_html = True)
131
  st.latex(f'\Large {distance.magnitude:.3g} \ \large {distance.units}')
132
  st.markdown(f'<p align="center"><i>Based on energy consumption<i></p>', unsafe_allow_html = True)
133
 
134
  with col2:
135
  ev_eq = format_energy_eq_electric_vehicle(impacts.energy)
136
+ st.markdown(f"""
137
+ <div style="text-align: center;">
138
+ <div style="font-size: 30px;">🔋</div>
139
+ <div style="font-size: 22px;">Electric Vehicle</div>
140
+ </div>
141
+ """, unsafe_allow_html = True)
142
  st.latex(f'\Large {ev_eq.magnitude:.3g} \ \large {ev_eq.units}')
143
  st.markdown(f'<p align="center"><i>Based on energy consumption<i></p>', unsafe_allow_html = True)
144
 
145
  with col3:
146
  streaming_eq = format_gwp_eq_streaming(impacts.gwp)
147
+ st.markdown(f"""
148
+ <div style="text-align: center;">
149
+ <div style="font-size: 30px;">⏯️</div>
150
+ <div style="font-size: 25px;">Streaming</div>
151
+ </div>
152
+ """, unsafe_allow_html = True)
153
  st.latex(f'\Large {streaming_eq.magnitude:.3g} \ \large {streaming_eq.units}')
154
  st.markdown(f'<p align="center"><i>Based on GHG emissions<i></p>', unsafe_allow_html = True)
155
 
156
+ with col4:
157
+ #water = water_impact(impacts, provider, location)
158
+ water_eq = format_water_eq_bottled_waters(impacts.water)
159
+ st.markdown(f"""
160
+ <div style="text-align: center;">
161
+ <div style="font-size: 30px;">🚰</div>
162
+ <div style="font-size: 25px;">Bottled Waters</div>
163
+ </div>
164
+ """, unsafe_allow_html = True)
165
+ st.latex(f'\Large {water_eq.magnitude:.3g} \ \large {"bottles"}')
166
+ st.markdown(f'<p align="center"><i>Based on water consumption, measured in 0.75 L bottles.<i></p>', unsafe_allow_html = True)
167
+
168
+
169
  st.divider()
170
 
171
  st.markdown('<h3 align="center">What if 1% of the planet does this request everyday for 1 year ?</h3>', unsafe_allow_html = True)
172
  st.markdown('<p align="center">If this use case is largely deployed around the world, the equivalent impacts would be the impacts of this request x 1% of 8 billion people x 365 days in a year.</p>', unsafe_allow_html = True)
173
 
174
+ col5, col6, col7, col8 = st.columns(4)
175
 
176
+ with col5:
177
 
178
  electricity_production, count = format_energy_eq_electricity_production(impacts.energy)
179
  if electricity_production == EnergyProduction.NUCLEAR:
 
182
  if electricity_production == EnergyProduction.WIND:
183
  emoji = "💨️ "
184
  name = "Wind turbines"
185
+ st.markdown(f'<h4 align="center">{emoji} {count.magnitude:.0f} {name} <span style="font-size: 12px">\n (yearly ⚡️ production)</span></h2></h4>', unsafe_allow_html = True)
186
  st.markdown(f'<p align="center"><i>Based on energy consumption<i></p>', unsafe_allow_html = True)
187
 
188
+ with col6:
189
  ireland_count = format_energy_eq_electricity_consumption_ireland(impacts.energy)
190
+ st.markdown(f'<h4 align="center">🇮🇪 {ireland_count.magnitude:.3f} x Irelands <span style="font-size: 12px">\n (yearly ⚡️ consumption)</span></h2></h4>', unsafe_allow_html = True)
191
  st.markdown(f'<p align="center"><i>Based on energy consumption<i></p>', unsafe_allow_html = True)
192
 
193
+ with col7:
194
  paris_nyc_airplane = format_gwp_eq_airplane_paris_nyc(impacts.gwp)
195
  st.markdown(f'<h4 align="center">✈️ {round(paris_nyc_airplane.magnitude):,} Paris ↔ NYC</h4>', unsafe_allow_html = True)
196
+ st.markdown(f'<p align="center"><i>Based on GHG emissions<i></p>', unsafe_allow_html = True)
197
+
198
+ with col8:
199
+ olympic_swimming_pool = format_water_eq_olympic_sized_swimming_pool(impacts.water)
200
+ st.markdown(f'<div style="text-align: center; font-size: 20px; font-weight: bold;">🏊🏼 {round(olympic_swimming_pool.magnitude):,} Olympic-sized swimming pools</h4>', unsafe_allow_html = True)
201
+ st.markdown(f'<p align="center"><i>Based on water consumption<i></p>', unsafe_allow_html = True)
202
+
src/models.py CHANGED
@@ -15,9 +15,13 @@ def clean_models_data(df, with_filter = True):
15
  'cohere': 'Cohere',
16
  'microsoft': 'Microsoft',
17
  'mistral-community': 'Mistral Community',
18
- 'databricks': 'Databricks'
 
 
19
  }
20
 
 
 
21
  models_to_keep = MAIN_MODELS
22
 
23
  df.drop('type', axis=1, inplace=True)
 
15
  'cohere': 'Cohere',
16
  'microsoft': 'Microsoft',
17
  'mistral-community': 'Mistral Community',
18
+ 'databricks': 'Databricks',
19
+ "azureopenai" : "Microsoft", #présent dans ecologits mais pas ici. traité comme Openai
20
+ "huggingfacehub" : "AWS" #présent dans ecologits mais pas ici. traité comme Openai
21
  }
22
 
23
+
24
+
25
  models_to_keep = MAIN_MODELS
26
 
27
  df.drop('type', axis=1, inplace=True)
src/utils.py CHANGED
@@ -2,7 +2,7 @@ from dataclasses import dataclass
2
  from enum import Enum
3
 
4
  from ecologits.model_repository import models
5
- from ecologits.impacts.modeling import Impacts, Energy, GWP, ADPe, PE
6
  #from ecologits.tracers.utils import llm_impacts
7
  from pint import UnitRegistry, Quantity
8
 
@@ -27,6 +27,9 @@ u.define('km = kilometer')
27
  u.define('s = second')
28
  u.define('min = minute')
29
  u.define('h = hour')
 
 
 
30
  q = u.Quantity
31
 
32
  @dataclass
@@ -35,6 +38,7 @@ class QImpacts:
35
  gwp: Quantity
36
  adpe: Quantity
37
  pe: Quantity
 
38
 
39
 
40
  class PhysicalActivity(str, Enum):
@@ -69,6 +73,8 @@ EV_ENERGY_EQ = q("0.17 kWh / km")
69
  # From https://impactco2.fr/outils/comparateur?value=1&comparisons=streamingvideo
70
  STREAMING_GWP_EQ = q("15.6 h / kgCO2eq")
71
 
 
 
72
  # From https://ourworldindata.org/population-growth
73
  ONE_PERCENT_WORLD_POPULATION = 80_000_000
74
 
@@ -90,6 +96,57 @@ IRELAND_POPULATION_MILLION = 5
90
  # From https://impactco2.fr/outils/comparateur?value=1&comparisons=&equivalent=avion-pny
91
  AIRPLANE_PARIS_NYC_GWP_EQ = q("177000 kgCO2eq")
92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  #####################################################################################
94
  ### IMPACTS FORMATING
95
  #####################################################################################
@@ -115,6 +172,12 @@ def format_pe(pe: PE) -> Quantity:
115
  val = val.to("kJ")
116
  return val
117
 
 
 
 
 
 
 
118
  def format_impacts(impacts: Impacts) -> QImpacts:
119
 
120
  try:
@@ -122,18 +185,21 @@ def format_impacts(impacts: Impacts) -> QImpacts:
122
  impacts.gwp.value = (impacts.gwp.value.max + impacts.gwp.value.min)/2
123
  impacts.adpe.value = (impacts.adpe.value.max + impacts.adpe.value.min)/2
124
  impacts.pe.value = (impacts.pe.value.max + impacts.pe.value.min)/2
 
125
  return QImpacts(
126
  energy=format_energy(impacts.energy),
127
  gwp=format_gwp(impacts.gwp),
128
  adpe=format_adpe(impacts.adpe),
129
- pe=format_pe(impacts.pe)
 
130
  ), impacts.usage, impacts.embodied
131
  except: #when no range
132
  return QImpacts(
133
  energy=format_energy(impacts.energy),
134
  gwp=format_gwp(impacts.gwp),
135
  adpe=format_adpe(impacts.adpe),
136
- pe=format_pe(impacts.pe)
 
137
  ), impacts.usage, impacts.embodied
138
 
139
  def split_impacts_u_e(impacts: Impacts) -> QImpacts:
@@ -153,7 +219,8 @@ def format_impacts_expert(impacts: Impacts, display_range: bool) -> QImpacts:
153
  energy=format_energy(impacts.energy),
154
  gwp=format_gwp(impacts.gwp),
155
  adpe=format_adpe(impacts.adpe),
156
- pe=format_pe(impacts.pe)
 
157
  ), impacts.usage, impacts.embodied
158
 
159
  else:
@@ -165,7 +232,8 @@ def format_impacts_expert(impacts: Impacts, display_range: bool) -> QImpacts:
165
  energy=format_energy(energy),
166
  gwp=format_gwp(gwp),
167
  adpe=format_adpe(adpe),
168
- pe=format_pe(pe)
 
169
  ), impacts.usage, impacts.embodied
170
 
171
  #####################################################################################
@@ -199,6 +267,11 @@ def format_gwp_eq_streaming(gwp: Quantity) -> Quantity:
199
  streaming_eq = streaming_eq.to("s")
200
  return streaming_eq
201
 
 
 
 
 
 
202
  def format_energy_eq_electricity_production(energy: Quantity) -> tuple[EnergyProduction, Quantity]:
203
  electricity_eq = energy * ONE_PERCENT_WORLD_POPULATION * DAYS_IN_YEAR
204
  electricity_eq = electricity_eq.to("TWh")
@@ -216,4 +289,15 @@ def format_energy_eq_electricity_consumption_ireland(energy: Quantity) -> Quanti
216
  def format_gwp_eq_airplane_paris_nyc(gwp: Quantity) -> Quantity:
217
  gwp_eq = gwp * ONE_PERCENT_WORLD_POPULATION * DAYS_IN_YEAR
218
  gwp_eq = gwp_eq.to("kgCO2eq")
219
- return gwp_eq / AIRPLANE_PARIS_NYC_GWP_EQ####################################################################################### MODELS PARAMETER####################################################################################
 
 
 
 
 
 
 
 
 
 
 
 
2
  from enum import Enum
3
 
4
  from ecologits.model_repository import models
5
+ from ecologits.impacts.modeling import Impacts, Energy, GWP, ADPe, PE, Water
6
  #from ecologits.tracers.utils import llm_impacts
7
  from pint import UnitRegistry, Quantity
8
 
 
27
  u.define('s = second')
28
  u.define('min = minute')
29
  u.define('h = hour')
30
+ u.define('L = liter')
31
+ u.define('mL = milliliter')
32
+ #u.define('bottled waters = bottled waters')
33
  q = u.Quantity
34
 
35
  @dataclass
 
38
  gwp: Quantity
39
  adpe: Quantity
40
  pe: Quantity
41
+ water: Quantity
42
 
43
 
44
  class PhysicalActivity(str, Enum):
 
73
  # From https://impactco2.fr/outils/comparateur?value=1&comparisons=streamingvideo
74
  STREAMING_GWP_EQ = q("15.6 h / kgCO2eq")
75
 
76
+ BOTTLED_WATERS_EQ = q("0.75 L")
77
+
78
  # From https://ourworldindata.org/population-growth
79
  ONE_PERCENT_WORLD_POPULATION = 80_000_000
80
 
 
96
  # From https://impactco2.fr/outils/comparateur?value=1&comparisons=&equivalent=avion-pny
97
  AIRPLANE_PARIS_NYC_GWP_EQ = q("177000 kgCO2eq")
98
 
99
+ # From https://www.patagoniaalliance.org/wp-content/uploads/2014/08/How-much-water-does-an-Olympic-sized-swimming-pool-hold.pdf
100
+ OLYMPIC_SWIMMING_POOL = q("2500000 L") #2.5 million
101
+
102
+ # From https://docs.google.com/spreadsheets/d/1uj8yA601uBtJ7GSf7k96Lv1NoQBfsCnVmTCII2HgZvo/edit?gid=0#gid=0
103
+ # Google : https://www.gstatic.com/gumdrop/sustainability/google-2025-environmental-report.pdf
104
+ # Meta: https://sustainability.atmeta.com/wp-content/uploads/2024/08/Meta-2024-Sustainability-Report.pdf
105
+ # Microsoft: https://azure.microsoft.com/en-us/blog/how-microsoft-measures-datacenter-water-and-energy-use-to-improve-azure-cloud-sustainability/
106
+ # OVHCloud: https://corporate.ovhcloud.com/en/sustainability/environment/
107
+ # Scaleway: https://www-uploads.scaleway.com/Impact_Report2024_A4_EN_e63efcae20.pdf
108
+ # AWS: https://sustainability.aboutamazon.com/2023-report
109
+ # Equinix: https://www.equinix.com/resources/infopapers/2023-corporate-sustainability-report
110
+ PROVIDER_WUE_ONSITE = { #Water use efficiency on-site, as opposed to off-site generated energy
111
+ "Google" : 0.916,
112
+ "Meta": 0.18, # L/kWh, 2023
113
+ "Microsoft": 0.49, #2022
114
+ "OVHCloud": 0.37, #2024
115
+ "Scaleway": 0.216, #2023
116
+ "AWS" : 0.18, #2023
117
+ "Equinix" : 1.07 #2023
118
+ }
119
+
120
+
121
+ # Google https://www.gstatic.com/gumdrop/sustainability/google-2025-environmental-report.pdf
122
+ # Meta https://sustainability.atmeta.com/data-centers/#:~:text=Meta's%20operational%20data%20centers%2C%20on,Effectiveness%20(WUE)%20of%200.20.
123
+ # Microsoft https://azure.microsoft.com/en-us/blog/how-microsoft-measures-datacenter-water-and-energy-use-to-improve-azure-cloud-sustainability/
124
+ # OVHCloud https://corporate.ovhcloud.com/en/sustainability/environment/
125
+ # Scaleway https://www-uploads.scaleway.com/Impact_Report2024_A4_EN_e63efcae20.pdf
126
+ # AWS https://sustainability.aboutamazon.com/products-services/aws-cloud
127
+ # Equinix https://www.equinix.com/content/dam/eqxcorp/en_us/documents/resources/infopapers/ip_2023_sustainability_en.pdf
128
+ PROVIDER_PUE = { #Power use efficiency
129
+ "Google" : 1.09,
130
+ "Meta" : 1.09,
131
+ "Microsoft" : 1.18,
132
+ "OVHCloud" : 1.26,
133
+ "Scaleway" : 1.37,
134
+ "AWS" : 1.15,
135
+ "Equinix" : 1.42
136
+ }
137
+
138
+ AI_COMPANY_TO_DATA_CENTER_PROVIDER = { #A list that draws the connection between AI companies and their data center providers
139
+ "anthropic" : "Google",
140
+ "mistralai" : "OVHCloud",
141
+ "cohere" : "AWS",
142
+ "databricks" : "Microsoft",
143
+ "meta" : "Meta",
144
+ "google" : "Google",
145
+ "microsoft" : "Microsoft",
146
+ "openai" : "Microsoft"
147
+ }
148
+
149
+
150
  #####################################################################################
151
  ### IMPACTS FORMATING
152
  #####################################################################################
 
172
  val = val.to("kJ")
173
  return val
174
 
175
+ def format_water(water: Water) -> Quantity:
176
+ val = q(water.value, water.unit)
177
+ if val < q("1 L"):
178
+ val = val.to("mL")
179
+ return val
180
+
181
  def format_impacts(impacts: Impacts) -> QImpacts:
182
 
183
  try:
 
185
  impacts.gwp.value = (impacts.gwp.value.max + impacts.gwp.value.min)/2
186
  impacts.adpe.value = (impacts.adpe.value.max + impacts.adpe.value.min)/2
187
  impacts.pe.value = (impacts.pe.value.max + impacts.pe.value.min)/2
188
+ impacts.water.value = (impacts.water.value.max + impacts.water.value.min)/2
189
  return QImpacts(
190
  energy=format_energy(impacts.energy),
191
  gwp=format_gwp(impacts.gwp),
192
  adpe=format_adpe(impacts.adpe),
193
+ pe=format_pe(impacts.pe),
194
+ water=format_water(impacts.water)
195
  ), impacts.usage, impacts.embodied
196
  except: #when no range
197
  return QImpacts(
198
  energy=format_energy(impacts.energy),
199
  gwp=format_gwp(impacts.gwp),
200
  adpe=format_adpe(impacts.adpe),
201
+ pe=format_pe(impacts.pe),
202
+ water=format_water(impacts.water)
203
  ), impacts.usage, impacts.embodied
204
 
205
  def split_impacts_u_e(impacts: Impacts) -> QImpacts:
 
219
  energy=format_energy(impacts.energy),
220
  gwp=format_gwp(impacts.gwp),
221
  adpe=format_adpe(impacts.adpe),
222
+ pe=format_pe(impacts.pe),
223
+ water=format_water(impacts.water)
224
  ), impacts.usage, impacts.embodied
225
 
226
  else:
 
232
  energy=format_energy(energy),
233
  gwp=format_gwp(gwp),
234
  adpe=format_adpe(adpe),
235
+ pe=format_pe(pe),
236
+ water=format_water(impacts.water)
237
  ), impacts.usage, impacts.embodied
238
 
239
  #####################################################################################
 
267
  streaming_eq = streaming_eq.to("s")
268
  return streaming_eq
269
 
270
+ def format_water_eq_bottled_waters(water: Quantity) -> Quantity:
271
+ water = water.to("L")
272
+ bottled_water_eq = water / BOTTLED_WATERS_EQ
273
+ return bottled_water_eq
274
+
275
  def format_energy_eq_electricity_production(energy: Quantity) -> tuple[EnergyProduction, Quantity]:
276
  electricity_eq = energy * ONE_PERCENT_WORLD_POPULATION * DAYS_IN_YEAR
277
  electricity_eq = electricity_eq.to("TWh")
 
289
  def format_gwp_eq_airplane_paris_nyc(gwp: Quantity) -> Quantity:
290
  gwp_eq = gwp * ONE_PERCENT_WORLD_POPULATION * DAYS_IN_YEAR
291
  gwp_eq = gwp_eq.to("kgCO2eq")
292
+ return gwp_eq / AIRPLANE_PARIS_NYC_GWP_EQ
293
+
294
+ def format_water_eq_olympic_sized_swimming_pool(water: Quantity) -> Quantity:
295
+ water_eq = water * ONE_PERCENT_WORLD_POPULATION * DAYS_IN_YEAR
296
+ water_eq = water_eq.to("L")
297
+ return water_eq / OLYMPIC_SWIMMING_POOL
298
+
299
+ # def format_water_eq_olympic_sized_swimming_pool(water):
300
+ # water_eq = water * ONE_PERCENT_WORLD_POPULATION * DAYS_IN_YEAR
301
+ # return water_eq / OLYMPIC_SWIMMING_POOL
302
+
303
+ ####################################################################################### MODELS PARAMETER####################################################################################