import{s as Ht,n as It,o as _t}from"../chunks/scheduler.d6170356.js";import{S as xt,i as Bt,g as s,s as i,r as x,A as Gt,h as o,f as n,c as l,j as jt,u as B,x as r,k as Ct,y as Lt,a,v as G,d as L,t as W,w as Y}from"../chunks/index.fcd4cc08.js";import{C as Jt}from"../chunks/CodeBlock.7b16bdef.js";import{H as S}from"../chunks/Heading.8660bd0e.js";function Wt(ct){let m,Z,k,V,c,z,p,Q,u,pt='Training ML models is often energy-intensive and can produce a substantial carbon footprint, as described by <a href="https://arxiv.org/abs/1906.02243" rel="nofollow">Strubell et al.</a>. It’s therefore important to <em>track</em> and <em>report</em> the emissions of models to get a better idea of the environmental impacts of our field.',N,h,F,f,ut="If you can, you should include information about:",X,d,ht='<li>where the model was trained (in terms of location)</li> <li>the hardware used — e.g. GPU, TPU, or CPU, and how many</li> <li>training type: pre-training or fine-tuning</li> <li>the estimated carbon footprint of the model, calculated in real-time with the <a href="https://github.com/mlco2/codecarbon" rel="nofollow">Code Carbon</a> package or after training using the <a href="https://mlco2.github.io/impact/" rel="nofollow">ML CO2 Calculator</a>.</li>',q,y,E,b,ft="You can add the carbon footprint data to the model card metadata (in the README.md file). The structure of the metadata should be:",R,w,A,M,D,g,dt="Considering the computing hardware, location, usage, and training time, you can estimate how much CO<sub>2</sub> the model produced.",O,T,yt="The math is pretty simple! ➕",K,v,bt='First, you take the <em>carbon intensity</em> of the electric grid used for the training — this is how much CO<sub>2</sub> is produced by KwH of electricity used. The carbon intensity depends on the location of the hardware and the <a href="https://electricitymap.org/" rel="nofollow">energy mix</a> used at that location — whether it’s renewable energy like solar 🌞, wind 🌬️ and hydro 💧, or non-renewable energy like coal ⚫ and natural gas 💨. The more renewable energy gets used for training, the less carbon-intensive it is!',tt,U,wt="Then, you take the power consumption of the GPU during training using the <code>pynvml</code> library.",et,$,Mt="Finally, you multiply the power consumption and carbon intensity by the training time of the model, and you have an estimate of the CO<sub>2</sub> emission.",nt,j,gt="Keep in mind that this isn’t an exact number because other factors come into play — like the energy used for data center heating and cooling — which will increase carbon emissions. But this will give you a good idea of the scale of CO<sub>2</sub> emissions that your model is producing!",at,C,Tt="To add <strong>Carbon Emissions</strong> metadata to your models:",it,J,vt="<li>If you are using <strong>AutoTrain</strong>, this is tracked for you 🔥</li> <li>Otherwise, use a tracker like  Code Carbon in your training code, then specify</li>",lt,H,st,I,Ut="in your model card metadata, where <code>1.2345</code> is the emissions value in <strong>grams</strong>.",ot,_,$t='To learn more about the carbon footprint of Transformers, check out the <a href="https://www.youtube.com/watch?v=ftWlj4FBHTg" rel="nofollow">video</a>, part of the Hugging Face Course!',rt,P,mt;return c=new S({props:{title:"Displaying carbon emissions for your model",local:"displaying-carbon-emissions-for-your-model",headingTag:"h1"}}),p=new S({props:{title:"Why is it beneficial to calculate the carbon emissions of my model?",local:"why-is-it-beneficial-to-calculate-the-carbon-emissions-of-my-model",headingTag:"h2"}}),h=new S({props:{title:"What information should I include about the carbon footprint of my model?",local:"what-information-should-i-include-about-the-carbon-footprint-of-my-model",headingTag:"h2"}}),y=new S({props:{title:"Carbon footprint metadata",local:"carbon-footprint-metadata",headingTag:"h2"}}),w=new Jt({props:{code:"LS0tJTBBY28yX2VxX2VtaXNzaW9ucyUzQSUwQSUyMCUyMGVtaXNzaW9ucyUzQSUyMG51bWJlciUyMChpbiUyMGdyYW1zJTIwb2YlMjBDTzIpJTBBJTIwJTIwc291cmNlJTNBJTIwJTIyc291cmNlJTIwb2YlMjB0aGUlMjBpbmZvcm1hdGlvbiUyQyUyMGVpdGhlciUyMGRpcmVjdGx5JTIwZnJvbSUyMEF1dG9UcmFpbiUyQyUyMGNvZGUlMjBjYXJib24lMjBvciUyMGZyb20lMjBhJTIwc2NpZW50aWZpYyUyMGFydGljbGUlMjBkb2N1bWVudGluZyUyMHRoZSUyMG1vZGVsJTIyJTBBJTIwJTIwdHJhaW5pbmdfdHlwZSUzQSUyMCUyMnByZS10cmFpbmluZyUyMG9yJTIwZmluZS10dW5pbmclMjIlMEElMjAlMjBnZW9ncmFwaGljYWxfbG9jYXRpb24lM0ElMjAlMjJhcyUyMGdyYW51bGFyJTIwYXMlMjBwb3NzaWJsZSUyQyUyMGZvciUyMGluc3RhbmNlJTIwUXVlYmVjJTJDJTIwQ2FuYWRhJTIwb3IlMjBCcm9va2x5biUyQyUyME5ZJTJDJTIwVVNBLiUyMFRvJTIwY2hlY2slMjB5b3VyJTIwY29tcHV0ZSdzJTIwZWxlY3RyaWNpdHklMjBncmlkJTJDJTIweW91JTIwY2FuJTIwY2hlY2slMjBvdXQlMjBodHRwcyUzQSUyRiUyRmFwcC5lbGVjdHJpY2l0eW1hcC5vcmcuJTIyJTBBJTIwJTIwaGFyZHdhcmVfdXNlZCUzQSUyMCUyMmhvdyUyMG11Y2glMjBjb21wdXRlJTIwYW5kJTIwd2hhdCUyMGtpbmQlMkMlMjBlLmcuJTIwOCUyMHYxMDAlMjBHUFVzJTIyJTBBLS0t",highlighted:`<span class="hljs-meta">---</span>
<span class="hljs-attr">co2_eq_emissions:</span>
  <span class="hljs-attr">emissions:</span> <span class="hljs-string">number</span> <span class="hljs-string">(in</span> <span class="hljs-string">grams</span> <span class="hljs-string">of</span> <span class="hljs-string">CO2)</span>
  <span class="hljs-attr">source:</span> <span class="hljs-string">&quot;source of the information, either directly from AutoTrain, code carbon or from a scientific article documenting the model&quot;</span>
  <span class="hljs-attr">training_type:</span> <span class="hljs-string">&quot;pre-training or fine-tuning&quot;</span>
  <span class="hljs-attr">geographical_location:</span> <span class="hljs-string">&quot;as granular as possible, for instance Quebec, Canada or Brooklyn, NY, USA. To check your compute&#x27;s electricity grid, you can check out https://app.electricitymap.org.&quot;</span>
  <span class="hljs-attr">hardware_used:</span> <span class="hljs-string">&quot;how much compute and what kind, e.g. 8 v100 GPUs&quot;</span>
<span class="hljs-meta">---</span>`,wrap:!1}}),M=new S({props:{title:"How is the carbon footprint of my model calculated? 🌎",local:"how-is-the-carbon-footprint-of-my-model-calculated-",headingTag:"h2"}}),H=new Jt({props:{code:"Y28yX2VxX2VtaXNzaW9ucyUzQSUyMCUwQSUyMCUyMGVtaXNzaW9ucyUzQSUyMDEuMjM0NQ==",highlighted:`<span class="hljs-attr">co2_eq_emissions:</span> 
  <span class="hljs-attr">emissions:</span> <span class="hljs-number">1.2345</span>`,wrap:!1}}),{c(){m=s("meta"),Z=i(),k=s("p"),V=i(),x(c.$$.fragment),z=i(),x(p.$$.fragment),Q=i(),u=s("p"),u.innerHTML=pt,N=i(),x(h.$$.fragment),F=i(),f=s("p"),f.textContent=ut,X=i(),d=s("ul"),d.innerHTML=ht,q=i(),x(y.$$.fragment),E=i(),b=s("p"),b.textContent=ft,R=i(),x(w.$$.fragment),A=i(),x(M.$$.fragment),D=i(),g=s("p"),g.innerHTML=dt,O=i(),T=s("p"),T.textContent=yt,K=i(),v=s("p"),v.innerHTML=bt,tt=i(),U=s("p"),U.innerHTML=wt,et=i(),$=s("p"),$.innerHTML=Mt,nt=i(),j=s("p"),j.innerHTML=gt,at=i(),C=s("p"),C.innerHTML=Tt,it=i(),J=s("ol"),J.innerHTML=vt,lt=i(),x(H.$$.fragment),st=i(),I=s("p"),I.innerHTML=Ut,ot=i(),_=s("p"),_.innerHTML=$t,rt=i(),P=s("p"),this.h()},l(t){const e=Gt("svelte-u9bgzb",document.head);m=o(e,"META",{name:!0,content:!0}),e.forEach(n),Z=l(t),k=o(t,"P",{}),jt(k).forEach(n),V=l(t),B(c.$$.fragment,t),z=l(t),B(p.$$.fragment,t),Q=l(t),u=o(t,"P",{"data-svelte-h":!0}),r(u)!=="svelte-1i3gone"&&(u.innerHTML=pt),N=l(t),B(h.$$.fragment,t),F=l(t),f=o(t,"P",{"data-svelte-h":!0}),r(f)!=="svelte-9iu39j"&&(f.textContent=ut),X=l(t),d=o(t,"UL",{"data-svelte-h":!0}),r(d)!=="svelte-gs1h1v"&&(d.innerHTML=ht),q=l(t),B(y.$$.fragment,t),E=l(t),b=o(t,"P",{"data-svelte-h":!0}),r(b)!=="svelte-h6of1q"&&(b.textContent=ft),R=l(t),B(w.$$.fragment,t),A=l(t),B(M.$$.fragment,t),D=l(t),g=o(t,"P",{"data-svelte-h":!0}),r(g)!=="svelte-sv5yrv"&&(g.innerHTML=dt),O=l(t),T=o(t,"P",{"data-svelte-h":!0}),r(T)!=="svelte-cvnnsr"&&(T.textContent=yt),K=l(t),v=o(t,"P",{"data-svelte-h":!0}),r(v)!=="svelte-hvso7s"&&(v.innerHTML=bt),tt=l(t),U=o(t,"P",{"data-svelte-h":!0}),r(U)!=="svelte-1pggfps"&&(U.innerHTML=wt),et=l(t),$=o(t,"P",{"data-svelte-h":!0}),r($)!=="svelte-1yog6xb"&&($.innerHTML=Mt),nt=l(t),j=o(t,"P",{"data-svelte-h":!0}),r(j)!=="svelte-15bb5ar"&&(j.innerHTML=gt),at=l(t),C=o(t,"P",{"data-svelte-h":!0}),r(C)!=="svelte-1cu37zl"&&(C.innerHTML=Tt),it=l(t),J=o(t,"OL",{"data-svelte-h":!0}),r(J)!=="svelte-6mrtts"&&(J.innerHTML=vt),lt=l(t),B(H.$$.fragment,t),st=l(t),I=o(t,"P",{"data-svelte-h":!0}),r(I)!=="svelte-9qidv"&&(I.innerHTML=Ut),ot=l(t),_=o(t,"P",{"data-svelte-h":!0}),r(_)!=="svelte-1b25bdn"&&(_.innerHTML=$t),rt=l(t),P=o(t,"P",{}),jt(P).forEach(n),this.h()},h(){Ct(m,"name","hf:doc:metadata"),Ct(m,"content",Yt)},m(t,e){Lt(document.head,m),a(t,Z,e),a(t,k,e),a(t,V,e),G(c,t,e),a(t,z,e),G(p,t,e),a(t,Q,e),a(t,u,e),a(t,N,e),G(h,t,e),a(t,F,e),a(t,f,e),a(t,X,e),a(t,d,e),a(t,q,e),G(y,t,e),a(t,E,e),a(t,b,e),a(t,R,e),G(w,t,e),a(t,A,e),G(M,t,e),a(t,D,e),a(t,g,e),a(t,O,e),a(t,T,e),a(t,K,e),a(t,v,e),a(t,tt,e),a(t,U,e),a(t,et,e),a(t,$,e),a(t,nt,e),a(t,j,e),a(t,at,e),a(t,C,e),a(t,it,e),a(t,J,e),a(t,lt,e),G(H,t,e),a(t,st,e),a(t,I,e),a(t,ot,e),a(t,_,e),a(t,rt,e),a(t,P,e),mt=!0},p:It,i(t){mt||(L(c.$$.fragment,t),L(p.$$.fragment,t),L(h.$$.fragment,t),L(y.$$.fragment,t),L(w.$$.fragment,t),L(M.$$.fragment,t),L(H.$$.fragment,t),mt=!0)},o(t){W(c.$$.fragment,t),W(p.$$.fragment,t),W(h.$$.fragment,t),W(y.$$.fragment,t),W(w.$$.fragment,t),W(M.$$.fragment,t),W(H.$$.fragment,t),mt=!1},d(t){t&&(n(Z),n(k),n(V),n(z),n(Q),n(u),n(N),n(F),n(f),n(X),n(d),n(q),n(E),n(b),n(R),n(A),n(D),n(g),n(O),n(T),n(K),n(v),n(tt),n(U),n(et),n($),n(nt),n(j),n(at),n(C),n(it),n(J),n(lt),n(st),n(I),n(ot),n(_),n(rt),n(P)),n(m),Y(c,t),Y(p,t),Y(h,t),Y(y,t),Y(w,t),Y(M,t),Y(H,t)}}}const Yt='{"title":"Displaying carbon emissions for your model","local":"displaying-carbon-emissions-for-your-model","sections":[{"title":"Why is it beneficial to calculate the carbon emissions of my model?","local":"why-is-it-beneficial-to-calculate-the-carbon-emissions-of-my-model","sections":[],"depth":2},{"title":"What information should I include about the carbon footprint of my model?","local":"what-information-should-i-include-about-the-carbon-footprint-of-my-model","sections":[],"depth":2},{"title":"Carbon footprint metadata","local":"carbon-footprint-metadata","sections":[],"depth":2},{"title":"How is the carbon footprint of my model calculated? 🌎","local":"how-is-the-carbon-footprint-of-my-model-calculated-","sections":[],"depth":2}],"depth":1}';function kt(ct){return _t(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class zt extends xt{constructor(m){super(),Bt(this,m,kt,Wt,Ht,{})}}export{zt as component};
