import{s as R,o as H,n as Q}from"../chunks/scheduler.defa9a21.js";import{S,i as P,g as h,s as m,r as T,A,h as f,f as l,c as d,j as C,u as v,x as V,k as L,y as $,a as g,v as U,d as Z,t as w,w as E}from"../chunks/index.fe795e71.js";import{D as z}from"../chunks/Docstring.90d6fe5c.js";import{C as D}from"../chunks/CodeBlock.204b6c34.js";import{E as K}from"../chunks/ExampleCodeBlock.f6fae62d.js";import{H as O,E as ee}from"../chunks/getInferenceSnippets.2234a8dd.js";function te(G){let a,y="Example:",i,o,r;return o=new D({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(){a=h("p"),a.textContent=y,i=m(),T(o.$$.fragment)},l(t){a=f(t,"P",{"data-svelte-h":!0}),V(a)!=="svelte-11lpom8"&&(a.textContent=y),i=d(t),v(o.$$.fragment,t)},m(t,c){g(t,a,c),g(t,i,c),U(o,t,c),r=!0},p:Q,i(t){r||(Z(o.$$.fragment,t),r=!0)},o(t){w(o.$$.fragment,t),r=!1},d(t){t&&(l(a),l(i)),E(o,t)}}}function se(G){let a,y,i,o,r,t,c,N=`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.`,X,n,_,q,b,W="Returns a <code>logging.Logger</code> for <code>name</code> that can handle multiprocessing.",B,j,Y=`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>`,F,u,k,M,x,J,I;return r=new O({props:{title:"Logging",local:"accelerate.logging.get_logger",headingTag:"h1"}}),_=new z({props:{name:"accelerate.logging.get_logger",anchor:"accelerate.logging.get_logger",parameters:[{name:"name",val:": str"},{name:"log_level",val:": 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/v1.10.1/src/accelerate/logging.py#L85"}}),u=new K({props:{anchor:"accelerate.logging.get_logger.example",$$slots:{default:[te]},$$scope:{ctx:G}}}),M=new ee({props:{source:"https://github.com/huggingface/accelerate/blob/main/docs/source/package_reference/logging.md"}}),{c(){a=h("meta"),y=m(),i=h("p"),o=m(),T(r.$$.fragment),t=m(),c=h("p"),c.innerHTML=N,X=m(),n=h("div"),T(_.$$.fragment),q=m(),b=h("p"),b.innerHTML=W,B=m(),j=h("p"),j.innerHTML=Y,F=m(),T(u.$$.fragment),k=m(),T(M.$$.fragment),x=m(),J=h("p"),this.h()},l(e){const s=A("svelte-u9bgzb",document.head);a=f(s,"META",{name:!0,content:!0}),s.forEach(l),y=d(e),i=f(e,"P",{}),C(i).forEach(l),o=d(e),v(r.$$.fragment,e),t=d(e),c=f(e,"P",{"data-svelte-h":!0}),V(c)!=="svelte-1wzemby"&&(c.innerHTML=N),X=d(e),n=f(e,"DIV",{class:!0});var p=C(n);v(_.$$.fragment,p),q=d(p),b=f(p,"P",{"data-svelte-h":!0}),V(b)!=="svelte-v0qcsm"&&(b.innerHTML=W),B=d(p),j=f(p,"P",{"data-svelte-h":!0}),V(j)!=="svelte-zppohk"&&(j.innerHTML=Y),F=d(p),v(u.$$.fragment,p),p.forEach(l),k=d(e),v(M.$$.fragment,e),x=d(e),J=f(e,"P",{}),C(J).forEach(l),this.h()},h(){L(a,"name","hf:doc:metadata"),L(a,"content",ae),L(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,s){$(document.head,a),g(e,y,s),g(e,i,s),g(e,o,s),U(r,e,s),g(e,t,s),g(e,c,s),g(e,X,s),g(e,n,s),U(_,n,null),$(n,q),$(n,b),$(n,B),$(n,j),$(n,F),U(u,n,null),g(e,k,s),U(M,e,s),g(e,x,s),g(e,J,s),I=!0},p(e,[s]){const p={};s&2&&(p.$$scope={dirty:s,ctx:e}),u.$set(p)},i(e){I||(Z(r.$$.fragment,e),Z(_.$$.fragment,e),Z(u.$$.fragment,e),Z(M.$$.fragment,e),I=!0)},o(e){w(r.$$.fragment,e),w(_.$$.fragment,e),w(u.$$.fragment,e),w(M.$$.fragment,e),I=!1},d(e){e&&(l(y),l(i),l(o),l(t),l(c),l(X),l(n),l(k),l(x),l(J)),l(a),E(r,e),E(_),E(u),E(M,e)}}}const ae='{"title":"Logging","local":"accelerate.logging.get_logger","sections":[],"depth":1}';function le(G){return H(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ie extends S{constructor(a){super(),P(this,a,le,se,R,{})}}export{ie as component};
