import{s as H,o as Q,n as P}from"../chunks/scheduler.b9285784.js";import{S as z,i as A,e as f,s as i,c as T,h as D,a as h,d as a,b as m,f as N,g as v,j as q,k as W,l as J,m as o,n as U,t as Z,o as x,p as w}from"../chunks/index.26bc89a1.js";import{C as O,H as K,E as ee}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.f2e029e4.js";import{D as te}from"../chunks/Docstring.4f61f748.js";import{C as se}from"../chunks/CodeBlock.191169df.js";import{E as ae}from"../chunks/ExampleCodeBlock.1e7c3bb6.js";function le(G){let l,y="Example:",d,r,g;return r=new se({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUubG9nZ2luZyUyMGltcG9ydCUyMGdldF9sb2dnZXIlMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBJTBBbG9nZ2VyJTIwJTNEJTIwZ2V0X2xvZ2dlcihfX25hbWVfXyklMEElMEFhY2NlbGVyYXRvciUyMCUzRCUyMEFjY2VsZXJhdG9yKCklMEFsb2dnZXIuaW5mbyglMjJNeSUyMGxvZyUyMiUyQyUyMG1haW5fcHJvY2Vzc19vbmx5JTNERmFsc2UpJTBBbG9nZ2VyLmRlYnVnKCUyMk15JTIwbG9nJTIyJTJDJTIwbWFpbl9wcm9jZXNzX29ubHklM0RUcnVlKSUwQSUwQWxvZ2dlciUyMCUzRCUyMGdldF9sb2dnZXIoX19uYW1lX18lMkMlMjBsb2dfbGV2ZWwlM0QlMjJERUJVRyUyMiklMEFsb2dnZXIuaW5mbyglMjJNeSUyMGxvZyUyMiklMEFsb2dnZXIuZGVidWcoJTIyTXklMjBzZWNvbmQlMjBsb2clMjIpJTBBJTBBYXJyYXklMjAlM0QlMjAlNUIlMjJhJTIyJTJDJTIwJTIyYiUyMiUyQyUyMCUyMmMlMjIlMkMlMjAlMjJkJTIyJTVEJTBBbGV0dGVyX2F0X3JhbmslMjAlM0QlMjBhcnJheSU1QmFjY2VsZXJhdG9yLnByb2Nlc3NfaW5kZXglNUQlMEFsb2dnZXIuaW5mbyhsZXR0ZXJfYXRfcmFuayUyQyUyMGluX29yZGVyJTNEVHJ1ZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> accelerate.logging <span class="hljs-keyword">import</span> get_logger
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator

<span class="hljs-meta">&gt;&gt;&gt; </span>logger = get_logger(__name__)

<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator = Accelerator()
<span class="hljs-meta">&gt;&gt;&gt; </span>logger.info(<span class="hljs-string">&quot;My log&quot;</span>, main_process_only=<span class="hljs-literal">False</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>logger.debug(<span class="hljs-string">&quot;My log&quot;</span>, main_process_only=<span class="hljs-literal">True</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>logger = get_logger(__name__, log_level=<span class="hljs-string">&quot;DEBUG&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>logger.info(<span class="hljs-string">&quot;My log&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>logger.debug(<span class="hljs-string">&quot;My second log&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>array = [<span class="hljs-string">&quot;a&quot;</span>, <span class="hljs-string">&quot;b&quot;</span>, <span class="hljs-string">&quot;c&quot;</span>, <span class="hljs-string">&quot;d&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>letter_at_rank = array[accelerator.process_index]
<span class="hljs-meta">&gt;&gt;&gt; </span>logger.info(letter_at_rank, in_order=<span class="hljs-literal">True</span>)`,wrap:!1}}),{c(){l=f("p"),l.textContent=y,d=i(),T(r.$$.fragment)},l(s){l=h(s,"P",{"data-svelte-h":!0}),q(l)!=="svelte-11lpom8"&&(l.textContent=y),d=m(s),v(r.$$.fragment,s)},m(s,c){o(s,l,c),o(s,d,c),U(r,s,c),g=!0},p:P,i(s){g||(Z(r.$$.fragment,s),g=!0)},o(s){x(r.$$.fragment,s),g=!1},d(s){s&&(a(l),a(d)),w(r,s)}}}function ne(G){let l,y,d,r,g,s,c,X,_,Y=`Refer to the <a href="../usage_guides/troubleshooting#logging">Troubleshooting guide</a> or to the example below to learn
how to use Accelerate’s logger.`,k,n,M,B,b,R="Returns a <code>logging.Logger</code> for <code>name</code> that can handle multiprocessing.",F,j,S=`If a log should be called on all processes, pass <code>main_process_only=False</code> If a log should be called on all
processes and in order, also pass <code>in_order=True</code>`,L,u,I,$,V,E,C;return g=new O({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),c=new K({props:{title:"Logging",local:"accelerate.logging.get_logger",headingTag:"h1"}}),M=new te({props:{name:"accelerate.logging.get_logger",anchor:"accelerate.logging.get_logger",parameters:[{name:"name",val:": str"},{name:"log_level",val:": typing.Optional[str] = None"}],parametersDescription:[{anchor:"accelerate.logging.get_logger.name",description:`<strong>name</strong> (<code>str</code>) &#x2014;
The name for the logger, such as <code>__file__</code>`,name:"name"},{anchor:"accelerate.logging.get_logger.log_level",description:`<strong>log_level</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The log level to use. If not passed, will default to the <code>LOG_LEVEL</code> environment variable, or <code>INFO</code> if not`,name:"log_level"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/logging.py#L86"}}),u=new ae({props:{anchor:"accelerate.logging.get_logger.example",$$slots:{default:[le]},$$scope:{ctx:G}}}),$=new ee({props:{source:"https://github.com/huggingface/accelerate/blob/main/docs/source/package_reference/logging.md"}}),{c(){l=f("meta"),y=i(),d=f("p"),r=i(),T(g.$$.fragment),s=i(),T(c.$$.fragment),X=i(),_=f("p"),_.innerHTML=Y,k=i(),n=f("div"),T(M.$$.fragment),B=i(),b=f("p"),b.innerHTML=R,F=i(),j=f("p"),j.innerHTML=S,L=i(),T(u.$$.fragment),I=i(),T($.$$.fragment),V=i(),E=f("p"),this.h()},l(e){const t=D("svelte-u9bgzb",document.head);l=h(t,"META",{name:!0,content:!0}),t.forEach(a),y=m(e),d=h(e,"P",{}),N(d).forEach(a),r=m(e),v(g.$$.fragment,e),s=m(e),v(c.$$.fragment,e),X=m(e),_=h(e,"P",{"data-svelte-h":!0}),q(_)!=="svelte-1wzemby"&&(_.innerHTML=Y),k=m(e),n=h(e,"DIV",{class:!0});var p=N(n);v(M.$$.fragment,p),B=m(p),b=h(p,"P",{"data-svelte-h":!0}),q(b)!=="svelte-v0qcsm"&&(b.innerHTML=R),F=m(p),j=h(p,"P",{"data-svelte-h":!0}),q(j)!=="svelte-zppohk"&&(j.innerHTML=S),L=m(p),v(u.$$.fragment,p),p.forEach(a),I=m(e),v($.$$.fragment,e),V=m(e),E=h(e,"P",{}),N(E).forEach(a),this.h()},h(){W(l,"name","hf:doc:metadata"),W(l,"content",oe),W(n,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){J(document.head,l),o(e,y,t),o(e,d,t),o(e,r,t),U(g,e,t),o(e,s,t),U(c,e,t),o(e,X,t),o(e,_,t),o(e,k,t),o(e,n,t),U(M,n,null),J(n,B),J(n,b),J(n,F),J(n,j),J(n,L),U(u,n,null),o(e,I,t),U($,e,t),o(e,V,t),o(e,E,t),C=!0},p(e,[t]){const p={};t&2&&(p.$$scope={dirty:t,ctx:e}),u.$set(p)},i(e){C||(Z(g.$$.fragment,e),Z(c.$$.fragment,e),Z(M.$$.fragment,e),Z(u.$$.fragment,e),Z($.$$.fragment,e),C=!0)},o(e){x(g.$$.fragment,e),x(c.$$.fragment,e),x(M.$$.fragment,e),x(u.$$.fragment,e),x($.$$.fragment,e),C=!1},d(e){e&&(a(y),a(d),a(r),a(s),a(X),a(_),a(k),a(n),a(I),a(V),a(E)),a(l),w(g,e),w(c,e),w(M),w(u),w($,e)}}}const oe='{"title":"Logging","local":"accelerate.logging.get_logger","sections":[],"depth":1}';function re(G){return Q(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ue extends z{constructor(l){super(),A(this,l,re,ne,H,{})}}export{ue as component};
