import{s as Zl,o as El,n as Sl}from"../chunks/scheduler.9bc65507.js";import{S as jl,i as Gl,g as l,s as r,u as c,A as ql,h as i,f as t,c as s,j as u,v as f,y as a,k as d,o as h,a as n,w as p,d as w,t as v,x as y}from"../chunks/index.78c82d43.js";import{T as Rl}from"../chunks/Tip.87d55b76.js";import{I as z}from"../chunks/IconCopyLink.bedaa44d.js";import{C as Q}from"../chunks/CodeBlock.48618ec2.js";function Wl(ut){let m,k="Are you unsure whether the model you wish to use already has a corresponding TensorFlow architecture?",b,T,C=" ",_,x,M=`Check the <code>model_type</code> field of the <code>config.json</code> of your model of choice
(<a href="https://huggingface.co/bert-base-uncased/blob/main/config.json#L14" rel="nofollow">example</a>). If the corresponding model folder in
🤗 Transformers has a file whose name starts with “modeling_tf”, it means that it has a corresponding TensorFlow
architecture (<a href="https://github.com/huggingface/transformers/tree/main/src/transformers/models/bert" rel="nofollow">example</a>).`;return{c(){m=l("p"),m.textContent=k,b=r(),T=l("p"),T.textContent=C,_=r(),x=l("p"),x.innerHTML=M},l(g){m=i(g,"P",{"data-svelte-h":!0}),a(m)!=="svelte-bjpicv"&&(m.textContent=k),b=s(g),T=i(g,"P",{"data-svelte-h":!0}),a(T)!=="svelte-1cdgjs8"&&(T.textContent=C),_=s(g),x=i(g,"P",{"data-svelte-h":!0}),a(x)!=="svelte-d10726"&&(x.innerHTML=M)},m(g,$){n(g,m,$),n(g,b,$),n(g,T,$),n(g,_,$),n(g,x,$)},p:Sl,d(g){g&&(t(m),t(b),t(T),t(_),t(x))}}}function Yl(ut){let m,k=`Before starting the work on a TensorFlow model architecture, double-check that there is no ongoing effort to do so.
You can search for <code>BrandNewBert</code> on the
<a href="https://github.com/huggingface/transformers/pulls?q=is%3Apr" rel="nofollow">pull request GitHub page</a> to confirm that there is no
TensorFlow-related pull request.`;return{c(){m=l("p"),m.innerHTML=k},l(b){m=i(b,"P",{"data-svelte-h":!0}),a(m)!=="svelte-1238l2j"&&(m.innerHTML=k)},m(b,T){n(b,m,T)},p:Sl,d(b){b&&t(m)}}}function Xl(ut){let m,k,b,T,C,_,x,M,g,$,mn="How to convert a 🤗 Transformers model to TensorFlow?",Lt,V,cn=`Having multiple frameworks available to use with 🤗 Transformers gives you flexibility to play their strengths when
designing your application, but it implies that compatibility must be added on a per-model basis. The good news is that
adding TensorFlow compatibility to an existing model is simpler than <a href="add_new_model">adding a new model from scratch</a>!
Whether you wish to have a deeper understanding of large TensorFlow models, make a major open-source contribution, or
enable TensorFlow for your model of choice, this guide is for you.`,Ht,D,fn=`This guide empowers you, a member of our community, to contribute TensorFlow model weights and/or
architectures to be used in 🤗 Transformers, with minimal supervision from the Hugging Face team. Writing a new model
is no small feat, but hopefully this guide will make it less of a rollercoaster 🎢 and more of a walk in the park 🚶.
Harnessing our collective experiences is absolutely critical to make this process increasingly easier, and thus we
highly encourage that you suggest improvements to this guide!`,Ft,K,pn="Before you dive deeper, it is recommended that you check the following resources if you’re new to 🤗 Transformers:",Pt,ee,wn='<li><a href="add_new_model#general-overview-of-transformers">General overview of 🤗 Transformers</a></li> <li><a href="https://huggingface.co/blog/tensorflow-philosophy" rel="nofollow">Hugging Face’s TensorFlow Philosophy</a></li>',Nt,te,vn=`In the remainder of this guide, you will learn what’s needed to add a new TensorFlow model architecture, the
procedure to convert PyTorch into TensorFlow model weights, and how to efficiently debug mismatches across ML
frameworks. Let’s get started!`,Bt,A,Ut,L,I,gt,oe,ln,mt,yn="Step-by-step guide to add TensorFlow model architecture code",At,ne,gn=`There are many ways to design a large model architecture, and multiple ways of implementing said design. However,
you might recall from our <a href="add_new_model#general-overview-of-transformers">general overview of 🤗 Transformers</a>
that we are an opinionated bunch - the ease of use of 🤗 Transformers relies on consistent design choices. From
experience, we can tell you a few important things about adding TensorFlow models:`,It,le,bn=`<li>Don’t reinvent the wheel! More often than not, there are at least two reference implementations you should check: the
PyTorch equivalent of the model you are implementing and other TensorFlow models for the same class of problems.</li> <li>Great model implementations survive the test of time. This doesn’t happen because the code is pretty, but rather
because the code is clear, easy to debug and build upon. If you make the life of the maintainers easy with your
TensorFlow implementation, by replicating the same patterns as in other TensorFlow models and minimizing the mismatch
to the PyTorch implementation, you ensure your contribution will be long lived.</li> <li>Ask for help when you’re stuck! The 🤗 Transformers team is here to help, and we’ve probably found solutions to the same
problems you’re facing.</li>`,Jt,ie,Tn="Here’s an overview of the steps needed to add a TensorFlow model architecture:",Rt,re,_n="<li>Select the model you wish to convert</li> <li>Prepare transformers dev environment</li> <li>(Optional) Understand theoretical aspects and the existing implementation</li> <li>Implement the model architecture</li> <li>Implement model tests</li> <li>Submit the pull request</li> <li>(Optional) Build demos and share with the world</li>",St,H,J,bt,se,rn,ct,xn="1.-3. Prepare your model contribution",Zt,ae,Cn="<strong>1. Select the model you wish to convert</strong>",Et,de,$n=`Let’s start off with the basics: the first thing you need to know is the architecture you want to convert. If you
don’t have your eyes set on a specific architecture, asking the 🤗 Transformers team for suggestions is a great way to
maximize your impact - we will guide you towards the most prominent architectures that are missing on the TensorFlow
side. If the specific model you want to use with TensorFlow already has a TensorFlow architecture implementation in
🤗 Transformers but is lacking weights, feel free to jump straight into the
<a href="#adding-tensorflow-weights-to-hub">weight conversion section</a>
of this page.`,jt,he,kn=`For simplicity, the remainder of this guide assumes you’ve decided to contribute with the TensorFlow version of
<em>BrandNewBert</em> (the same example as in the <a href="add_new_model">guide</a> to add a new model from scratch).`,Gt,R,qt,ue,Mn="<strong>2. Prepare transformers dev environment</strong>",Wt,me,Ln=`Having selected the model architecture, open a draft PR to signal your intention to work on it. Follow the
instructions below to set up your environment and open a draft PR.`,Yt,ce,Hn=`<li><p>Fork the <a href="https://github.com/huggingface/transformers" rel="nofollow">repository</a> by clicking on the ‘Fork’ button on the
repository’s page. This creates a copy of the code under your GitHub user account.</p></li> <li><p>Clone your <code>transformers</code> fork to your local disk, and add the base repository as a remote:</p></li>`,Xt,fe,Ot,S,Fn="<li>Set up a development environment, for instance by running the following command:</li>",zt,pe,Qt,we,Pn=`Depending on your OS, and since the number of optional dependencies of Transformers is growing, you might get a
failure with this command. If that’s the case make sure to install TensorFlow then do:`,Vt,ve,Dt,ye,Nn="<strong>Note:</strong> You don’t need to have CUDA installed. Making the new model work on CPU is sufficient.",Kt,Z,Bn="<li>Create a branch with a descriptive name from your main branch</li>",eo,ge,to,E,Un="<li>Fetch and rebase to current main</li>",oo,be,no,j,An=`<li><p>Add an empty <code>.py</code> file in <code>transformers/src/models/brandnewbert/</code> named <code>modeling_tf_brandnewbert.py</code>. This will
be your TensorFlow model file.</p></li> <li><p>Push the changes to your account using:</p></li>`,lo,Te,io,G,In=`<li><p>Once you are satisfied, go to the webpage of your fork on GitHub. Click on “Pull request”. Make sure to add the
GitHub handle of some members of the Hugging Face team as reviewers, so that the Hugging Face team gets notified for
future changes.</p></li> <li><p>Change the PR into a draft by clicking on “Convert to draft” on the right of the GitHub pull request web page.</p></li>`,ro,_e,Jn="Now you have set up a development environment to port <em>BrandNewBert</em> to TensorFlow in 🤗 Transformers.",so,xe,Rn="<strong>3. (Optional) Understand theoretical aspects and the existing implementation</strong>",ao,Ce,Sn=`You should take some time to read <em>BrandNewBert’s</em> paper, if such descriptive work exists. There might be large
sections of the paper that are difficult to understand. If this is the case, this is fine - don’t worry! The goal is
not to get a deep theoretical understanding of the paper, but to extract the necessary information required to
effectively re-implement the model in 🤗 Transformers using TensorFlow. That being said, you don’t have to spend too
much time on the theoretical aspects, but rather focus on the practical ones, namely the existing model documentation
page (e.g. <a href="model_doc/bert">model docs for BERT</a>).`,ho,$e,Zn=`After you’ve grasped the basics of the models you are about to implement, it’s important to understand the existing
implementation. This is a great chance to confirm that a working implementation matches your expectations for the
model, as well as to foresee technical challenges on the TensorFlow side.`,uo,ke,En=`It’s perfectly natural that you feel overwhelmed with the amount of information that you’ve just absorbed. It is
definitely not a requirement that you understand all facets of the model at this stage. Nevertheless, we highly
encourage you to clear any pressing questions in our <a href="https://discuss.huggingface.co/" rel="nofollow">forum</a>.`,mo,F,q,Tt,Me,sn,ft,jn="4. Model implementation",co,Le,Gn=`Now it’s time to finally start coding. Our suggested starting point is the PyTorch file itself: copy the contents of
<code>modeling_brand_new_bert.py</code> inside <code>src/transformers/models/brand_new_bert/</code> into
<code>modeling_tf_brand_new_bert.py</code>. The goal of this section is to modify the file and update the import structure of
🤗 Transformers such that you can import <code>TFBrandNewBert</code> and
<code>TFBrandNewBert.from_pretrained(model_repo, from_pt=True)</code> successfully loads a working TensorFlow <em>BrandNewBert</em> model.`,fo,He,qn=`Sadly, there is no prescription to convert a PyTorch model into TensorFlow. You can, however, follow our selection of
tips to make the process as smooth as possible:`,po,Fe,Wn=`<li>Prepend <code>TF</code> to the name of all classes (e.g. <code>BrandNewBert</code> becomes <code>TFBrandNewBert</code>).</li> <li>Most PyTorch operations have a direct TensorFlow replacement. For example, <code>torch.nn.Linear</code> corresponds to
<code>tf.keras.layers.Dense</code>, <code>torch.nn.Dropout</code> corresponds to <code>tf.keras.layers.Dropout</code>, etc. If you’re not sure
about a specific operation, you can use the <a href="https://www.tensorflow.org/api_docs/python/tf" rel="nofollow">TensorFlow documentation</a>
or the <a href="https://pytorch.org/docs/stable/" rel="nofollow">PyTorch documentation</a>.</li> <li>Look for patterns in the 🤗 Transformers codebase. If you come across a certain operation that doesn’t have a direct
replacement, the odds are that someone else already had the same problem.</li> <li>By default, keep the same variable names and structure as in PyTorch. This will make it easier to debug, track
issues, and add fixes down the line.</li> <li>Some layers have different default values in each framework. A notable example is the batch normalization layer’s
epsilon (<code>1e-5</code> in <a href="https://pytorch.org/docs/stable/generated/torch.nn.BatchNorm2d.html#torch.nn.BatchNorm2d" rel="nofollow">PyTorch</a>
and <code>1e-3</code> in <a href="https://www.tensorflow.org/api_docs/python/tf/keras/layers/BatchNormalization" rel="nofollow">TensorFlow</a>).
Double-check the documentation!</li> <li>PyTorch’s <code>nn.Parameter</code> variables typically need to be initialized within TF Layer’s <code>build()</code>. See the following
example: <a href="https://github.com/huggingface/transformers/blob/655f72a6896c0533b1bdee519ed65a059c2425ac/src/transformers/models/vit_mae/modeling_vit_mae.py#L212" rel="nofollow">PyTorch</a> /
<a href="https://github.com/huggingface/transformers/blob/655f72a6896c0533b1bdee519ed65a059c2425ac/src/transformers/models/vit_mae/modeling_tf_vit_mae.py#L220" rel="nofollow">TensorFlow</a></li> <li>If the PyTorch model has a <code>#copied from ...</code> on top of a function, the odds are that your TensorFlow model can also
borrow that function from the architecture it was copied from, assuming it has a TensorFlow architecture.</li> <li>Assigning the <code>name</code> attribute correctly in TensorFlow functions is critical to do the <code>from_pt=True</code> weight
cross-loading. <code>name</code> is almost always the name of the corresponding variable in the PyTorch code. If <code>name</code> is not
properly set, you will see it in the error message when loading the model weights.</li> <li>The logic of the base model class, <code>BrandNewBertModel</code>, will actually reside in <code>TFBrandNewBertMainLayer</code>, a Keras
layer subclass (<a href="https://github.com/huggingface/transformers/blob/4fd32a1f499e45f009c2c0dea4d81c321cba7e02/src/transformers/models/bert/modeling_tf_bert.py#L719" rel="nofollow">example</a>).
<code>TFBrandNewBertModel</code> will simply be a wrapper around this layer.</li> <li>Keras models need to be built in order to load pretrained weights. For that reason, <code>TFBrandNewBertPreTrainedModel</code>
will need to hold an example of inputs to the model, the <code>dummy_inputs</code>
(<a href="https://github.com/huggingface/transformers/blob/4fd32a1f499e45f009c2c0dea4d81c321cba7e02/src/transformers/models/bert/modeling_tf_bert.py#L916" rel="nofollow">example</a>).</li> <li>If you get stuck, ask for help - we’re here to help you! 🤗</li>`,wo,Pe,Yn=`In addition to the model file itself, you will also need to add the pointers to the model classes and related
documentation pages. You can complete this part entirely following the patterns in other PRs
(<a href="https://github.com/huggingface/transformers/pull/18020/files" rel="nofollow">example</a>). Here’s a list of the needed manual
changes:`,vo,Ne,Xn="<li>Include all public classes of <em>BrandNewBert</em> in <code>src/transformers/__init__.py</code></li> <li>Add <em>BrandNewBert</em> classes to the corresponding Auto classes in <code>src/transformers/models/auto/modeling_tf_auto.py</code></li> <li>Include the modeling file in the documentation test file list in <code>utils/documentation_tests.txt</code></li> <li>Add the lazy loading classes related to <em>BrandNewBert</em> in <code>src/transformers/utils/dummy_tf_objects.py</code></li> <li>Update the import structures for the public classes in <code>src/transformers/models/brand_new_bert/__init__.py</code></li> <li>Add the documentation pointers to the public methods of <em>BrandNewBert</em> in <code>docs/source/en/model_doc/brand_new_bert.md</code></li> <li>Add yourself to the list of contributors to <em>BrandNewBert</em> in <code>docs/source/en/model_doc/brand_new_bert.md</code></li> <li>Finally, add a green tick ✅ to the TensorFlow column of <em>BrandNewBert</em> in <code>docs/source/en/index.md</code></li>",yo,Be,On=`When you’re happy with your implementation, run the following checklist to confirm that your model architecture is
ready:`,go,Ue,zn=`<li>All layers that behave differently at train time (e.g. Dropout) are called with a <code>training</code> argument, which is
propagated all the way from the top-level classes</li> <li>You have used <code>#copied from ...</code> whenever possible</li> <li><code>TFBrandNewBertMainLayer</code> and all classes that use it have their <code>call</code> function decorated with <code>@unpack_inputs</code></li> <li><code>TFBrandNewBertMainLayer</code> is decorated with <code>@keras_serializable</code></li> <li>A TensorFlow model can be loaded from PyTorch weights using <code>TFBrandNewBert.from_pretrained(model_repo, from_pt=True)</code></li> <li>You can call the TensorFlow model using the expected input format</li>`,bo,P,W,_t,Ae,an,pt,Qn="5. Add model tests",To,Ie,Vn=`Hurray, you’ve implemented a TensorFlow model! Now it’s time to add tests to make sure that your model behaves as
expected. As in the previous section, we suggest you start by copying the <code>test_modeling_brand_new_bert.py</code> file in
<code>tests/models/brand_new_bert/</code> into <code>test_modeling_tf_brand_new_bert.py</code>, and continue by making the necessary
TensorFlow replacements. For now, in all <code>.from_pretrained()</code> calls, you should use the <code>from_pt=True</code> flag to load
the existing PyTorch weights.`,_o,Je,Dn="After you’re done, it’s time for the moment of truth: run the tests! 😬",xo,Re,Co,Se,Kn=`The most likely outcome is that you’ll see a bunch of errors. Don’t worry, this is expected! Debugging ML models is
notoriously hard, and the key ingredient to success is patience (and <code>breakpoint()</code>). In our experience, the hardest
problems arise from subtle mismatches between ML frameworks, for which we have a few pointers at the end of this guide.
In other cases, a general test might not be directly applicable to your model, in which case we suggest an override
at the model test class level. Regardless of the issue, don’t hesitate to ask for help in your draft pull request if
you’re stuck.`,$o,Ze,el="When all tests pass, congratulations, your model is nearly ready to be added to the 🤗 Transformers library! 🎉",ko,N,Y,xt,Ee,dn,wt,tl="6.-7. Ensure everyone can use your model",Mo,je,ol="<strong>6. Submit the pull request</strong>",Lo,Ge,nl=`Once you’re done with the implementation and the tests, it’s time to submit a pull request. Before pushing your code,
run our code formatting utility, <code>make fixup</code> 🪄. This will automatically fix any formatting issues, which would cause
our automatic checks to fail.`,Ho,qe,ll=`It’s now time to convert your draft pull request into a real pull request. To do so, click on the “Ready for
review” button and add Joao (<code>@gante</code>) and Matt (<code>@Rocketknight1</code>) as reviewers. A model pull request will need
at least 3 reviewers, but they will take care of finding appropriate additional reviewers for your model.`,Fo,We,il=`After all reviewers are happy with the state of your PR, the final action point is to remove the <code>from_pt=True</code> flag in
<code>.from_pretrained()</code> calls. Since there are no TensorFlow weights, you will have to add them! Check the section
below for instructions on how to do it.`,Po,Ye,rl=`Finally, when the TensorFlow weights get merged, you have at least 3 reviewer approvals, and all CI checks are
green, double-check the tests locally one last time`,No,Xe,Bo,Oe,sl="and we will merge your PR! Congratulations on the milestone 🎉",Uo,ze,al="<strong>7. (Optional) Build demos and share with the world</strong>",Ao,Qe,dl=`One of the hardest parts about open-source is discovery. How can the other users learn about the existence of your
fabulous TensorFlow contribution? With proper communication, of course! 📣`,Io,Ve,hl="There are two main ways to share your model with the community:",Jo,De,ul=`<li>Build demos. These include Gradio demos, notebooks, and other fun ways to show off your model. We highly
encourage you to add a notebook to our <a href="https://huggingface.co/docs/transformers/community" rel="nofollow">community-driven demos</a>.</li> <li>Share stories on social media like Twitter and LinkedIn. You should be proud of your work and share
your achievement with the community - your model can now be used by thousands of engineers and researchers around
the world 🌍! We will be happy to retweet your posts and help you share your work with the community.</li>`,Ro,B,X,Ct,Ke,hn,vt,ml="Adding TensorFlow weights to 🤗 Hub",So,et,cl=`Assuming that the TensorFlow model architecture is available in 🤗 Transformers, converting PyTorch weights into
TensorFlow weights is a breeze!`,Zo,tt,fl="Here’s how to do it:",Eo,ot,pl=`<li>Make sure you are logged into your Hugging Face account in your terminal. You can log in using the command
<code>huggingface-cli login</code> (you can find your access tokens <a href="https://huggingface.co/settings/tokens" rel="nofollow">here</a>)</li> <li>Run <code>transformers-cli pt-to-tf --model-name foo/bar</code>, where <code>foo/bar</code> is the name of the model repository
containing the PyTorch weights you want to convert</li> <li>Tag <code>@joaogante</code> and <code>@Rocketknight1</code> in the 🤗 Hub PR the command above has just created</li>`,jo,nt,wl="That’s it! 🎉",Go,U,O,$t,lt,un,yt,vl="Debugging mismatches across ML frameworks 🐛",qo,it,yl=`At some point, when adding a new architecture or when creating TensorFlow weights for an existing architecture, you
might come across errors complaining about mismatches between PyTorch and TensorFlow. You might even decide to open the
model architecture code for the two frameworks, and find that they look identical. What’s going on? 🤔`,Wo,rt,gl=`First of all, let’s talk about why understanding these mismatches matters. Many community members will use 🤗
Transformers models out of the box, and trust that our models behave as expected. When there is a large mismatch
between the two frameworks, it implies that the model is not following the reference implementation for at least one
of the frameworks. This might lead to silent failures, in which the model runs but has poor performance. This is
arguably worse than a model that fails to run at all! To that end, we aim at having a framework mismatch smaller than
<code>1e-5</code> at all stages of the model.`,Yo,st,bl=`As in other numerical problems, the devil is in the details. And as in any detail-oriented craft, the secret
ingredient here is patience. Here is our suggested workflow for when you come across this type of issues:`,Xo,at,Tl=`<li>Locate the source of mismatches. The model you’re converting probably has near identical inner variables up to a
certain point. Place <code>breakpoint()</code> statements in the two frameworks’ architectures, and compare the values of the
numerical variables in a top-down fashion until you find the source of the problems.</li> <li>Now that you’ve pinpointed the source of the issue, get in touch with the 🤗 Transformers team. It is possible
that we’ve seen a similar problem before and can promptly provide a solution. As a fallback, scan popular pages
like StackOverflow and GitHub issues.</li> <li>If there is no solution in sight, it means you’ll have to go deeper. The good news is that you’ve located the
issue, so you can focus on the problematic instruction, abstracting away the rest of the model! The bad news is
that you’ll have to venture into the source implementation of said instruction. In some cases, you might find an
issue with a reference implementation - don’t abstain from opening an issue in the upstream repository.</li>`,Oo,dt,_l=`In some cases, in discussion with the 🤗 Transformers team, we might find that fixing the mismatch is infeasible.
When the mismatch is very small in the output layers of the model (but potentially large in the hidden states), we
might decide to ignore it in favor of distributing the model. The <code>pt-to-tf</code> CLI mentioned above has a <code>--max-error</code>
flag to override the error message at weight conversion time.`,zo,kt,Qo;return M=new z({}),A=new Rl({props:{$$slots:{default:[Wl]},$$scope:{ctx:ut}}}),oe=new z({}),se=new z({}),R=new Rl({props:{$$slots:{default:[Yl]},$$scope:{ctx:ut}}}),fe=new Q({props:{code:"Z2l0JTIwY2xvbmUlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkYlNUJ5b3VyJTIwR2l0aHViJTIwaGFuZGxlJTVEJTJGdHJhbnNmb3JtZXJzLmdpdCUwQWNkJTIwdHJhbnNmb3JtZXJzJTBBZ2l0JTIwcmVtb3RlJTIwYWRkJTIwdXBzdHJlYW0lMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZodWdnaW5nZmFjZSUyRnRyYW5zZm9ybWVycy5naXQ=",highlighted:`git <span class="hljs-built_in">clone</span> https://github.com/[your Github handle]/transformers.git
<span class="hljs-built_in">cd</span> transformers
git remote add upstream https://github.com/huggingface/transformers.git`}}),pe=new Q({props:{code:"cHl0aG9uJTIwLW0lMjB2ZW52JTIwLmVudiUwQXNvdXJjZSUyMC5lbnYlMkZiaW4lMkZhY3RpdmF0ZSUwQXBpcCUyMGluc3RhbGwlMjAtZSUyMCUyMi4lNUJkZXYlNUQlMjI=",highlighted:`python -m venv .<span class="hljs-built_in">env</span>
<span class="hljs-built_in">source</span> .<span class="hljs-built_in">env</span>/bin/activate
pip install -e <span class="hljs-string">&quot;.[dev]&quot;</span>`}}),ve=new Q({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1lJTIwJTIyLiU1QnF1YWxpdHklNUQlMjI=",highlighted:'pip install -e <span class="hljs-string">&quot;.[quality]&quot;</span>'}}),ge=new Q({props:{code:"Z2l0JTIwY2hlY2tvdXQlMjAtYiUyMGFkZF90Zl9icmFuZF9uZXdfYmVydA==",highlighted:"git checkout -b add_tf_brand_new_bert"}}),be=new Q({props:{code:"Z2l0JTIwZmV0Y2glMjB1cHN0cmVhbSUwQWdpdCUyMHJlYmFzZSUyMHVwc3RyZWFtJTJGbWFpbg==",highlighted:`git fetch upstream
git rebase upstream/main`}}),Te=new Q({props:{code:"Z2l0JTIwYWRkJTIwLiUwQWdpdCUyMGNvbW1pdCUyMC1tJTIwJTIyaW5pdGlhbCUyMGNvbW1pdCUyMiUwQWdpdCUyMHB1c2glMjAtdSUyMG9yaWdpbiUyMGFkZF90Zl9icmFuZF9uZXdfYmVydA==",highlighted:`git add .
git commit -m <span class="hljs-string">&quot;initial commit&quot;</span>
git push -u origin add_tf_brand_new_bert`}}),Me=new z({}),Ae=new z({}),Re=new Q({props:{code:"TlZJRElBX1RGMzJfT1ZFUlJJREUlM0QwJTIwUlVOX1NMT1clM0QxJTIwUlVOX1BUX1RGX0NST1NTX1RFU1RTJTNEMSUyMCU1QyUwQXB5LnRlc3QlMjAtdnYlMjB0ZXN0cyUyRm1vZGVscyUyRmJyYW5kX25ld19iZXJ0JTJGdGVzdF9tb2RlbGluZ190Zl9icmFuZF9uZXdfYmVydC5weQ==",highlighted:`NVIDIA_TF32_OVERRIDE=0 RUN_SLOW=1 RUN_PT_TF_CROSS_TESTS=1 \\
py.test -vv tests/models/brand_new_bert/test_modeling_tf_brand_new_bert.py`}}),Ee=new z({}),Xe=new Q({props:{code:"TlZJRElBX1RGMzJfT1ZFUlJJREUlM0QwJTIwUlVOX1NMT1clM0QxJTIwUlVOX1BUX1RGX0NST1NTX1RFU1RTJTNEMSUyMCU1QyUwQXB5LnRlc3QlMjAtdnYlMjB0ZXN0cyUyRm1vZGVscyUyRmJyYW5kX25ld19iZXJ0JTJGdGVzdF9tb2RlbGluZ190Zl9icmFuZF9uZXdfYmVydC5weQ==",highlighted:`NVIDIA_TF32_OVERRIDE=0 RUN_SLOW=1 RUN_PT_TF_CROSS_TESTS=1 \\
py.test -vv tests/models/brand_new_bert/test_modeling_tf_brand_new_bert.py`}}),Ke=new z({}),lt=new z({}),{c(){m=l("meta"),k=r(),b=l("p"),T=r(),C=l("h1"),_=l("a"),x=l("span"),c(M.$$.fragment),g=r(),$=l("span"),$.textContent=mn,Lt=r(),V=l("p"),V.innerHTML=cn,Ht=r(),D=l("p"),D.textContent=fn,Ft=r(),K=l("p"),K.textContent=pn,Pt=r(),ee=l("ul"),ee.innerHTML=wn,Nt=r(),te=l("p"),te.textContent=vn,Bt=r(),c(A.$$.fragment),Ut=r(),L=l("h2"),I=l("a"),gt=l("span"),c(oe.$$.fragment),ln=r(),mt=l("span"),mt.textContent=yn,At=r(),ne=l("p"),ne.innerHTML=gn,It=r(),le=l("ul"),le.innerHTML=bn,Jt=r(),ie=l("p"),ie.textContent=Tn,Rt=r(),re=l("ol"),re.innerHTML=_n,St=r(),H=l("h3"),J=l("a"),bt=l("span"),c(se.$$.fragment),rn=r(),ct=l("span"),ct.textContent=xn,Zt=r(),ae=l("p"),ae.innerHTML=Cn,Et=r(),de=l("p"),de.innerHTML=$n,jt=r(),he=l("p"),he.innerHTML=kn,Gt=r(),c(R.$$.fragment),qt=r(),ue=l("p"),ue.innerHTML=Mn,Wt=r(),me=l("p"),me.textContent=Ln,Yt=r(),ce=l("ol"),ce.innerHTML=Hn,Xt=r(),c(fe.$$.fragment),Ot=r(),S=l("ol"),S.innerHTML=Fn,zt=r(),c(pe.$$.fragment),Qt=r(),we=l("p"),we.textContent=Pn,Vt=r(),c(ve.$$.fragment),Dt=r(),ye=l("p"),ye.innerHTML=Nn,Kt=r(),Z=l("ol"),Z.innerHTML=Bn,eo=r(),c(ge.$$.fragment),to=r(),E=l("ol"),E.innerHTML=Un,oo=r(),c(be.$$.fragment),no=r(),j=l("ol"),j.innerHTML=An,lo=r(),c(Te.$$.fragment),io=r(),G=l("ol"),G.innerHTML=In,ro=r(),_e=l("p"),_e.innerHTML=Jn,so=r(),xe=l("p"),xe.innerHTML=Rn,ao=r(),Ce=l("p"),Ce.innerHTML=Sn,ho=r(),$e=l("p"),$e.textContent=Zn,uo=r(),ke=l("p"),ke.innerHTML=En,mo=r(),F=l("h3"),q=l("a"),Tt=l("span"),c(Me.$$.fragment),sn=r(),ft=l("span"),ft.textContent=jn,co=r(),Le=l("p"),Le.innerHTML=Gn,fo=r(),He=l("p"),He.textContent=qn,po=r(),Fe=l("ul"),Fe.innerHTML=Wn,wo=r(),Pe=l("p"),Pe.innerHTML=Yn,vo=r(),Ne=l("ul"),Ne.innerHTML=Xn,yo=r(),Be=l("p"),Be.textContent=On,go=r(),Ue=l("ol"),Ue.innerHTML=zn,bo=r(),P=l("h3"),W=l("a"),_t=l("span"),c(Ae.$$.fragment),an=r(),pt=l("span"),pt.textContent=Qn,To=r(),Ie=l("p"),Ie.innerHTML=Vn,_o=r(),Je=l("p"),Je.textContent=Dn,xo=r(),c(Re.$$.fragment),Co=r(),Se=l("p"),Se.innerHTML=Kn,$o=r(),Ze=l("p"),Ze.textContent=el,ko=r(),N=l("h3"),Y=l("a"),xt=l("span"),c(Ee.$$.fragment),dn=r(),wt=l("span"),wt.textContent=tl,Mo=r(),je=l("p"),je.innerHTML=ol,Lo=r(),Ge=l("p"),Ge.innerHTML=nl,Ho=r(),qe=l("p"),qe.innerHTML=ll,Fo=r(),We=l("p"),We.innerHTML=il,Po=r(),Ye=l("p"),Ye.textContent=rl,No=r(),c(Xe.$$.fragment),Bo=r(),Oe=l("p"),Oe.textContent=sl,Uo=r(),ze=l("p"),ze.innerHTML=al,Ao=r(),Qe=l("p"),Qe.textContent=dl,Io=r(),Ve=l("p"),Ve.textContent=hl,Jo=r(),De=l("ul"),De.innerHTML=ul,Ro=r(),B=l("h2"),X=l("a"),Ct=l("span"),c(Ke.$$.fragment),hn=r(),vt=l("span"),vt.textContent=ml,So=r(),et=l("p"),et.textContent=cl,Zo=r(),tt=l("p"),tt.textContent=fl,Eo=r(),ot=l("ol"),ot.innerHTML=pl,jo=r(),nt=l("p"),nt.textContent=wl,Go=r(),U=l("h2"),O=l("a"),$t=l("span"),c(lt.$$.fragment),un=r(),yt=l("span"),yt.textContent=vl,qo=r(),it=l("p"),it.textContent=yl,Wo=r(),rt=l("p"),rt.innerHTML=gl,Yo=r(),st=l("p"),st.textContent=bl,Xo=r(),at=l("ol"),at.innerHTML=Tl,Oo=r(),dt=l("p"),dt.innerHTML=_l,zo=r(),kt=l("p"),this.h()},l(e){const o=ql("svelte-1phssyn",document.head);m=i(o,"META",{name:!0,content:!0}),o.forEach(t),k=s(e),b=i(e,"P",{}),u(b).forEach(t),T=s(e),C=i(e,"H1",{class:!0});var ht=u(C);_=i(ht,"A",{id:!0,class:!0,href:!0});var Mt=u(_);x=i(Mt,"SPAN",{});var xl=u(x);f(M.$$.fragment,xl),xl.forEach(t),Mt.forEach(t),g=s(ht),$=i(ht,"SPAN",{"data-svelte-h":!0}),a($)!=="svelte-lanu9p"&&($.textContent=mn),ht.forEach(t),Lt=s(e),V=i(e,"P",{"data-svelte-h":!0}),a(V)!=="svelte-un598u"&&(V.innerHTML=cn),Ht=s(e),D=i(e,"P",{"data-svelte-h":!0}),a(D)!=="svelte-1m7mnyo"&&(D.textContent=fn),Ft=s(e),K=i(e,"P",{"data-svelte-h":!0}),a(K)!=="svelte-1a30pti"&&(K.textContent=pn),Pt=s(e),ee=i(e,"UL",{"data-svelte-h":!0}),a(ee)!=="svelte-1syo9f3"&&(ee.innerHTML=wn),Nt=s(e),te=i(e,"P",{"data-svelte-h":!0}),a(te)!=="svelte-flc7p5"&&(te.textContent=vn),Bt=s(e),f(A.$$.fragment,e),Ut=s(e),L=i(e,"H2",{class:!0});var Vo=u(L);I=i(Vo,"A",{id:!0,class:!0,href:!0});var Cl=u(I);gt=i(Cl,"SPAN",{});var $l=u(gt);f(oe.$$.fragment,$l),$l.forEach(t),Cl.forEach(t),ln=s(Vo),mt=i(Vo,"SPAN",{"data-svelte-h":!0}),a(mt)!=="svelte-1isea90"&&(mt.textContent=yn),Vo.forEach(t),At=s(e),ne=i(e,"P",{"data-svelte-h":!0}),a(ne)!=="svelte-1nfvtxf"&&(ne.innerHTML=gn),It=s(e),le=i(e,"UL",{"data-svelte-h":!0}),a(le)!=="svelte-r4pwei"&&(le.innerHTML=bn),Jt=s(e),ie=i(e,"P",{"data-svelte-h":!0}),a(ie)!=="svelte-12ug9wa"&&(ie.textContent=Tn),Rt=s(e),re=i(e,"OL",{"data-svelte-h":!0}),a(re)!=="svelte-b2inhb"&&(re.innerHTML=_n),St=s(e),H=i(e,"H3",{class:!0});var Do=u(H);J=i(Do,"A",{id:!0,class:!0,href:!0});var kl=u(J);bt=i(kl,"SPAN",{});var Ml=u(bt);f(se.$$.fragment,Ml),Ml.forEach(t),kl.forEach(t),rn=s(Do),ct=i(Do,"SPAN",{"data-svelte-h":!0}),a(ct)!=="svelte-6nhupf"&&(ct.textContent=xn),Do.forEach(t),Zt=s(e),ae=i(e,"P",{"data-svelte-h":!0}),a(ae)!=="svelte-rqidwu"&&(ae.innerHTML=Cn),Et=s(e),de=i(e,"P",{"data-svelte-h":!0}),a(de)!=="svelte-15g871i"&&(de.innerHTML=$n),jt=s(e),he=i(e,"P",{"data-svelte-h":!0}),a(he)!=="svelte-mkqbuc"&&(he.innerHTML=kn),Gt=s(e),f(R.$$.fragment,e),qt=s(e),ue=i(e,"P",{"data-svelte-h":!0}),a(ue)!=="svelte-w68cw6"&&(ue.innerHTML=Mn),Wt=s(e),me=i(e,"P",{"data-svelte-h":!0}),a(me)!=="svelte-4rco38"&&(me.textContent=Ln),Yt=s(e),ce=i(e,"OL",{"data-svelte-h":!0}),a(ce)!=="svelte-klt7ii"&&(ce.innerHTML=Hn),Xt=s(e),f(fe.$$.fragment,e),Ot=s(e),S=i(e,"OL",{start:!0,"data-svelte-h":!0}),a(S)!=="svelte-9h285g"&&(S.innerHTML=Fn),zt=s(e),f(pe.$$.fragment,e),Qt=s(e),we=i(e,"P",{"data-svelte-h":!0}),a(we)!=="svelte-23rgus"&&(we.textContent=Pn),Vt=s(e),f(ve.$$.fragment,e),Dt=s(e),ye=i(e,"P",{"data-svelte-h":!0}),a(ye)!=="svelte-6bybv3"&&(ye.innerHTML=Nn),Kt=s(e),Z=i(e,"OL",{start:!0,"data-svelte-h":!0}),a(Z)!=="svelte-1v0vz83"&&(Z.innerHTML=Bn),eo=s(e),f(ge.$$.fragment,e),to=s(e),E=i(e,"OL",{start:!0,"data-svelte-h":!0}),a(E)!=="svelte-kgyer5"&&(E.innerHTML=Un),oo=s(e),f(be.$$.fragment,e),no=s(e),j=i(e,"OL",{start:!0,"data-svelte-h":!0}),a(j)!=="svelte-1pq71wn"&&(j.innerHTML=An),lo=s(e),f(Te.$$.fragment,e),io=s(e),G=i(e,"OL",{start:!0,"data-svelte-h":!0}),a(G)!=="svelte-1ekq61w"&&(G.innerHTML=In),ro=s(e),_e=i(e,"P",{"data-svelte-h":!0}),a(_e)!=="svelte-beu7sg"&&(_e.innerHTML=Jn),so=s(e),xe=i(e,"P",{"data-svelte-h":!0}),a(xe)!=="svelte-1l0tpib"&&(xe.innerHTML=Rn),ao=s(e),Ce=i(e,"P",{"data-svelte-h":!0}),a(Ce)!=="svelte-1get462"&&(Ce.innerHTML=Sn),ho=s(e),$e=i(e,"P",{"data-svelte-h":!0}),a($e)!=="svelte-16kl1f2"&&($e.textContent=Zn),uo=s(e),ke=i(e,"P",{"data-svelte-h":!0}),a(ke)!=="svelte-1skghto"&&(ke.innerHTML=En),mo=s(e),F=i(e,"H3",{class:!0});var Ko=u(F);q=i(Ko,"A",{id:!0,class:!0,href:!0});var Ll=u(q);Tt=i(Ll,"SPAN",{});var Hl=u(Tt);f(Me.$$.fragment,Hl),Hl.forEach(t),Ll.forEach(t),sn=s(Ko),ft=i(Ko,"SPAN",{"data-svelte-h":!0}),a(ft)!=="svelte-1ir078"&&(ft.textContent=jn),Ko.forEach(t),co=s(e),Le=i(e,"P",{"data-svelte-h":!0}),a(Le)!=="svelte-94ipqa"&&(Le.innerHTML=Gn),fo=s(e),He=i(e,"P",{"data-svelte-h":!0}),a(He)!=="svelte-55id0v"&&(He.textContent=qn),po=s(e),Fe=i(e,"UL",{"data-svelte-h":!0}),a(Fe)!=="svelte-p4ei59"&&(Fe.innerHTML=Wn),wo=s(e),Pe=i(e,"P",{"data-svelte-h":!0}),a(Pe)!=="svelte-q00s49"&&(Pe.innerHTML=Yn),vo=s(e),Ne=i(e,"UL",{"data-svelte-h":!0}),a(Ne)!=="svelte-1tbo2ym"&&(Ne.innerHTML=Xn),yo=s(e),Be=i(e,"P",{"data-svelte-h":!0}),a(Be)!=="svelte-16z62s3"&&(Be.textContent=On),go=s(e),Ue=i(e,"OL",{"data-svelte-h":!0}),a(Ue)!=="svelte-fev0iu"&&(Ue.innerHTML=zn),bo=s(e),P=i(e,"H3",{class:!0});var en=u(P);W=i(en,"A",{id:!0,class:!0,href:!0});var Fl=u(W);_t=i(Fl,"SPAN",{});var Pl=u(_t);f(Ae.$$.fragment,Pl),Pl.forEach(t),Fl.forEach(t),an=s(en),pt=i(en,"SPAN",{"data-svelte-h":!0}),a(pt)!=="svelte-4zgi31"&&(pt.textContent=Qn),en.forEach(t),To=s(e),Ie=i(e,"P",{"data-svelte-h":!0}),a(Ie)!=="svelte-1y1b8z6"&&(Ie.innerHTML=Vn),_o=s(e),Je=i(e,"P",{"data-svelte-h":!0}),a(Je)!=="svelte-1iuoan0"&&(Je.textContent=Dn),xo=s(e),f(Re.$$.fragment,e),Co=s(e),Se=i(e,"P",{"data-svelte-h":!0}),a(Se)!=="svelte-1dqjbww"&&(Se.innerHTML=Kn),$o=s(e),Ze=i(e,"P",{"data-svelte-h":!0}),a(Ze)!=="svelte-uwxrp8"&&(Ze.textContent=el),ko=s(e),N=i(e,"H3",{class:!0});var tn=u(N);Y=i(tn,"A",{id:!0,class:!0,href:!0});var Nl=u(Y);xt=i(Nl,"SPAN",{});var Bl=u(xt);f(Ee.$$.fragment,Bl),Bl.forEach(t),Nl.forEach(t),dn=s(tn),wt=i(tn,"SPAN",{"data-svelte-h":!0}),a(wt)!=="svelte-ieit2v"&&(wt.textContent=tl),tn.forEach(t),Mo=s(e),je=i(e,"P",{"data-svelte-h":!0}),a(je)!=="svelte-1xzf20w"&&(je.innerHTML=ol),Lo=s(e),Ge=i(e,"P",{"data-svelte-h":!0}),a(Ge)!=="svelte-11dmfnu"&&(Ge.innerHTML=nl),Ho=s(e),qe=i(e,"P",{"data-svelte-h":!0}),a(qe)!=="svelte-1ul6csg"&&(qe.innerHTML=ll),Fo=s(e),We=i(e,"P",{"data-svelte-h":!0}),a(We)!=="svelte-cvn3sg"&&(We.innerHTML=il),Po=s(e),Ye=i(e,"P",{"data-svelte-h":!0}),a(Ye)!=="svelte-19emp5y"&&(Ye.textContent=rl),No=s(e),f(Xe.$$.fragment,e),Bo=s(e),Oe=i(e,"P",{"data-svelte-h":!0}),a(Oe)!=="svelte-fqsbir"&&(Oe.textContent=sl),Uo=s(e),ze=i(e,"P",{"data-svelte-h":!0}),a(ze)!=="svelte-jtwtfe"&&(ze.innerHTML=al),Ao=s(e),Qe=i(e,"P",{"data-svelte-h":!0}),a(Qe)!=="svelte-jr9wmb"&&(Qe.textContent=dl),Io=s(e),Ve=i(e,"P",{"data-svelte-h":!0}),a(Ve)!=="svelte-k5t6bl"&&(Ve.textContent=hl),Jo=s(e),De=i(e,"UL",{"data-svelte-h":!0}),a(De)!=="svelte-uzeeja"&&(De.innerHTML=ul),Ro=s(e),B=i(e,"H2",{class:!0});var on=u(B);X=i(on,"A",{id:!0,class:!0,href:!0});var Ul=u(X);Ct=i(Ul,"SPAN",{});var Al=u(Ct);f(Ke.$$.fragment,Al),Al.forEach(t),Ul.forEach(t),hn=s(on),vt=i(on,"SPAN",{"data-svelte-h":!0}),a(vt)!=="svelte-10q1feb"&&(vt.textContent=ml),on.forEach(t),So=s(e),et=i(e,"P",{"data-svelte-h":!0}),a(et)!=="svelte-1gp1v2d"&&(et.textContent=cl),Zo=s(e),tt=i(e,"P",{"data-svelte-h":!0}),a(tt)!=="svelte-1g6cxz5"&&(tt.textContent=fl),Eo=s(e),ot=i(e,"OL",{"data-svelte-h":!0}),a(ot)!=="svelte-o72q35"&&(ot.innerHTML=pl),jo=s(e),nt=i(e,"P",{"data-svelte-h":!0}),a(nt)!=="svelte-c3r53s"&&(nt.textContent=wl),Go=s(e),U=i(e,"H2",{class:!0});var nn=u(U);O=i(nn,"A",{id:!0,class:!0,href:!0});var Il=u(O);$t=i(Il,"SPAN",{});var Jl=u($t);f(lt.$$.fragment,Jl),Jl.forEach(t),Il.forEach(t),un=s(nn),yt=i(nn,"SPAN",{"data-svelte-h":!0}),a(yt)!=="svelte-c0dibq"&&(yt.textContent=vl),nn.forEach(t),qo=s(e),it=i(e,"P",{"data-svelte-h":!0}),a(it)!=="svelte-1u5xu5o"&&(it.textContent=yl),Wo=s(e),rt=i(e,"P",{"data-svelte-h":!0}),a(rt)!=="svelte-15riypa"&&(rt.innerHTML=gl),Yo=s(e),st=i(e,"P",{"data-svelte-h":!0}),a(st)!=="svelte-gy3qi9"&&(st.textContent=bl),Xo=s(e),at=i(e,"OL",{"data-svelte-h":!0}),a(at)!=="svelte-1l2xrm5"&&(at.innerHTML=Tl),Oo=s(e),dt=i(e,"P",{"data-svelte-h":!0}),a(dt)!=="svelte-1qzb4ip"&&(dt.innerHTML=_l),zo=s(e),kt=i(e,"P",{}),u(kt).forEach(t),this.h()},h(){d(m,"name","hf:doc:metadata"),d(m,"content",JSON.stringify(Ol)),d(_,"id","how-to-convert-a-transformers-model-to-tensorflow"),d(_,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(_,"href","#how-to-convert-a-transformers-model-to-tensorflow"),d(C,"class","relative group"),d(I,"id","stepbystep-guide-to-add-tensorflow-model-architecture-code"),d(I,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(I,"href","#stepbystep-guide-to-add-tensorflow-model-architecture-code"),d(L,"class","relative group"),d(J,"id","13-prepare-your-model-contribution"),d(J,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(J,"href","#13-prepare-your-model-contribution"),d(H,"class","relative group"),d(S,"start","3"),d(Z,"start","4"),d(E,"start","5"),d(j,"start","6"),d(G,"start","8"),d(q,"id","4-model-implementation"),d(q,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(q,"href","#4-model-implementation"),d(F,"class","relative group"),d(W,"id","5-add-model-tests"),d(W,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(W,"href","#5-add-model-tests"),d(P,"class","relative group"),d(Y,"id","67-ensure-everyone-can-use-your-model"),d(Y,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(Y,"href","#67-ensure-everyone-can-use-your-model"),d(N,"class","relative group"),d(X,"id","adding-tensorflow-weights-to-hub"),d(X,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(X,"href","#adding-tensorflow-weights-to-hub"),d(B,"class","relative group"),d(O,"id","debugging-mismatches-across-ml-frameworks"),d(O,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(O,"href","#debugging-mismatches-across-ml-frameworks"),d(U,"class","relative group")},m(e,o){h(document.head,m),n(e,k,o),n(e,b,o),n(e,T,o),n(e,C,o),h(C,_),h(_,x),p(M,x,null),h(C,g),h(C,$),n(e,Lt,o),n(e,V,o),n(e,Ht,o),n(e,D,o),n(e,Ft,o),n(e,K,o),n(e,Pt,o),n(e,ee,o),n(e,Nt,o),n(e,te,o),n(e,Bt,o),p(A,e,o),n(e,Ut,o),n(e,L,o),h(L,I),h(I,gt),p(oe,gt,null),h(L,ln),h(L,mt),n(e,At,o),n(e,ne,o),n(e,It,o),n(e,le,o),n(e,Jt,o),n(e,ie,o),n(e,Rt,o),n(e,re,o),n(e,St,o),n(e,H,o),h(H,J),h(J,bt),p(se,bt,null),h(H,rn),h(H,ct),n(e,Zt,o),n(e,ae,o),n(e,Et,o),n(e,de,o),n(e,jt,o),n(e,he,o),n(e,Gt,o),p(R,e,o),n(e,qt,o),n(e,ue,o),n(e,Wt,o),n(e,me,o),n(e,Yt,o),n(e,ce,o),n(e,Xt,o),p(fe,e,o),n(e,Ot,o),n(e,S,o),n(e,zt,o),p(pe,e,o),n(e,Qt,o),n(e,we,o),n(e,Vt,o),p(ve,e,o),n(e,Dt,o),n(e,ye,o),n(e,Kt,o),n(e,Z,o),n(e,eo,o),p(ge,e,o),n(e,to,o),n(e,E,o),n(e,oo,o),p(be,e,o),n(e,no,o),n(e,j,o),n(e,lo,o),p(Te,e,o),n(e,io,o),n(e,G,o),n(e,ro,o),n(e,_e,o),n(e,so,o),n(e,xe,o),n(e,ao,o),n(e,Ce,o),n(e,ho,o),n(e,$e,o),n(e,uo,o),n(e,ke,o),n(e,mo,o),n(e,F,o),h(F,q),h(q,Tt),p(Me,Tt,null),h(F,sn),h(F,ft),n(e,co,o),n(e,Le,o),n(e,fo,o),n(e,He,o),n(e,po,o),n(e,Fe,o),n(e,wo,o),n(e,Pe,o),n(e,vo,o),n(e,Ne,o),n(e,yo,o),n(e,Be,o),n(e,go,o),n(e,Ue,o),n(e,bo,o),n(e,P,o),h(P,W),h(W,_t),p(Ae,_t,null),h(P,an),h(P,pt),n(e,To,o),n(e,Ie,o),n(e,_o,o),n(e,Je,o),n(e,xo,o),p(Re,e,o),n(e,Co,o),n(e,Se,o),n(e,$o,o),n(e,Ze,o),n(e,ko,o),n(e,N,o),h(N,Y),h(Y,xt),p(Ee,xt,null),h(N,dn),h(N,wt),n(e,Mo,o),n(e,je,o),n(e,Lo,o),n(e,Ge,o),n(e,Ho,o),n(e,qe,o),n(e,Fo,o),n(e,We,o),n(e,Po,o),n(e,Ye,o),n(e,No,o),p(Xe,e,o),n(e,Bo,o),n(e,Oe,o),n(e,Uo,o),n(e,ze,o),n(e,Ao,o),n(e,Qe,o),n(e,Io,o),n(e,Ve,o),n(e,Jo,o),n(e,De,o),n(e,Ro,o),n(e,B,o),h(B,X),h(X,Ct),p(Ke,Ct,null),h(B,hn),h(B,vt),n(e,So,o),n(e,et,o),n(e,Zo,o),n(e,tt,o),n(e,Eo,o),n(e,ot,o),n(e,jo,o),n(e,nt,o),n(e,Go,o),n(e,U,o),h(U,O),h(O,$t),p(lt,$t,null),h(U,un),h(U,yt),n(e,qo,o),n(e,it,o),n(e,Wo,o),n(e,rt,o),n(e,Yo,o),n(e,st,o),n(e,Xo,o),n(e,at,o),n(e,Oo,o),n(e,dt,o),n(e,zo,o),n(e,kt,o),Qo=!0},p(e,[o]){const ht={};o&2&&(ht.$$scope={dirty:o,ctx:e}),A.$set(ht);const Mt={};o&2&&(Mt.$$scope={dirty:o,ctx:e}),R.$set(Mt)},i(e){Qo||(w(M.$$.fragment,e),w(A.$$.fragment,e),w(oe.$$.fragment,e),w(se.$$.fragment,e),w(R.$$.fragment,e),w(fe.$$.fragment,e),w(pe.$$.fragment,e),w(ve.$$.fragment,e),w(ge.$$.fragment,e),w(be.$$.fragment,e),w(Te.$$.fragment,e),w(Me.$$.fragment,e),w(Ae.$$.fragment,e),w(Re.$$.fragment,e),w(Ee.$$.fragment,e),w(Xe.$$.fragment,e),w(Ke.$$.fragment,e),w(lt.$$.fragment,e),Qo=!0)},o(e){v(M.$$.fragment,e),v(A.$$.fragment,e),v(oe.$$.fragment,e),v(se.$$.fragment,e),v(R.$$.fragment,e),v(fe.$$.fragment,e),v(pe.$$.fragment,e),v(ve.$$.fragment,e),v(ge.$$.fragment,e),v(be.$$.fragment,e),v(Te.$$.fragment,e),v(Me.$$.fragment,e),v(Ae.$$.fragment,e),v(Re.$$.fragment,e),v(Ee.$$.fragment,e),v(Xe.$$.fragment,e),v(Ke.$$.fragment,e),v(lt.$$.fragment,e),Qo=!1},d(e){e&&(t(k),t(b),t(T),t(C),t(Lt),t(V),t(Ht),t(D),t(Ft),t(K),t(Pt),t(ee),t(Nt),t(te),t(Bt),t(Ut),t(L),t(At),t(ne),t(It),t(le),t(Jt),t(ie),t(Rt),t(re),t(St),t(H),t(Zt),t(ae),t(Et),t(de),t(jt),t(he),t(Gt),t(qt),t(ue),t(Wt),t(me),t(Yt),t(ce),t(Xt),t(Ot),t(S),t(zt),t(Qt),t(we),t(Vt),t(Dt),t(ye),t(Kt),t(Z),t(eo),t(to),t(E),t(oo),t(no),t(j),t(lo),t(io),t(G),t(ro),t(_e),t(so),t(xe),t(ao),t(Ce),t(ho),t($e),t(uo),t(ke),t(mo),t(F),t(co),t(Le),t(fo),t(He),t(po),t(Fe),t(wo),t(Pe),t(vo),t(Ne),t(yo),t(Be),t(go),t(Ue),t(bo),t(P),t(To),t(Ie),t(_o),t(Je),t(xo),t(Co),t(Se),t($o),t(Ze),t(ko),t(N),t(Mo),t(je),t(Lo),t(Ge),t(Ho),t(qe),t(Fo),t(We),t(Po),t(Ye),t(No),t(Bo),t(Oe),t(Uo),t(ze),t(Ao),t(Qe),t(Io),t(Ve),t(Jo),t(De),t(Ro),t(B),t(So),t(et),t(Zo),t(tt),t(Eo),t(ot),t(jo),t(nt),t(Go),t(U),t(qo),t(it),t(Wo),t(rt),t(Yo),t(st),t(Xo),t(at),t(Oo),t(dt),t(zo),t(kt)),t(m),y(M),y(A,e),y(oe),y(se),y(R,e),y(fe,e),y(pe,e),y(ve,e),y(ge,e),y(be,e),y(Te,e),y(Me),y(Ae),y(Re,e),y(Ee),y(Xe,e),y(Ke),y(lt)}}}const Ol={local:"how-to-convert-a-transformers-model-to-tensorflow",sections:[{local:"stepbystep-guide-to-add-tensorflow-model-architecture-code",sections:[{local:"13-prepare-your-model-contribution",title:"1.-3. Prepare your model contribution"},{local:"4-model-implementation",title:"4. Model implementation"},{local:"5-add-model-tests",title:"5. Add model tests"},{local:"67-ensure-everyone-can-use-your-model",title:"6.-7. Ensure everyone can use your model"}],title:"Step-by-step guide to add TensorFlow model architecture code"},{local:"adding-tensorflow-weights-to-hub",title:"Adding TensorFlow weights to 🤗 Hub"},{local:"debugging-mismatches-across-ml-frameworks",title:"Debugging mismatches across ML frameworks 🐛"}],title:"How to convert a 🤗 Transformers model to TensorFlow?"};function zl(ut){return El(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ti extends jl{constructor(m){super(),Gl(this,m,zl,Xl,Zl,{})}}export{ti as component};
