import{s as ct,o as pt,n as Re}from"../chunks/scheduler.defa9a21.js";import{S as mt,i as yt,g as r,s,r as m,A as Mt,h as c,f as l,c as i,j as ot,u as y,x as p,k as rt,y as dt,a as n,v as M,d,t as h,w as u}from"../chunks/index.fe795e71.js";import{T as Xe}from"../chunks/Tip.179eb360.js";import{C as $}from"../chunks/CodeBlock.204b6c34.js";import{H as ke,E as ht}from"../chunks/getInferenceSnippets.2234a8dd.js";function ut(b){let a,f=`This code snippet is based off the one from the <code>simple_nlp_example</code> notebook found <a href="https://github.com/huggingface/notebooks/blob/main/examples/accelerate_examples/simple_nlp_example.ipynb" rel="nofollow">here</a> with slight
modifications for the sake of simplicity`;return{c(){a=r("p"),a.innerHTML=f},l(o){a=c(o,"P",{"data-svelte-h":!0}),p(a)!=="svelte-yrnjd5"&&(a.innerHTML=f)},m(o,U){n(o,a,U)},p:Re,d(o){o&&l(a)}}}function ft(b){let a,f="The <code>notebook_launcher</code> will default to 8 processes if Accelerate has been configured for a TPU";return{c(){a=r("p"),a.innerHTML=f},l(o){a=c(o,"P",{"data-svelte-h":!0}),p(a)!=="svelte-1c5q2ti"&&(a.innerHTML=f)},m(o,U){n(o,a,U)},p:Re,d(o){o&&l(a)}}}function Ut(b){let a,f=`The above workaround is only needed when launching a TPU instance from a Jupyter Notebook on a low-resource server such as Google Colaboratory or Kaggle. If
using a script or launching on a much beefier server declaring the model beforehand is not needed.`;return{c(){a=r("p"),a.textContent=f},l(o){a=c(o,"P",{"data-svelte-h":!0}),p(a)!=="svelte-o7huol"&&(a.textContent=f)},m(o,U){n(o,a,U)},p:Re,d(o){o&&l(a)}}}function bt(b){let a,f="Just because the memory is allocated does not mean it will be used or that the batch size will increase when going back to your training dataloader.";return{c(){a=r("p"),a.textContent=f},l(o){a=c(o,"P",{"data-svelte-h":!0}),p(a)!=="svelte-1enbpvz"&&(a.textContent=f)},m(o,U){n(o,a,U)},p:Re,d(o){o&&l(a)}}}function wt(b){let a,f,o,U,g,le,J,Be=`Training on TPUs can be slightly different from training on multi-gpu, even with Accelerate. This guide aims to show you
where you should be careful and why, as well as the best practices in general.`,ne,_,ae,v,ze=`The main carepoint when training on TPUs comes from the <a href="/docs/accelerate/v1.10.1/en/package_reference/launchers#accelerate.notebook_launcher">notebook_launcher()</a>. As mentioned in the <a href="../usage_guides/notebook">notebook tutorial</a>, you need to
restructure your training code into a function that can get passed to the <a href="/docs/accelerate/v1.10.1/en/package_reference/launchers#accelerate.notebook_launcher">notebook_launcher()</a> function and be careful about not declaring any tensors on the GPU.`,se,G,Fe=`While on a TPU that last part is not as important, a critical part to understand is that when you launch code from a notebook you do so through a process called <strong>forking</strong>.
When launching from the command-line, you perform <strong>spawning</strong>, where a python process is not currently running and you <em>spawn</em> a new process in. Since your Jupyter notebook is already
utilizing a python process, you need to <em>fork</em> a new process from it to launch your code.`,ie,Y,Se=`Where this becomes important is in regard to declaring your model. On forked TPU processes, it is recommended that you instantiate your model <em>once</em> and pass this into your
training function. This is different than training on GPUs where you create <code>n</code> models that have their gradients synced and back-propagated at certain moments. Instead, one
model instance is shared between all the nodes and it is passed back and forth. This is important especially when training on low-resource TPUs such as those provided in Kaggle kernels or
on Google Colaboratory.`,oe,I,He='Below is an example of a training function passed to the <a href="/docs/accelerate/v1.10.1/en/package_reference/launchers#accelerate.notebook_launcher">notebook_launcher()</a> if training on CPUs or GPUs:',re,w,ce,V,pe,Z,me,T,ye,W,Qe=`If you use this example and declare the model <em>inside</em> the training loop, then on a low-resource system you will potentially see an error
like:`,Me,A,de,x,Ee=`This error is <em>extremely</em> cryptic but the basic explanation is you ran out of system RAM. You can avoid this entirely by reconfiguring the training function to
accept a single <code>model</code> argument, and declare it in an outside cell:`,he,X,ue,k,fe,R,Ne="And finally calling the training function with:",Ue,B,be,j,we,z,Te,F,Pe=`As mentioned in the <a href="../usage_guides/mixed_precision">mixed precision tutorial</a>, Accelerate supports fp16 and bf16, both of which can be used on TPUs.
That being said, ideally <code>bf16</code> should be utilized as it is extremely efficient to use.`,je,S,Le="There are two “layers” when using <code>bf16</code> and Accelerate on TPUs, at the base level and at the operation level.",Ce,H,qe="At the base level, this is enabled when passing <code>mixed_precision=&quot;bf16&quot;</code> to <code>Accelerator</code>, such as:",$e,Q,ge,E,Ke=`By default, this will cast <code>torch.float</code> and <code>torch.double</code> to <code>bfloat16</code> on TPUs.
The specific configuration being set is an environmental variable of <code>XLA_USE_BF16</code> is set to <code>1</code>.`,Je,N,De=`There is a further configuration you can perform which is setting the <code>XLA_DOWNCAST_BF16</code> environmental variable. If set to <code>1</code>, then
<code>torch.float</code> is <code>bfloat16</code> and <code>torch.double</code> is <code>float32</code>.`,_e,P,Oe="This is performed in the <code>Accelerator</code> object when passing <code>downcast_bf16=True</code>:",ve,L,Ge,q,et="Using downcasting instead of bf16 everywhere is good for when you are trying to calculate metrics, log values, and more where raw bf16 tensors would be unusable.",Ye,K,Ie,D,tt=`As you launch your script, you may notice that training seems exceptionally slow at first. This is because TPUs
first run through a few batches of data to see how much memory to allocate before finally utilizing this configured
memory allocation extremely efficiently.`,Ve,O,lt=`If you notice that your evaluation code to calculate the metrics of your model takes longer due to a larger batch size being used,
it is recommended to keep the batch size the same as the training data if it is too slow. Otherwise the memory will reallocate to this
new batch size after the first few iterations.`,Ze,C,We,ee,Ae,te,xe;return g=new ke({props:{title:"Training on TPUs",local:"training-on-tpus",headingTag:"h1"}}),_=new ke({props:{title:"Training in a Notebook",local:"training-in-a-notebook",headingTag:"h2"}}),w=new Xe({props:{$$slots:{default:[ut]},$$scope:{ctx:b}}}),V=new $({props:{code:"ZGVmJTIwdHJhaW5pbmdfZnVuY3Rpb24oKSUzQSUwQSUyMCUyMCUyMCUyMCUyMyUyMEluaXRpYWxpemUlMjBhY2NlbGVyYXRvciUwQSUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUyMCUyMCUyMCUyMG1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yU2VxdWVuY2V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Vyb19ncmFkKCk=",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">training_function</span>():
    <span class="hljs-comment"># Initialize accelerator</span>
    accelerator = Accelerator()
    model = AutoModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>, num_labels=<span class="hljs-number">2</span>)
    train_dataloader, eval_dataloader = create_dataloaders(
        train_batch_size=hyperparameters[<span class="hljs-string">&quot;train_batch_size&quot;</span>], eval_batch_size=hyperparameters[<span class="hljs-string">&quot;eval_batch_size&quot;</span>]
    )

    <span class="hljs-comment"># Instantiate optimizer</span>
    optimizer = AdamW(params=model.parameters(), lr=hyperparameters[<span class="hljs-string">&quot;learning_rate&quot;</span>])

    <span class="hljs-comment"># Prepare everything</span>
    <span class="hljs-comment"># There is no specific order to remember, we just need to unpack the objects in the same order we gave them to the</span>
    <span class="hljs-comment"># prepare method.</span>
    model, optimizer, train_dataloader, eval_dataloader = accelerator.prepare(
        model, optimizer, train_dataloader, eval_dataloader
    )

    num_epochs = hyperparameters[<span class="hljs-string">&quot;num_epochs&quot;</span>]
    <span class="hljs-comment"># Now we train the model</span>
    <span class="hljs-keyword">for</span> epoch <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(num_epochs):
        model.train()
        <span class="hljs-keyword">for</span> step, batch <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(train_dataloader):
            outputs = model(**batch)
            loss = outputs.loss
            accelerator.backward(loss)

            optimizer.step()
            optimizer.zero_grad()`,wrap:!1}}),Z=new $({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBub3RlYm9va19sYXVuY2hlciUwQSUwQW5vdGVib29rX2xhdW5jaGVyKHRyYWluaW5nX2Z1bmN0aW9uKQ==",highlighted:`<span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> notebook_launcher

notebook_launcher(training_function)`,wrap:!1}}),T=new Xe({props:{$$slots:{default:[ft]},$$scope:{ctx:b}}}),A=new $({props:{code:"UHJvY2Vzc0V4aXRlZEV4Y2VwdGlvbiUzQSUyMHByb2Nlc3MlMjAwJTIwdGVybWluYXRlZCUyMHdpdGglMjBzaWduYWwlMjBTSUdTRUdW",highlighted:'<span class="hljs-attribute">ProcessExitedException</span>: process <span class="hljs-number">0</span> terminated <span class="hljs-keyword">with</span> <span class="hljs-keyword">signal</span><span class="hljs-string"> SIGSEGV</span>',wrap:!1}}),X=new $({props:{code:"JTIzJTIwSW4lMjBhbm90aGVyJTIwSnVweXRlciUyMGNlbGwlMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmJlcnQtYmFzZS1jYXNlZCUyMiUyQyUyMG51bV9sYWJlbHMlM0QyKQ==",highlighted:`<span class="hljs-comment"># In another Jupyter cell</span>
model = AutoModelForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>, num_labels=<span class="hljs-number">2</span>)`,wrap:!1}}),k=new $({props:{code:"JTJCJTIwZGVmJTIwdHJhaW5pbmdfZnVuY3Rpb24obW9kZWwpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwSW5pdGlhbGl6ZSUyMGFjY2VsZXJhdG9yJTBBJTIwJTIwJTIwJTIwJTIwJTIwYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBLSUyMCUyMCUyMCUyMCUyMG1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLWNhc2VkJTIyJTJDJTIwbnVtX2xhYmVscyUzRDIpJTBBJTIwJTIwJTIwJTIwJTIwJTIwdHJhaW5fZGF0YWxvYWRlciUyQyUyMGV2YWxfZGF0YWxvYWRlciUyMCUzRCUyMGNyZWF0ZV9kYXRhbG9hZGVycyglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB0cmFpbl9iYXRjaF9zaXplJTNEaHlwZXJwYXJhbWV0ZXJzJTVCJTIydHJhaW5fYmF0Y2hfc2l6ZSUyMiU1RCUyQyUyMGV2YWxfYmF0Y2hfc2l6ZSUzRGh5cGVycGFyYW1ldGVycyU1QiUyMmV2YWxfYmF0Y2hfc2l6ZSUyMiU1RCUwQSUyMCUyMCUyMCUyMCUyMCUyMCklMEElMjAlMjAuLi4=",highlighted:`<span class="hljs-addition">+ def training_function(model):</span>
      # Initialize accelerator
      accelerator = Accelerator()
<span class="hljs-deletion">-     model = AutoModelForSequenceClassification.from_pretrained(&quot;bert-base-cased&quot;, num_labels=2)</span>
      train_dataloader, eval_dataloader = create_dataloaders(
          train_batch_size=hyperparameters[&quot;train_batch_size&quot;], eval_batch_size=hyperparameters[&quot;eval_batch_size&quot;]
      )
  ...`,wrap:!1}}),B=new $({props:{code:"JTIwJTIwZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBub3RlYm9va19sYXVuY2hlciUwQS0lMjBub3RlYm9va19sYXVuY2hlcih0cmFpbmluZ19mdW5jdGlvbiklMEElMkIlMjBub3RlYm9va19sYXVuY2hlcih0cmFpbmluZ19mdW5jdGlvbiUyQyUyMChtb2RlbCUyQykp",highlighted:`  from accelerate import notebook_launcher
<span class="hljs-deletion">- notebook_launcher(training_function)</span>
<span class="hljs-addition">+ notebook_launcher(training_function, (model,))</span>`,wrap:!1}}),j=new Xe({props:{$$slots:{default:[Ut]},$$scope:{ctx:b}}}),z=new ke({props:{title:"Mixed Precision and Global Variables",local:"mixed-precision-and-global-variables",headingTag:"h2"}}),Q=new $({props:{code:"YWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcihtaXhlZF9wcmVjaXNpb24lM0QlMjJiZjE2JTIyKQ==",highlighted:'accelerator = Accelerator(mixed_precision=<span class="hljs-string">&quot;bf16&quot;</span>)',wrap:!1}}),L=new $({props:{code:"YWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcihtaXhlZF9wcmVjaXNpb24lM0QlMjJiZjE2JTIyJTJDJTIwZG93bmNhc3RfYmYxNiUzRFRydWUp",highlighted:'accelerator = Accelerator(mixed_precision=<span class="hljs-string">&quot;bf16&quot;</span>, downcast_bf16=<span class="hljs-literal">True</span>)',wrap:!1}}),K=new ke({props:{title:"Training Times on TPUs",local:"training-times-on-tpus",headingTag:"h2"}}),C=new Xe({props:{$$slots:{default:[bt]},$$scope:{ctx:b}}}),ee=new ht({props:{source:"https://github.com/huggingface/accelerate/blob/main/docs/source/concept_guides/training_tpu.md"}}),{c(){a=r("meta"),f=s(),o=r("p"),U=s(),m(g.$$.fragment),le=s(),J=r("p"),J.textContent=Be,ne=s(),m(_.$$.fragment),ae=s(),v=r("p"),v.innerHTML=ze,se=s(),G=r("p"),G.innerHTML=Fe,ie=s(),Y=r("p"),Y.innerHTML=Se,oe=s(),I=r("p"),I.innerHTML=He,re=s(),m(w.$$.fragment),ce=s(),m(V.$$.fragment),pe=s(),m(Z.$$.fragment),me=s(),m(T.$$.fragment),ye=s(),W=r("p"),W.innerHTML=Qe,Me=s(),m(A.$$.fragment),de=s(),x=r("p"),x.innerHTML=Ee,he=s(),m(X.$$.fragment),ue=s(),m(k.$$.fragment),fe=s(),R=r("p"),R.textContent=Ne,Ue=s(),m(B.$$.fragment),be=s(),m(j.$$.fragment),we=s(),m(z.$$.fragment),Te=s(),F=r("p"),F.innerHTML=Pe,je=s(),S=r("p"),S.innerHTML=Le,Ce=s(),H=r("p"),H.innerHTML=qe,$e=s(),m(Q.$$.fragment),ge=s(),E=r("p"),E.innerHTML=Ke,Je=s(),N=r("p"),N.innerHTML=De,_e=s(),P=r("p"),P.innerHTML=Oe,ve=s(),m(L.$$.fragment),Ge=s(),q=r("p"),q.textContent=et,Ye=s(),m(K.$$.fragment),Ie=s(),D=r("p"),D.textContent=tt,Ve=s(),O=r("p"),O.textContent=lt,Ze=s(),m(C.$$.fragment),We=s(),m(ee.$$.fragment),Ae=s(),te=r("p"),this.h()},l(e){const t=Mt("svelte-u9bgzb",document.head);a=c(t,"META",{name:!0,content:!0}),t.forEach(l),f=i(e),o=c(e,"P",{}),ot(o).forEach(l),U=i(e),y(g.$$.fragment,e),le=i(e),J=c(e,"P",{"data-svelte-h":!0}),p(J)!=="svelte-d23dnh"&&(J.textContent=Be),ne=i(e),y(_.$$.fragment,e),ae=i(e),v=c(e,"P",{"data-svelte-h":!0}),p(v)!=="svelte-ab1ry4"&&(v.innerHTML=ze),se=i(e),G=c(e,"P",{"data-svelte-h":!0}),p(G)!=="svelte-jduzug"&&(G.innerHTML=Fe),ie=i(e),Y=c(e,"P",{"data-svelte-h":!0}),p(Y)!=="svelte-1p7m292"&&(Y.innerHTML=Se),oe=i(e),I=c(e,"P",{"data-svelte-h":!0}),p(I)!=="svelte-1s1joik"&&(I.innerHTML=He),re=i(e),y(w.$$.fragment,e),ce=i(e),y(V.$$.fragment,e),pe=i(e),y(Z.$$.fragment,e),me=i(e),y(T.$$.fragment,e),ye=i(e),W=c(e,"P",{"data-svelte-h":!0}),p(W)!=="svelte-ty61hq"&&(W.innerHTML=Qe),Me=i(e),y(A.$$.fragment,e),de=i(e),x=c(e,"P",{"data-svelte-h":!0}),p(x)!=="svelte-wyby5p"&&(x.innerHTML=Ee),he=i(e),y(X.$$.fragment,e),ue=i(e),y(k.$$.fragment,e),fe=i(e),R=c(e,"P",{"data-svelte-h":!0}),p(R)!=="svelte-4gz0l1"&&(R.textContent=Ne),Ue=i(e),y(B.$$.fragment,e),be=i(e),y(j.$$.fragment,e),we=i(e),y(z.$$.fragment,e),Te=i(e),F=c(e,"P",{"data-svelte-h":!0}),p(F)!=="svelte-12n9o3u"&&(F.innerHTML=Pe),je=i(e),S=c(e,"P",{"data-svelte-h":!0}),p(S)!=="svelte-1l8j0ej"&&(S.innerHTML=Le),Ce=i(e),H=c(e,"P",{"data-svelte-h":!0}),p(H)!=="svelte-1x5gbwm"&&(H.innerHTML=qe),$e=i(e),y(Q.$$.fragment,e),ge=i(e),E=c(e,"P",{"data-svelte-h":!0}),p(E)!=="svelte-g1oxbw"&&(E.innerHTML=Ke),Je=i(e),N=c(e,"P",{"data-svelte-h":!0}),p(N)!=="svelte-13m84js"&&(N.innerHTML=De),_e=i(e),P=c(e,"P",{"data-svelte-h":!0}),p(P)!=="svelte-qa71s5"&&(P.innerHTML=Oe),ve=i(e),y(L.$$.fragment,e),Ge=i(e),q=c(e,"P",{"data-svelte-h":!0}),p(q)!=="svelte-90ggge"&&(q.textContent=et),Ye=i(e),y(K.$$.fragment,e),Ie=i(e),D=c(e,"P",{"data-svelte-h":!0}),p(D)!=="svelte-1404l3y"&&(D.textContent=tt),Ve=i(e),O=c(e,"P",{"data-svelte-h":!0}),p(O)!=="svelte-cqp35u"&&(O.textContent=lt),Ze=i(e),y(C.$$.fragment,e),We=i(e),y(ee.$$.fragment,e),Ae=i(e),te=c(e,"P",{}),ot(te).forEach(l),this.h()},h(){rt(a,"name","hf:doc:metadata"),rt(a,"content",Tt)},m(e,t){dt(document.head,a),n(e,f,t),n(e,o,t),n(e,U,t),M(g,e,t),n(e,le,t),n(e,J,t),n(e,ne,t),M(_,e,t),n(e,ae,t),n(e,v,t),n(e,se,t),n(e,G,t),n(e,ie,t),n(e,Y,t),n(e,oe,t),n(e,I,t),n(e,re,t),M(w,e,t),n(e,ce,t),M(V,e,t),n(e,pe,t),M(Z,e,t),n(e,me,t),M(T,e,t),n(e,ye,t),n(e,W,t),n(e,Me,t),M(A,e,t),n(e,de,t),n(e,x,t),n(e,he,t),M(X,e,t),n(e,ue,t),M(k,e,t),n(e,fe,t),n(e,R,t),n(e,Ue,t),M(B,e,t),n(e,be,t),M(j,e,t),n(e,we,t),M(z,e,t),n(e,Te,t),n(e,F,t),n(e,je,t),n(e,S,t),n(e,Ce,t),n(e,H,t),n(e,$e,t),M(Q,e,t),n(e,ge,t),n(e,E,t),n(e,Je,t),n(e,N,t),n(e,_e,t),n(e,P,t),n(e,ve,t),M(L,e,t),n(e,Ge,t),n(e,q,t),n(e,Ye,t),M(K,e,t),n(e,Ie,t),n(e,D,t),n(e,Ve,t),n(e,O,t),n(e,Ze,t),M(C,e,t),n(e,We,t),M(ee,e,t),n(e,Ae,t),n(e,te,t),xe=!0},p(e,[t]){const nt={};t&2&&(nt.$$scope={dirty:t,ctx:e}),w.$set(nt);const at={};t&2&&(at.$$scope={dirty:t,ctx:e}),T.$set(at);const st={};t&2&&(st.$$scope={dirty:t,ctx:e}),j.$set(st);const it={};t&2&&(it.$$scope={dirty:t,ctx:e}),C.$set(it)},i(e){xe||(d(g.$$.fragment,e),d(_.$$.fragment,e),d(w.$$.fragment,e),d(V.$$.fragment,e),d(Z.$$.fragment,e),d(T.$$.fragment,e),d(A.$$.fragment,e),d(X.$$.fragment,e),d(k.$$.fragment,e),d(B.$$.fragment,e),d(j.$$.fragment,e),d(z.$$.fragment,e),d(Q.$$.fragment,e),d(L.$$.fragment,e),d(K.$$.fragment,e),d(C.$$.fragment,e),d(ee.$$.fragment,e),xe=!0)},o(e){h(g.$$.fragment,e),h(_.$$.fragment,e),h(w.$$.fragment,e),h(V.$$.fragment,e),h(Z.$$.fragment,e),h(T.$$.fragment,e),h(A.$$.fragment,e),h(X.$$.fragment,e),h(k.$$.fragment,e),h(B.$$.fragment,e),h(j.$$.fragment,e),h(z.$$.fragment,e),h(Q.$$.fragment,e),h(L.$$.fragment,e),h(K.$$.fragment,e),h(C.$$.fragment,e),h(ee.$$.fragment,e),xe=!1},d(e){e&&(l(f),l(o),l(U),l(le),l(J),l(ne),l(ae),l(v),l(se),l(G),l(ie),l(Y),l(oe),l(I),l(re),l(ce),l(pe),l(me),l(ye),l(W),l(Me),l(de),l(x),l(he),l(ue),l(fe),l(R),l(Ue),l(be),l(we),l(Te),l(F),l(je),l(S),l(Ce),l(H),l($e),l(ge),l(E),l(Je),l(N),l(_e),l(P),l(ve),l(Ge),l(q),l(Ye),l(Ie),l(D),l(Ve),l(O),l(Ze),l(We),l(Ae),l(te)),l(a),u(g,e),u(_,e),u(w,e),u(V,e),u(Z,e),u(T,e),u(A,e),u(X,e),u(k,e),u(B,e),u(j,e),u(z,e),u(Q,e),u(L,e),u(K,e),u(C,e),u(ee,e)}}}const Tt='{"title":"Training on TPUs","local":"training-on-tpus","sections":[{"title":"Training in a Notebook","local":"training-in-a-notebook","sections":[],"depth":2},{"title":"Mixed Precision and Global Variables","local":"mixed-precision-and-global-variables","sections":[],"depth":2},{"title":"Training Times on TPUs","local":"training-times-on-tpus","sections":[],"depth":2}],"depth":1}';function jt(b){return pt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class vt extends mt{constructor(a){super(),yt(this,a,jt,wt,ct,{})}}export{vt as component};
