import{s as mt,o as yt,n as ze}from"../chunks/scheduler.b9285784.js";import{S as Mt,i as dt,e as r,s,c as m,h as ht,a as c,d as l,b as i,f as ct,g as y,j as p,k as pt,l as ut,m as n,n as M,t as d,o as h,p as u}from"../chunks/index.26bc89a1.js";import{T as Re}from"../chunks/Tip.e4eba3d6.js";import{C as ft,H as Be,E as bt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.7242ff19.js";import{C}from"../chunks/CodeBlock.c8ee1711.js";function Ut(U){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,b){n(o,a,b)},p:ze,d(o){o&&l(a)}}}function wt(U){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,b){n(o,a,b)},p:ze,d(o){o&&l(a)}}}function Tt(U){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,b){n(o,a,b)},p:ze,d(o){o&&l(a)}}}function $t(U){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,b){n(o,a,b)},p:ze,d(o){o&&l(a)}}}function jt(U){let a,f,o,b,g,ne,J,ae,_,Se=`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.`,se,v,ie,G,Fe=`The main carepoint when training on TPUs comes from the <a href="/docs/accelerate/main/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/main/en/package_reference/launchers#accelerate.notebook_launcher">notebook_launcher()</a> function and be careful about not declaring any tensors on the GPU.`,oe,Y,He=`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.`,re,I,Qe=`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.`,ce,V,Ee='Below is an example of a training function passed to the <a href="/docs/accelerate/main/en/package_reference/launchers#accelerate.notebook_launcher">notebook_launcher()</a> if training on CPUs or GPUs:',pe,w,me,Z,ye,x,Me,T,de,W,Ne=`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:`,he,A,ue,X,Pe=`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:`,fe,k,be,R,Ue,B,Le="And finally calling the training function with:",we,z,Te,$,$e,S,je,F,qe=`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.`,Ce,H,Ke="There are two “layers” when using <code>bf16</code> and Accelerate on TPUs, at the base level and at the operation level.",ge,Q,De="At the base level, this is enabled when passing <code>mixed_precision=&quot;bf16&quot;</code> to <code>Accelerator</code>, such as:",Je,E,_e,N,Oe=`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>.`,ve,P,et=`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>.`,Ge,L,tt="This is performed in the <code>Accelerator</code> object when passing <code>downcast_bf16=True</code>:",Ye,q,Ie,K,lt="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.",Ve,D,Ze,O,nt=`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.`,xe,ee,at=`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.`,We,j,Ae,te,Xe,le,ke;return g=new ft({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),J=new Be({props:{title:"Training on TPUs",local:"training-on-tpus",headingTag:"h1"}}),v=new Be({props:{title:"Training in a Notebook",local:"training-in-a-notebook",headingTag:"h2"}}),w=new Re({props:{$$slots:{default:[Ut]},$$scope:{ctx:U}}}),Z=new C({props:{code:"ZGVmJTIwdHJhaW5pbmdfZnVuY3Rpb24oKSUzQSUwQSUyMCUyMCUyMCUyMCUyMyUyMEluaXRpYWxpemUlMjBhY2NlbGVyYXRvciUwQSUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoK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MEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBvcHRpbWl6ZXIuemVyb19ncmFkKCk=",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}}),x=new C({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 Re({props:{$$slots:{default:[wt]},$$scope:{ctx:U}}}),A=new C({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}}),k=new C({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}}),R=new C({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}}),z=new C({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}}),$=new Re({props:{$$slots:{default:[Tt]},$$scope:{ctx:U}}}),S=new Be({props:{title:"Mixed Precision and Global Variables",local:"mixed-precision-and-global-variables",headingTag:"h2"}}),E=new C({props:{code:"YWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcihtaXhlZF9wcmVjaXNpb24lM0QlMjJiZjE2JTIyKQ==",highlighted:'accelerator = Accelerator(mixed_precision=<span class="hljs-string">&quot;bf16&quot;</span>)',wrap:!1}}),q=new C({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}}),D=new Be({props:{title:"Training Times on TPUs",local:"training-times-on-tpus",headingTag:"h2"}}),j=new Re({props:{$$slots:{default:[$t]},$$scope:{ctx:U}}}),te=new bt({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"),b=s(),m(g.$$.fragment),ne=s(),m(J.$$.fragment),ae=s(),_=r("p"),_.textContent=Se,se=s(),m(v.$$.fragment),ie=s(),G=r("p"),G.innerHTML=Fe,oe=s(),Y=r("p"),Y.innerHTML=He,re=s(),I=r("p"),I.innerHTML=Qe,ce=s(),V=r("p"),V.innerHTML=Ee,pe=s(),m(w.$$.fragment),me=s(),m(Z.$$.fragment),ye=s(),m(x.$$.fragment),Me=s(),m(T.$$.fragment),de=s(),W=r("p"),W.innerHTML=Ne,he=s(),m(A.$$.fragment),ue=s(),X=r("p"),X.innerHTML=Pe,fe=s(),m(k.$$.fragment),be=s(),m(R.$$.fragment),Ue=s(),B=r("p"),B.textContent=Le,we=s(),m(z.$$.fragment),Te=s(),m($.$$.fragment),$e=s(),m(S.$$.fragment),je=s(),F=r("p"),F.innerHTML=qe,Ce=s(),H=r("p"),H.innerHTML=Ke,ge=s(),Q=r("p"),Q.innerHTML=De,Je=s(),m(E.$$.fragment),_e=s(),N=r("p"),N.innerHTML=Oe,ve=s(),P=r("p"),P.innerHTML=et,Ge=s(),L=r("p"),L.innerHTML=tt,Ye=s(),m(q.$$.fragment),Ie=s(),K=r("p"),K.textContent=lt,Ve=s(),m(D.$$.fragment),Ze=s(),O=r("p"),O.textContent=nt,xe=s(),ee=r("p"),ee.textContent=at,We=s(),m(j.$$.fragment),Ae=s(),m(te.$$.fragment),Xe=s(),le=r("p"),this.h()},l(e){const t=ht("svelte-u9bgzb",document.head);a=c(t,"META",{name:!0,content:!0}),t.forEach(l),f=i(e),o=c(e,"P",{}),ct(o).forEach(l),b=i(e),y(g.$$.fragment,e),ne=i(e),y(J.$$.fragment,e),ae=i(e),_=c(e,"P",{"data-svelte-h":!0}),p(_)!=="svelte-d23dnh"&&(_.textContent=Se),se=i(e),y(v.$$.fragment,e),ie=i(e),G=c(e,"P",{"data-svelte-h":!0}),p(G)!=="svelte-1srxrxc"&&(G.innerHTML=Fe),oe=i(e),Y=c(e,"P",{"data-svelte-h":!0}),p(Y)!=="svelte-jduzug"&&(Y.innerHTML=He),re=i(e),I=c(e,"P",{"data-svelte-h":!0}),p(I)!=="svelte-1p7m292"&&(I.innerHTML=Qe),ce=i(e),V=c(e,"P",{"data-svelte-h":!0}),p(V)!=="svelte-18bfwf0"&&(V.innerHTML=Ee),pe=i(e),y(w.$$.fragment,e),me=i(e),y(Z.$$.fragment,e),ye=i(e),y(x.$$.fragment,e),Me=i(e),y(T.$$.fragment,e),de=i(e),W=c(e,"P",{"data-svelte-h":!0}),p(W)!=="svelte-ty61hq"&&(W.innerHTML=Ne),he=i(e),y(A.$$.fragment,e),ue=i(e),X=c(e,"P",{"data-svelte-h":!0}),p(X)!=="svelte-wyby5p"&&(X.innerHTML=Pe),fe=i(e),y(k.$$.fragment,e),be=i(e),y(R.$$.fragment,e),Ue=i(e),B=c(e,"P",{"data-svelte-h":!0}),p(B)!=="svelte-4gz0l1"&&(B.textContent=Le),we=i(e),y(z.$$.fragment,e),Te=i(e),y($.$$.fragment,e),$e=i(e),y(S.$$.fragment,e),je=i(e),F=c(e,"P",{"data-svelte-h":!0}),p(F)!=="svelte-12n9o3u"&&(F.innerHTML=qe),Ce=i(e),H=c(e,"P",{"data-svelte-h":!0}),p(H)!=="svelte-1l8j0ej"&&(H.innerHTML=Ke),ge=i(e),Q=c(e,"P",{"data-svelte-h":!0}),p(Q)!=="svelte-1x5gbwm"&&(Q.innerHTML=De),Je=i(e),y(E.$$.fragment,e),_e=i(e),N=c(e,"P",{"data-svelte-h":!0}),p(N)!=="svelte-g1oxbw"&&(N.innerHTML=Oe),ve=i(e),P=c(e,"P",{"data-svelte-h":!0}),p(P)!=="svelte-13m84js"&&(P.innerHTML=et),Ge=i(e),L=c(e,"P",{"data-svelte-h":!0}),p(L)!=="svelte-qa71s5"&&(L.innerHTML=tt),Ye=i(e),y(q.$$.fragment,e),Ie=i(e),K=c(e,"P",{"data-svelte-h":!0}),p(K)!=="svelte-90ggge"&&(K.textContent=lt),Ve=i(e),y(D.$$.fragment,e),Ze=i(e),O=c(e,"P",{"data-svelte-h":!0}),p(O)!=="svelte-1404l3y"&&(O.textContent=nt),xe=i(e),ee=c(e,"P",{"data-svelte-h":!0}),p(ee)!=="svelte-cqp35u"&&(ee.textContent=at),We=i(e),y(j.$$.fragment,e),Ae=i(e),y(te.$$.fragment,e),Xe=i(e),le=c(e,"P",{}),ct(le).forEach(l),this.h()},h(){pt(a,"name","hf:doc:metadata"),pt(a,"content",Ct)},m(e,t){ut(document.head,a),n(e,f,t),n(e,o,t),n(e,b,t),M(g,e,t),n(e,ne,t),M(J,e,t),n(e,ae,t),n(e,_,t),n(e,se,t),M(v,e,t),n(e,ie,t),n(e,G,t),n(e,oe,t),n(e,Y,t),n(e,re,t),n(e,I,t),n(e,ce,t),n(e,V,t),n(e,pe,t),M(w,e,t),n(e,me,t),M(Z,e,t),n(e,ye,t),M(x,e,t),n(e,Me,t),M(T,e,t),n(e,de,t),n(e,W,t),n(e,he,t),M(A,e,t),n(e,ue,t),n(e,X,t),n(e,fe,t),M(k,e,t),n(e,be,t),M(R,e,t),n(e,Ue,t),n(e,B,t),n(e,we,t),M(z,e,t),n(e,Te,t),M($,e,t),n(e,$e,t),M(S,e,t),n(e,je,t),n(e,F,t),n(e,Ce,t),n(e,H,t),n(e,ge,t),n(e,Q,t),n(e,Je,t),M(E,e,t),n(e,_e,t),n(e,N,t),n(e,ve,t),n(e,P,t),n(e,Ge,t),n(e,L,t),n(e,Ye,t),M(q,e,t),n(e,Ie,t),n(e,K,t),n(e,Ve,t),M(D,e,t),n(e,Ze,t),n(e,O,t),n(e,xe,t),n(e,ee,t),n(e,We,t),M(j,e,t),n(e,Ae,t),M(te,e,t),n(e,Xe,t),n(e,le,t),ke=!0},p(e,[t]){const st={};t&2&&(st.$$scope={dirty:t,ctx:e}),w.$set(st);const it={};t&2&&(it.$$scope={dirty:t,ctx:e}),T.$set(it);const ot={};t&2&&(ot.$$scope={dirty:t,ctx:e}),$.$set(ot);const rt={};t&2&&(rt.$$scope={dirty:t,ctx:e}),j.$set(rt)},i(e){ke||(d(g.$$.fragment,e),d(J.$$.fragment,e),d(v.$$.fragment,e),d(w.$$.fragment,e),d(Z.$$.fragment,e),d(x.$$.fragment,e),d(T.$$.fragment,e),d(A.$$.fragment,e),d(k.$$.fragment,e),d(R.$$.fragment,e),d(z.$$.fragment,e),d($.$$.fragment,e),d(S.$$.fragment,e),d(E.$$.fragment,e),d(q.$$.fragment,e),d(D.$$.fragment,e),d(j.$$.fragment,e),d(te.$$.fragment,e),ke=!0)},o(e){h(g.$$.fragment,e),h(J.$$.fragment,e),h(v.$$.fragment,e),h(w.$$.fragment,e),h(Z.$$.fragment,e),h(x.$$.fragment,e),h(T.$$.fragment,e),h(A.$$.fragment,e),h(k.$$.fragment,e),h(R.$$.fragment,e),h(z.$$.fragment,e),h($.$$.fragment,e),h(S.$$.fragment,e),h(E.$$.fragment,e),h(q.$$.fragment,e),h(D.$$.fragment,e),h(j.$$.fragment,e),h(te.$$.fragment,e),ke=!1},d(e){e&&(l(f),l(o),l(b),l(ne),l(ae),l(_),l(se),l(ie),l(G),l(oe),l(Y),l(re),l(I),l(ce),l(V),l(pe),l(me),l(ye),l(Me),l(de),l(W),l(he),l(ue),l(X),l(fe),l(be),l(Ue),l(B),l(we),l(Te),l($e),l(je),l(F),l(Ce),l(H),l(ge),l(Q),l(Je),l(_e),l(N),l(ve),l(P),l(Ge),l(L),l(Ye),l(Ie),l(K),l(Ve),l(Ze),l(O),l(xe),l(ee),l(We),l(Ae),l(Xe),l(le)),l(a),u(g,e),u(J,e),u(v,e),u(w,e),u(Z,e),u(x,e),u(T,e),u(A,e),u(k,e),u(R,e),u(z,e),u($,e),u(S,e),u(E,e),u(q,e),u(D,e),u(j,e),u(te,e)}}}const Ct='{"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 gt(U){return yt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class It extends Mt{constructor(a){super(),dt(this,a,gt,jt,mt,{})}}export{It as component};
