import{s as bd,f as vd,o as Jd,n as gd}from"../chunks/scheduler.9bc65507.js";import{S as jd,i as Cd,g as s,s as o,r as d,A as kd,h as a,f as n,c as i,j as Md,u as m,x as r,k as g,y as Ud,a as l,v as p,d as h,t as u,w as f}from"../chunks/index.707bf1b6.js";import{T as Td}from"../chunks/Tip.c2ecdbf4.js";import{C as c}from"../chunks/CodeBlock.54a9f38d.js";import{H as M}from"../chunks/Heading.342b1fa6.js";function _d(On){let y,T='If you’re interested in implementing a TensorFlow model, take a look at the <a href="add_tensorflow_model">How to convert a 🤗 Transformers model to TensorFlow</a> guide!';return{c(){y=s("p"),y.innerHTML=T},l(w){y=a(w,"P",{"data-svelte-h":!0}),r(y)!=="svelte-dn397l"&&(y.innerHTML=T)},m(w,b){l(w,y,b)},p:gd,d(w){w&&n(y)}}}function Id(On){let y,T="In case you are using Windows, you should replace <code>RUN_SLOW=1</code> with <code>SET RUN_SLOW=1</code>";return{c(){y=s("p"),y.innerHTML=T},l(w){y=a(w,"P",{"data-svelte-h":!0}),r(y)!=="svelte-1w9gxqz"&&(y.innerHTML=T)},m(w,b){l(w,y,b)},p:gd,d(w){w&&n(y)}}}function xd(On){let y,T,w,b,$,tl,L,As='The 🤗 Transformers library is often able to offer new models thanks to community contributors. But this can be a challenging project and requires an in-depth knowledge of the 🤗 Transformers library and the model to implement. At Hugging Face, we’re trying to empower more of the community to actively add models and we’ve put together this guide to walk you through the process of adding a PyTorch model (make sure you have <a href="https://pytorch.org/get-started/locally/" rel="nofollow">PyTorch installed</a>).',nl,v,ll,A,Hs="Along the way, you’ll:",ol,H,Zs="<li>get insights into open-source best practices</li> <li>understand the design principles behind one of the most popular deep learning libraries</li> <li>learn how to efficiently test large models</li> <li>learn how to integrate Python utilities like <code>black</code>, <code>ruff</code>, and <code>make fix-copies</code> to ensure clean and readable code</li>",il,Z,Bs="A Hugging Face team member will be available to help you along the way so you’ll never be alone. 🤗 ❤️",sl,B,Ns='To get started, open a <a href="https://github.com/huggingface/transformers/issues/new?assignees=&amp;labels=New+model&amp;template=new-model-addition.yml" rel="nofollow">New model addition</a> issue for the model you want to see in 🤗 Transformers. If you’re not especially picky about contributing a specific model, you can filter by the <a href="https://github.com/huggingface/transformers/labels/New%20model" rel="nofollow">New model label</a> to see if there are any unclaimed model requests and work on it.',al,N,Ws="Once you’ve opened a new model request, the first step is to get familiar with 🤗 Transformers if you aren’t already!",rl,W,dl,R,Rs=`First, you should get a general overview of 🤗 Transformers. 🤗 Transformers is a very opinionated library, so there is a
chance that you don’t agree with some of the library’s philosophies or design choices. From our experience, however, we
found that the fundamental design choices and philosophies of the library are crucial to efficiently scale 🤗
Transformers while keeping maintenance costs at a reasonable level.`,ml,z,zs='A good first starting point to better understand the library is to read the <a href="philosophy">documentation of our philosophy</a>. As a result of our way of working, there are some choices that we try to apply to all models:',pl,P,Ps=`<li>Composition is generally favored over-abstraction</li> <li>Duplicating code is not always bad if it strongly improves the readability or accessibility of a model</li> <li>Model files are as self-contained as possible so that when you read the code of a specific model, you ideally only
have to look into the respective <code>modeling_....py</code> file.</li>`,hl,G,Gs=`In our opinion, the library’s code is not just a means to provide a product, <em>e.g.</em> the ability to use BERT for
inference, but also as the very product that we want to improve. Hence, when adding a model, the user is not only the
person who will use your model, but also everybody who will read, try to understand, and possibly tweak your code.`,ul,E,Es="With this in mind, let’s go a bit deeper into the general library design.",fl,Q,cl,V,Qs=`To successfully add a model, it is important to understand the interaction between your model and its config,
<a href="/docs/transformers/v4.39.2/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>, and <a href="/docs/transformers/v4.39.2/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>. For exemplary purposes, we will
call the model to be added to 🤗 Transformers <code>BrandNewBert</code>.`,yl,D,Vs="Let’s take a look:",wl,Kn,Ds,Ml,Y,Ys=`As you can see, we do make use of inheritance in 🤗 Transformers, but we keep the level of abstraction to an absolute
minimum. There are never more than two levels of abstraction for any model in the library. <code>BrandNewBertModel</code>
inherits from <code>BrandNewBertPreTrainedModel</code> which in turn inherits from <a href="/docs/transformers/v4.39.2/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a> and
that’s it. As a general rule, we want to make sure that a new model only depends on
<a href="/docs/transformers/v4.39.2/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. The important functionalities that are automatically provided to every new
model are <a href="/docs/transformers/v4.39.2/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> and
<a href="/docs/transformers/v4.39.2/en/main_classes/model#transformers.PreTrainedModel.save_pretrained">save_pretrained()</a>, which are used for serialization and deserialization. All of the
other important functionalities, such as <code>BrandNewBertModel.forward</code> should be completely defined in the new
<code>modeling_brand_new_bert.py</code> script. Next, we want to make sure that a model with a specific head layer, such as
<code>BrandNewBertForMaskedLM</code> does not inherit from <code>BrandNewBertModel</code>, but rather uses <code>BrandNewBertModel</code>
as a component that can be called in its forward pass to keep the level of abstraction low. Every new model requires a
configuration class, called <code>BrandNewBertConfig</code>. This configuration is always stored as an attribute in
<a href="/docs/transformers/v4.39.2/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>, and thus can be accessed via the <code>config</code> attribute for all classes
inheriting from <code>BrandNewBertPreTrainedModel</code>:`,Tl,F,gl,S,Fs=`Similar to the model, the configuration inherits basic serialization and deserialization functionalities from
<a href="/docs/transformers/v4.39.2/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a>. Note that the configuration and the model are always serialized into two
different formats - the model to a <em>pytorch_model.bin</em> file and the configuration to a <em>config.json</em> file. Calling
the model’s <a href="/docs/transformers/v4.39.2/en/main_classes/model#transformers.PreTrainedModel.save_pretrained">save_pretrained()</a> will automatically call
the config’s <a href="/docs/transformers/v4.39.2/en/main_classes/configuration#transformers.PretrainedConfig.save_pretrained">save_pretrained()</a>, so that both model and configuration are saved.`,bl,X,vl,q,Ss=`When coding your new model, keep in mind that Transformers is an opinionated library and we have a few quirks of our
own regarding how code should be written :-)`,Jl,O,Xs=`<li>The forward pass of your model should be fully written in the modeling file while being fully independent of other
models in the library. If you want to reuse a block from another model, copy the code and paste it with a
<code># Copied from</code> comment on top (see <a href="https://github.com/huggingface/transformers/blob/v4.17.0/src/transformers/models/roberta/modeling_roberta.py#L160" rel="nofollow">here</a>
for a good example and <a href="pr_checks#check-copies">there</a> for more documentation on Copied from).</li> <li>The code should be fully understandable, even by a non-native English speaker. This means you should pick
descriptive variable names and avoid abbreviations. As an example, <code>activation</code> is preferred to <code>act</code>.
One-letter variable names are strongly discouraged unless it’s an index in a for loop.</li> <li>More generally we prefer longer explicit code to short magical one.</li> <li>Avoid subclassing <code>nn.Sequential</code> in PyTorch but subclass <code>nn.Module</code> and write the forward pass, so that anyone
using your code can quickly debug it by adding print statements or breaking points.</li> <li>Your function signature should be type-annotated. For the rest, good variable names are way more readable and
understandable than type annotations.</li>`,jl,K,Cl,ee,qs="Not quite ready yet :-( This section will be added soon!",kl,te,Ul,ne,Os=`Everyone has different preferences of how to port a model so it can be very helpful for you to take a look at summaries
of how other contributors ported models to Hugging Face. Here is a list of community blog posts on how to port a model:`,_l,le,Ks='<li><a href="https://medium.com/huggingface/from-tensorflow-to-pytorch-265f40ef2a28" rel="nofollow">Porting GPT2 Model</a> by <a href="https://huggingface.co/thomwolf" rel="nofollow">Thomas</a></li> <li><a href="https://huggingface.co/blog/porting-fsmt" rel="nofollow">Porting WMT19 MT Model</a> by <a href="https://huggingface.co/stas" rel="nofollow">Stas</a></li>',Il,oe,ea="From experience, we can tell you that the most important things to keep in mind when adding a model are:",xl,ie,ta=`<li>Don’t reinvent the wheel! Most parts of the code you will add for the new 🤗 Transformers model already exist
somewhere in 🤗 Transformers. Take some time to find similar, already existing models and tokenizers you can copy
from. <a href="https://www.gnu.org/software/grep/" rel="nofollow">grep</a> and <a href="https://github.com/BurntSushi/ripgrep" rel="nofollow">rg</a> are your
friends. Note that it might very well happen that your model’s tokenizer is based on one model implementation, and
your model’s modeling code on another one. <em>E.g.</em> FSMT’s modeling code is based on BART, while FSMT’s tokenizer code
is based on XLM.</li> <li>It’s more of an engineering challenge than a scientific challenge. You should spend more time creating an
efficient debugging environment rather than trying to understand all theoretical aspects of the model in the paper.</li> <li>Ask for help, when you’re stuck! Models are the core component of 🤗 Transformers so we at Hugging Face are more
than happy to help you at every step to add your model. Don’t hesitate to ask if you notice you are not making
progress.</li>`,$l,se,na="In the following, we try to give you a general recipe that we found most useful when porting a model to 🤗 Transformers.",Ll,ae,la=`The following list is a summary of everything that has to be done to add a model and can be used by you as a To-Do
List:`,Al,re,oa=`☐ (Optional) Understood the model’s theoretical aspects<br/>
☐ Prepared 🤗 Transformers dev environment<br/>
☐ Set up debugging environment of the original repository<br/>
☐ Created script that successfully runs the <code>forward()</code> pass using the original repository and checkpoint<br/>
☐ Successfully added the model skeleton to 🤗 Transformers<br/>
☐ Successfully converted original checkpoint to 🤗 Transformers checkpoint<br/>
☐ Successfully ran <code>forward()</code> pass in 🤗 Transformers that gives identical output to original checkpoint<br/>
☐ Finished model tests in 🤗 Transformers<br/>
☐ Successfully added tokenizer in 🤗 Transformers<br/>
☐ Run end-to-end integration tests<br/>
☐ Finished docs<br/>
☐ Uploaded model weights to the Hub<br/>
☐ Submitted the pull request<br/>
☐ (Optional) Added a demo notebook`,Hl,de,ia=`To begin with, we usually recommend starting by getting a good theoretical understanding of <code>BrandNewBert</code>. However,
if you prefer to understand the theoretical aspects of the model <em>on-the-job</em>, then it is totally fine to directly dive
into the <code>BrandNewBert</code>’s code-base. This option might suit you better if your engineering skills are better than
your theoretical skill, if you have trouble understanding <code>BrandNewBert</code>’s paper, or if you just enjoy programming
much more than reading scientific papers.`,Zl,me,Bl,pe,sa=`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. That being said, you don’t have to spend too much time on the
theoretical aspects, but rather focus on the practical ones, namely:`,Nl,he,aa=`<li>What type of model is <em>brand_new_bert</em>? BERT-like encoder-only model? GPT2-like decoder-only model? BART-like
encoder-decoder model? Look at the <a href="model_summary">model_summary</a> if you’re not familiar with the differences between those.</li> <li>What are the applications of <em>brand_new_bert</em>? Text classification? Text generation? Seq2Seq tasks, <em>e.g.,</em>
summarization?</li> <li>What is the novel feature of the model that makes it different from BERT/GPT-2/BART?</li> <li>Which of the already existing <a href="https://huggingface.co/transformers/#contents" rel="nofollow">🤗 Transformers models</a> is most
similar to <em>brand_new_bert</em>?</li> <li>What type of tokenizer is used? A sentencepiece tokenizer? Word piece tokenizer? Is it the same tokenizer as used
for BERT or BART?</li>`,Wl,ue,ra=`After you feel like you have gotten a good overview of the architecture of the model, you might want to write to the
Hugging Face team with any questions you might have. This might include questions regarding the model’s architecture,
its attention layer, etc. We will be more than happy to help you.`,Rl,fe,zl,ce,da=`<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>`,Pl,ye,Gl,J,ma="<li>Set up a development environment, for instance by running the following command:</li>",El,we,Ql,Me,pa=`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 the Deep Learning framework you are working with
(PyTorch, TensorFlow and/or Flax) then do:`,Vl,Te,Dl,ge,ha="which should be enough for most use cases. You can then return to the parent directory",Yl,be,Fl,j,ua=`<li>We recommend adding the PyTorch version of <em>brand_new_bert</em> to Transformers. To install PyTorch, please follow the
instructions on <a href="https://pytorch.org/get-started/locally/" rel="nofollow">https://pytorch.org/get-started/locally/</a>.</li>`,Sl,ve,fa="<strong>Note:</strong> You don’t need to have CUDA installed. Making the new model work on CPU is sufficient.",Xl,C,ca="<li>To port <em>brand_new_bert</em>, you will also need access to its original repository:</li>",ql,Je,Ol,je,ya="Now you have set up a development environment to port <em>brand_new_bert</em> to 🤗 Transformers.",Kl,Ce,eo,ke,wa=`At first, you will work on the original <em>brand_new_bert</em> repository. Often, the original implementation is very
“researchy”. Meaning that documentation might be lacking and the code can be difficult to understand. But this should
be exactly your motivation to reimplement <em>brand_new_bert</em>. At Hugging Face, one of our main goals is to <em>make people
stand on the shoulders of giants</em> which translates here very well into taking a working model and rewriting it to make
it as <strong>accessible, user-friendly, and beautiful</strong> as possible. This is the number-one motivation to re-implement
models into 🤗 Transformers - trying to make complex new NLP technology accessible to <strong>everybody</strong>.`,to,Ue,Ma="You should start thereby by diving into the original repository.",no,_e,Ta=`Successfully running the official pretrained model in the original repository is often <strong>the most difficult</strong> step.
From our experience, it is very important to spend some time getting familiar with the original code-base. You need to
figure out the following:`,lo,Ie,ga=`<li>Where to find the pretrained weights?</li> <li>How to load the pretrained weights into the corresponding model?</li> <li>How to run the tokenizer independently from the model?</li> <li>Trace one forward pass so that you know which classes and functions are required for a simple forward pass. Usually,
you only have to reimplement those functions.</li> <li>Be able to locate the important components of the model: Where is the model’s class? Are there model sub-classes,
<em>e.g.</em> EncoderModel, DecoderModel? Where is the self-attention layer? Are there multiple different attention layers,
<em>e.g.</em> <em>self-attention</em>, <em>cross-attention</em>…?</li> <li>How can you debug the model in the original environment of the repo? Do you have to add <em>print</em> statements, can you
work with an interactive debugger like <em>ipdb</em>, or should you use an efficient IDE to debug the model, like PyCharm?</li>`,oo,xe,ba=`It is very important that before you start the porting process, you can <strong>efficiently</strong> debug code in the original
repository! Also, remember that you are working with an open-source library, so do not hesitate to open an issue, or
even a pull request in the original repository. The maintainers of this repository are most likely very happy about
someone looking into their code!`,io,$e,va=`At this point, it is really up to you which debugging environment and strategy you prefer to use to debug the original
model. We strongly advise against setting up a costly GPU environment, but simply work on a CPU both when starting to
dive into the original repository and also when starting to write the 🤗 Transformers implementation of the model. Only
at the very end, when the model has already been successfully ported to 🤗 Transformers, one should verify that the
model also works as expected on GPU.`,so,Le,Ja="In general, there are two possible debugging environments for running the original model",ao,Ae,ja='<li><a href="https://jupyter.org/" rel="nofollow">Jupyter notebooks</a> / <a href="https://colab.research.google.com/notebooks/intro.ipynb" rel="nofollow">google colab</a></li> <li>Local python scripts.</li>',ro,He,Ca=`Jupyter notebooks have the advantage that they allow for cell-by-cell execution which can be helpful to better split
logical components from one another and to have faster debugging cycles as intermediate results can be stored. Also,
notebooks are often easier to share with other contributors, which might be very helpful if you want to ask the Hugging
Face team for help. If you are familiar with Jupyter notebooks, we strongly recommend you work with them.`,mo,Ze,ka=`The obvious disadvantage of Jupyter notebooks is that if you are not used to working with them you will have to spend
some time adjusting to the new programming environment and you might not be able to use your known debugging tools
anymore, like <code>ipdb</code>.`,po,Be,Ua=`For each code-base, a good first step is always to load a <strong>small</strong> pretrained checkpoint and to be able to reproduce a
single forward pass using a dummy integer vector of input IDs as an input. Such a script could look like this (in
pseudocode):`,ho,Ne,uo,We,_a="Next, regarding the debugging strategy, there are generally a few from which to choose from:",fo,Re,Ia=`<li>Decompose the original model into many small testable components and run a forward pass on each of those for
verification</li> <li>Decompose the original model only into the original <em>tokenizer</em> and the original <em>model</em>, run a forward pass on
those, and use intermediate print statements or breakpoints for verification</li>`,co,ze,xa=`Again, it is up to you which strategy to choose. Often, one or the other is advantageous depending on the original code
base.`,yo,Pe,$a=`If the original code-base allows you to decompose the model into smaller sub-components, <em>e.g.</em> if the original
code-base can easily be run in eager mode, it is usually worth the effort to do so. There are some important advantages
to taking the more difficult road in the beginning:`,wo,Ge,La=`<li>at a later stage when comparing the original model to the Hugging Face implementation, you can verify automatically
for each component individually that the corresponding component of the 🤗 Transformers implementation matches instead
of relying on visual comparison via print statements</li> <li>it can give you some rope to decompose the big problem of porting a model into smaller problems of just porting
individual components and thus structure your work better</li> <li>separating the model into logical meaningful components will help you to get a better overview of the model’s design
and thus to better understand the model</li> <li>at a later stage those component-by-component tests help you to ensure that no regression occurs as you continue
changing your code</li>`,Mo,Ee,Aa=`<a href="https://gist.github.com/LysandreJik/db4c948f6b4483960de5cbac598ad4ed" rel="nofollow">Lysandre’s</a> integration checks for ELECTRA
gives a nice example of how this can be done.`,To,Qe,Ha=`However, if the original code-base is very complex or only allows intermediate components to be run in a compiled mode,
it might be too time-consuming or even impossible to separate the model into smaller testable sub-components. A good
example is <a href="https://github.com/tensorflow/mesh/tree/master/mesh_tensorflow" rel="nofollow">T5’s MeshTensorFlow</a> library which is
very complex and does not offer a simple way to decompose the model into its sub-components. For such libraries, one
often relies on verifying print statements.`,go,Ve,Za=`No matter which strategy you choose, the recommended procedure is often the same that you should start to debug the
starting layers first and the ending layers last.`,bo,De,Ba=`It is recommended that you retrieve the output, either by print statements or sub-component functions, of the following
layers in the following order:`,vo,Ye,Na="<li>Retrieve the input IDs passed to the model</li> <li>Retrieve the word embeddings</li> <li>Retrieve the input of the first Transformer layer</li> <li>Retrieve the output of the first Transformer layer</li> <li>Retrieve the output of the following n - 1 Transformer layers</li> <li>Retrieve the output of the whole BrandNewBert Model</li>",Jo,Fe,Wa="Input IDs should thereby consists of an array of integers, <em>e.g.</em> <code>input_ids = [0, 4, 4, 3, 2, 4, 1, 7, 19]</code>",jo,Se,Ra="The outputs of the following layers often consist of multi-dimensional float arrays and can look like this:",Co,Xe,ko,qe,za=`We expect that every model added to 🤗 Transformers passes a couple of integration tests, meaning that the original
model and the reimplemented version in 🤗 Transformers have to give the exact same output up to a precision of 0.001!
Since it is normal that the exact same model written in different libraries can give a slightly different output
depending on the library framework, we accept an error tolerance of 1e-3 (0.001). It is not enough if the model gives
nearly the same output, they have to be almost identical. Therefore, you will certainly compare the intermediate
outputs of the 🤗 Transformers version multiple times against the intermediate outputs of the original implementation of
<em>brand_new_bert</em> in which case an <strong>efficient</strong> debugging environment of the original repository is absolutely
important. Here is some advice to make your debugging environment as efficient as possible.`,Uo,Oe,Pa=`<li>Find the best way of debugging intermediate results. Is the original repository written in PyTorch? Then you should
probably take the time to write a longer script that decomposes the original model into smaller sub-components to
retrieve intermediate values. Is the original repository written in Tensorflow 1? Then you might have to rely on
TensorFlow print operations like <a href="https://www.tensorflow.org/api_docs/python/tf/print" rel="nofollow">tf.print</a> to output
intermediate values. Is the original repository written in Jax? Then make sure that the model is <strong>not jitted</strong> when
running the forward pass, <em>e.g.</em> check-out <a href="https://github.com/google/jax/issues/196" rel="nofollow">this link</a>.</li> <li>Use the smallest pretrained checkpoint you can find. The smaller the checkpoint, the faster your debug cycle
becomes. It is not efficient if your pretrained model is so big that your forward pass takes more than 10 seconds.
In case only very large checkpoints are available, it might make more sense to create a dummy model in the new
environment with randomly initialized weights and save those weights for comparison with the 🤗 Transformers version
of your model</li> <li>Make sure you are using the easiest way of calling a forward pass in the original repository. Ideally, you want to
find the function in the original repository that <strong>only</strong> calls a single forward pass, <em>i.e.</em> that is often called
<code>predict</code>, <code>evaluate</code>, <code>forward</code> or <code>__call__</code>. You don’t want to debug a function that calls <code>forward</code>
multiple times, <em>e.g.</em> to generate text, like <code>autoregressive_sample</code>, <code>generate</code>.</li> <li>Try to separate the tokenization from the model’s <em>forward</em> pass. If the original repository shows examples where
you have to input a string, then try to find out where in the forward call the string input is changed to input ids
and start from this point. This might mean that you have to possibly write a small script yourself or change the
original code so that you can directly input the ids instead of an input string.</li> <li>Make sure that the model in your debugging setup is <strong>not</strong> in training mode, which often causes the model to yield
random outputs due to multiple dropout layers in the model. Make sure that the forward pass in your debugging
environment is <strong>deterministic</strong> so that the dropout layers are not used. Or use <em>transformers.utils.set_seed</em>
if the old and new implementations are in the same framework.</li>`,_o,Ke,Ga="The following section gives you more specific details/tips on how you can do this for <em>brand_new_bert</em>.",Io,et,xo,tt,Ea="Next, you can finally start adding new code to 🤗 Transformers. Go into the clone of your 🤗 Transformers’ fork:",$o,nt,Lo,lt,Qa=`In the special case that you are adding a model whose architecture exactly matches the model architecture of an
existing model you only have to add a conversion script as described in <a href="#write-a-conversion-script">this section</a>.
In this case, you can just re-use the whole model architecture of the already existing model.`,Ao,ot,Va="Otherwise, let’s start generating a new model. You have two choices here:",Ho,it,Da="<li><code>transformers-cli add-new-model-like</code> to add a new model like an existing one</li> <li><code>transformers-cli add-new-model</code> to add a new model from our template (will look like BERT or Bart depending on the type of model you select)</li>",Zo,st,Ya='In both cases, you will be prompted with a questionnaire to fill in the basic information of your model. The second command requires to install <code>cookiecutter</code>, you can find more information on it <a href="https://github.com/huggingface/transformers/tree/main/templates/adding_a_new_model" rel="nofollow">here</a>.',Bo,at,Fa="<strong>Open a Pull Request on the main huggingface/transformers repo</strong>",No,rt,Sa=`Before starting to adapt the automatically generated code, now is the time to open a “Work in progress (WIP)” pull
request, <em>e.g.</em> “[WIP] Add <em>brand_new_bert</em>”, in 🤗 Transformers so that you and the Hugging Face team can work
side-by-side on integrating the model into 🤗 Transformers.`,Wo,dt,Xa="You should do the following:",Ro,mt,qa="<li>Create a branch with a descriptive name from your main branch</li>",zo,pt,Po,k,Oa="<li>Commit the automatically generated code:</li>",Go,ht,Eo,U,Ka="<li>Fetch and rebase to current main</li>",Qo,ut,Vo,_,er="<li>Push the changes to your account using:</li>",Do,ft,Yo,I,tr=`<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>`,Fo,ct,nr=`In the following, whenever you have made some progress, don’t forget to commit your work and push it to your account so
that it shows in the pull request. Additionally, you should make sure to update your work with the current main from
time to time by doing:`,So,yt,Xo,wt,lr=`In general, all questions you might have regarding the model or your implementation should be asked in your PR and
discussed/solved in the PR. This way, the Hugging Face team will always be notified when you are committing new code or
if you have a question. It is often very helpful to point the Hugging Face team to your added code so that the Hugging
Face team can efficiently understand your problem or question.`,qo,Mt,or=`To do so, you can go to the “Files changed” tab where you see all of your changes, go to a line regarding which you
want to ask a question, and click on the “+” symbol to add a comment. Whenever a question or problem has been solved,
you can click on the “Resolve” button of the created comment.`,Oo,Tt,ir=`In the same way, the Hugging Face team will open comments when reviewing your code. We recommend asking most questions
on GitHub on your PR. For some very general questions that are not very useful for the public, feel free to ping the
Hugging Face team by Slack or email.`,Ko,gt,sr="<strong>5. Adapt the generated models code for brand_new_bert</strong>",ei,bt,ar=`At first, we will focus only on the model itself and not care about the tokenizer. All the relevant code should be
found in the generated files <code>src/transformers/models/brand_new_bert/modeling_brand_new_bert.py</code> and
<code>src/transformers/models/brand_new_bert/configuration_brand_new_bert.py</code>.`,ti,vt,rr=`Now you can finally start coding :). The generated code in
<code>src/transformers/models/brand_new_bert/modeling_brand_new_bert.py</code> will either have the same architecture as BERT if
it’s an encoder-only model or BART if it’s an encoder-decoder model. At this point, you should remind yourself what
you’ve learned in the beginning about the theoretical aspects of the model: <em>How is the model different from BERT or
BART?</em>”. Implement those changes which often means changing the <em>self-attention</em> layer, the order of the normalization
layer, etc… Again, it is often useful to look at the similar architecture of already existing models in Transformers to
get a better feeling of how your model should be implemented.`,ni,Jt,dr=`<strong>Note</strong> that at this point, you don’t have to be very sure that your code is fully correct or clean. Rather, it is
advised to add a first <em>unclean</em>, copy-pasted version of the original code to
<code>src/transformers/models/brand_new_bert/modeling_brand_new_bert.py</code> until you feel like all the necessary code is
added. From our experience, it is much more efficient to quickly add a first version of the required code and
improve/correct the code iteratively with the conversion script as described in the next section. The only thing that
has to work at this point is that you can instantiate the 🤗 Transformers implementation of <em>brand_new_bert</em>, <em>i.e.</em> the
following command should work:`,li,jt,oi,Ct,mr=`The above command will create a model according to the default parameters as defined in <code>BrandNewBertConfig()</code> with
random weights, thus making sure that the <code>init()</code> methods of all components works.`,ii,kt,pr=`Note that all random initialization should happen in the <code>_init_weights</code> method of your <code>BrandnewBertPreTrainedModel</code>
class. It should initialize all leaf modules depending on the variables of the config. Here is an example with the
BERT <code>_init_weights</code> method:`,si,Ut,ai,_t,hr=`You can have some more custom schemes if you need a special initialization for some modules. For instance, in
<code>Wav2Vec2ForPreTraining</code>, the last two linear layers need to have the initialization of the regular PyTorch <code>nn.Linear</code>
but all the other ones should use an initialization as above. This is coded like this:`,ri,It,di,xt,ur=`The <code>_is_hf_initialized</code> flag is internally used to make sure we only initialize a submodule once. By setting it to
<code>True</code> for <code>module.project_q</code> and <code>module.project_hid</code>, we make sure the custom initialization we did is not overridden later on,
the <code>_init_weights</code> function won’t be applied to them.`,mi,$t,fr="<strong>6. Write a conversion script</strong>",pi,Lt,cr=`Next, you should write a conversion script that lets you convert the checkpoint you used to debug <em>brand_new_bert</em> in
the original repository to a checkpoint compatible with your just created 🤗 Transformers implementation of
<em>brand_new_bert</em>. It is not advised to write the conversion script from scratch, but rather to look through already
existing conversion scripts in 🤗 Transformers for one that has been used to convert a similar model that was written in
the same framework as <em>brand_new_bert</em>. Usually, it is enough to copy an already existing conversion script and
slightly adapt it for your use case. Don’t hesitate to ask the Hugging Face team to point you to a similar already
existing conversion script for your model.`,hi,At,yr='<li>If you are porting a model from TensorFlow to PyTorch, a good starting point might be BERT’s conversion script <a href="https://github.com/huggingface/transformers/blob/7acfa95afb8194f8f9c1f4d2c6028224dbed35a2/src/transformers/models/bert/modeling_bert.py#L91" rel="nofollow">here</a></li> <li>If you are porting a model from PyTorch to PyTorch, a good starting point might be BART’s conversion script <a href="https://github.com/huggingface/transformers/blob/main/src/transformers/models/bart/convert_bart_original_pytorch_checkpoint_to_pytorch.py" rel="nofollow">here</a></li>',ui,Ht,wr=`In the following, we’ll quickly explain how PyTorch models store layer weights and define layer names. In PyTorch, the
name of a layer is defined by the name of the class attribute you give the layer. Let’s define a dummy model in
PyTorch, called <code>SimpleModel</code> as follows:`,fi,Zt,ci,Bt,Mr=`Now we can create an instance of this model definition which will fill all weights: <code>dense</code>, <code>intermediate</code>,
<code>layer_norm</code> with random weights. We can print the model to see its architecture`,yi,Nt,wi,Wt,Tr="This will print out the following:",Mi,Rt,Ti,zt,gr=`We can see that the layer names are defined by the name of the class attribute in PyTorch. You can print out the weight
values of a specific layer:`,gi,Pt,bi,Gt,br="to see that the weights were randomly initialized",vi,Et,Ji,Qt,vr=`In the conversion script, you should fill those randomly initialized weights with the exact weights of the
corresponding layer in the checkpoint. <em>E.g.</em>`,ji,Vt,Ci,Dt,Jr=`While doing so, you must verify that each randomly initialized weight of your PyTorch model and its corresponding
pretrained checkpoint weight exactly match in both <strong>shape and name</strong>. To do so, it is <strong>necessary</strong> to add assert
statements for the shape and print out the names of the checkpoints weights. E.g. you should add statements like:`,ki,Yt,Ui,Ft,jr="Besides, you should also print out the names of both weights to make sure they match, <em>e.g.</em>",_i,St,Ii,Xt,Cr=`If either the shape or the name doesn’t match, you probably assigned the wrong checkpoint weight to a randomly
initialized layer of the 🤗 Transformers implementation.`,xi,qt,kr=`An incorrect shape is most likely due to an incorrect setting of the config parameters in <code>BrandNewBertConfig()</code> that
do not exactly match those that were used for the checkpoint you want to convert. However, it could also be that
PyTorch’s implementation of a layer requires the weight to be transposed beforehand.`,$i,Ot,Ur=`Finally, you should also check that <strong>all</strong> required weights are initialized and print out all checkpoint weights that
were not used for initialization to make sure the model is correctly converted. It is completely normal, that the
conversion trials fail with either a wrong shape statement or a wrong name assignment. This is most likely because either
you used incorrect parameters in <code>BrandNewBertConfig()</code>, have a wrong architecture in the 🤗 Transformers
implementation, you have a bug in the <code>init()</code> functions of one of the components of the 🤗 Transformers
implementation or you need to transpose one of the checkpoint weights.`,Li,Kt,_r=`This step should be iterated with the previous step until all weights of the checkpoint are correctly loaded in the
Transformers model. Having correctly loaded the checkpoint into the 🤗 Transformers implementation, you can then save
the model under a folder of your choice <code>/path/to/converted/checkpoint/folder</code> that should then contain both a
<code>pytorch_model.bin</code> file and a <code>config.json</code> file:`,Ai,en,Hi,tn,Ir="<strong>7. Implement the forward pass</strong>",Zi,nn,xr=`Having managed to correctly load the pretrained weights into the 🤗 Transformers implementation, you should now make
sure that the forward pass is correctly implemented. In <a href="#3-4-run-a-pretrained-checkpoint-using-the-original-repository">Get familiar with the original repository</a>, you have already created a script that runs a forward
pass of the model using the original repository. Now you should write an analogous script using the 🤗 Transformers
implementation instead of the original one. It should look as follows:`,Bi,ln,Ni,on,$r=`It is very likely that the 🤗 Transformers implementation and the original model implementation don’t give the exact
same output the very first time or that the forward pass throws an error. Don’t be disappointed - it’s expected! First,
you should make sure that the forward pass doesn’t throw any errors. It often happens that the wrong dimensions are
used leading to a <em>Dimensionality mismatch</em> error or that the wrong data type object is used, <em>e.g.</em> <code>torch.long</code>
instead of <code>torch.float32</code>. Don’t hesitate to ask the Hugging Face team for help, if you don’t manage to solve
certain errors.`,Wi,sn,Lr=`The final part to make sure the 🤗 Transformers implementation works correctly is to ensure that the outputs are
equivalent to a precision of <code>1e-3</code>. First, you should ensure that the output shapes are identical, <em>i.e.</em> <code>outputs.shape</code> should yield the same value for the script of the 🤗 Transformers implementation and the original
implementation. Next, you should make sure that the output values are identical as well. This one of the most difficult
parts of adding a new model. Common mistakes why the outputs are not identical are:`,Ri,an,Ar=`<li>Some layers were not added, <em>i.e.</em> an <em>activation</em> layer was not added, or the residual connection was forgotten</li> <li>The word embedding matrix was not tied</li> <li>The wrong positional embeddings are used because the original implementation uses on offset</li> <li>Dropout is applied during the forward pass. To fix this make sure <em>model.training is False</em> and that no dropout
layer is falsely activated during the forward pass, <em>i.e.</em> pass <em>self.training</em> to <a href="https://pytorch.org/docs/stable/nn.functional.html?highlight=dropout#torch.nn.functional.dropout" rel="nofollow">PyTorch’s functional dropout</a></li>`,zi,rn,Hr=`The best way to fix the problem is usually to look at the forward pass of the original implementation and the 🤗
Transformers implementation side-by-side and check if there are any differences. Ideally, you should debug/print out
intermediate outputs of both implementations of the forward pass to find the exact position in the network where the 🤗
Transformers implementation shows a different output than the original implementation. First, make sure that the
hard-coded <code>input_ids</code> in both scripts are identical. Next, verify that the outputs of the first transformation of
the <code>input_ids</code> (usually the word embeddings) are identical. And then work your way up to the very last layer of the
network. At some point, you will notice a difference between the two implementations, which should point you to the bug
in the 🤗 Transformers implementation. From our experience, a simple and efficient way is to add many print statements
in both the original implementation and 🤗 Transformers implementation, at the same positions in the network
respectively, and to successively remove print statements showing the same values for intermediate presentations.`,Pi,dn,Zr=`When you’re confident that both implementations yield the same output, verify the outputs with
<code>torch.allclose(original_output, output, atol=1e-3)</code>, you’re done with the most difficult part! Congratulations - the
work left to be done should be a cakewalk 😊.`,Gi,mn,Br="<strong>8. Adding all necessary model tests</strong>",Ei,pn,Nr=`At this point, you have successfully added a new model. However, it is very much possible that the model does not yet
fully comply with the required design. To make sure, the implementation is fully compatible with 🤗 Transformers, all
common tests should pass. The Cookiecutter should have automatically added a test file for your model, probably under
the same <code>tests/models/brand_new_bert/test_modeling_brand_new_bert.py</code>. Run this test file to verify that all common
tests pass:`,Qi,hn,Vi,un,Wr="Having fixed all common tests, it is now crucial to ensure that all the nice work you have done is well tested, so that",Di,fn,Rr="<li>a) The community can easily understand your work by looking at specific tests of <em>brand_new_bert</em></li> <li>b) Future changes to your model will not break any important feature of the model.</li>",Yi,cn,zr=`At first, integration tests should be added. Those integration tests essentially do the same as the debugging scripts
you used earlier to implement the model to 🤗 Transformers. A template of those model tests has already added by the
Cookiecutter, called <code>BrandNewBertModelIntegrationTests</code> and only has to be filled out by you. To ensure that those
tests are passing, run`,Fi,yn,Si,x,Xi,wn,Pr=`Second, all features that are special to <em>brand_new_bert</em> should be tested additionally in a separate test under
<code>BrandNewBertModelTester</code>/\`<code>BrandNewBertModelTest</code>. This part is often forgotten but is extremely useful in two
ways:`,qi,Mn,Gr=`<li>It helps to transfer the knowledge you have acquired during the model addition to the community by showing how the
special features of <em>brand_new_bert</em> should work.</li> <li>Future contributors can quickly test changes to the model by running those special tests.</li>`,Oi,Tn,Er="<strong>9. Implement the tokenizer</strong>",Ki,gn,Qr=`Next, we should add the tokenizer of <em>brand_new_bert</em>. Usually, the tokenizer is equivalent to or very similar to an
already existing tokenizer of 🤗 Transformers.`,es,bn,Vr=`It is very important to find/extract the original tokenizer file and to manage to load this file into the 🤗
Transformers’ implementation of the tokenizer.`,ts,vn,Dr="To ensure that the tokenizer works correctly, it is recommended to first create a script in the original repository\nthat inputs a string and returns the `input_ids“. It could look similar to this (in pseudo-code):",ns,Jn,ls,jn,Yr=`You might have to take a deeper look again into the original repository to find the correct tokenizer function or you
might even have to do changes to your clone of the original repository to only output the <code>input_ids</code>. Having written
a functional tokenization script that uses the original repository, an analogous script for 🤗 Transformers should be
created. It should look similar to this:`,os,Cn,is,kn,Fr="When both <code>input_ids</code> yield the same values, as a final step a tokenizer test file should also be added.",ss,Un,Sr=`Analogous to the modeling test files of <em>brand_new_bert</em>, the tokenization test files of <em>brand_new_bert</em> should
contain a couple of hard-coded integration tests.`,as,_n,Xr="<strong>10. Run End-to-end integration tests</strong>",rs,In,qr=`Having added the tokenizer, you should also add a couple of end-to-end integration tests using both the model and the
tokenizer to <code>tests/models/brand_new_bert/test_modeling_brand_new_bert.py</code> in 🤗 Transformers.
Such a test should show on a meaningful
text-to-text sample that the 🤗 Transformers implementation works as expected. A meaningful text-to-text sample can
include <em>e.g.</em> a source-to-target-translation pair, an article-to-summary pair, a question-to-answer pair, etc… If none
of the ported checkpoints has been fine-tuned on a downstream task it is enough to simply rely on the model tests. In a
final step to ensure that the model is fully functional, it is advised that you also run all tests on GPU. It can
happen that you forgot to add some <code>.to(self.device)</code> statements to internal tensors of the model, which in such a
test would show in an error. In case you have no access to a GPU, the Hugging Face team can take care of running those
tests for you.`,ds,xn,Or="<strong>11. Add Docstring</strong>",ms,$n,Kr=`Now, all the necessary functionality for <em>brand_new_bert</em> is added - you’re almost done! The only thing left to add is
a nice docstring and a doc page. The Cookiecutter should have added a template file called
<code>docs/source/model_doc/brand_new_bert.md</code> that you should fill out. Users of your model will usually first look at
this page before using your model. Hence, the documentation must be understandable and concise. It is very useful for
the community to add some <em>Tips</em> to show how the model should be used. Don’t hesitate to ping the Hugging Face team
regarding the docstrings.`,ps,Ln,ed=`Next, make sure that the docstring added to <code>src/transformers/models/brand_new_bert/modeling_brand_new_bert.py</code> is
correct and included all necessary inputs and outputs. We have a detailed guide about writing documentation and our docstring format <a href="writing-documentation">here</a>. It is always to good to remind oneself that documentation should
be treated at least as carefully as the code in 🤗 Transformers since the documentation is usually the first contact
point of the community with the model.`,hs,An,td="<strong>Code refactor</strong>",us,Hn,nd=`Great, now you have added all the necessary code for <em>brand_new_bert</em>. At this point, you should correct some potential
incorrect code style by running:`,fs,Zn,cs,Bn,ld="and verify that your coding style passes the quality check:",ys,Nn,ws,Wn,od=`There are a couple of other very strict design tests in 🤗 Transformers that might still be failing, which shows up in
the tests of your pull request. This is often because of some missing information in the docstring or some incorrect
naming. The Hugging Face team will surely help you if you’re stuck here.`,Ms,Rn,id=`Lastly, it is always a good idea to refactor one’s code after having ensured that the code works correctly. With all
tests passing, now it’s a good time to go over the added code again and do some refactoring.`,Ts,zn,sd="You have now finished the coding part, congratulation! 🎉 You are Awesome! 😎",gs,Pn,ad="<strong>12. Upload the models to the model hub</strong>",bs,Gn,rd=`In this final part, you should convert and upload all checkpoints to the model hub and add a model card for each
uploaded model checkpoint. You can get familiar with the hub functionalities by reading our <a href="model_sharing">Model sharing and uploading Page</a>. You should work alongside the Hugging Face team here to decide on a fitting name for each
checkpoint and to get the required access rights to be able to upload the model under the author’s organization of
<em>brand_new_bert</em>. The <code>push_to_hub</code> method, present in all models in <code>transformers</code>, is a quick and efficient way to push your checkpoint to the hub. A little snippet is pasted below:`,vs,En,Js,Qn,dd=`It is worth spending some time to create fitting model cards for each checkpoint. The model cards should highlight the
specific characteristics of this particular checkpoint, <em>e.g.</em> On which dataset was the checkpoint
pretrained/fine-tuned on? On what down-stream task should the model be used? And also include some code on how to
correctly use the model.`,js,Vn,md="<strong>13. (Optional) Add notebook</strong>",Cs,Dn,pd=`It is very helpful to add a notebook that showcases in-detail how <em>brand_new_bert</em> can be used for inference and/or
fine-tuned on a downstream task. This is not mandatory to merge your PR, but very useful for the community.`,ks,Yn,hd="<strong>14. Submit your finished PR</strong>",Us,Fn,ud=`You’re done programming now and can move to the last step, which is getting your PR merged into main. Usually, the
Hugging Face team should have helped you already at this point, but it is worth taking some time to give your finished
PR a nice description and eventually add comments to your code, if you want to point out certain design choices to your
reviewer.`,_s,Sn,Is,Xn,fd=`Now, it’s time to get some credit from the community for your work! Having completed a model addition is a major
contribution to Transformers and the whole NLP community. Your code and the ported pre-trained models will certainly be
used by hundreds and possibly even thousands of developers and researchers. You should be proud of your work and share
your achievements with the community.`,xs,qn,cd="<strong>You have made another model that is super easy to access for everyone in the community! 🤯</strong>",$s,el,Ls;return $=new M({props:{title:"How to add a model to 🤗 Transformers?",local:"how-to-add-a-model-to--transformers",headingTag:"h1"}}),v=new Td({props:{$$slots:{default:[_d]},$$scope:{ctx:On}}}),W=new M({props:{title:"General overview of 🤗 Transformers",local:"general-overview-of--transformers",headingTag:"h2"}}),Q=new M({props:{title:"Overview of models",local:"overview-of-models",headingTag:"h3"}}),F=new c({props:{code:"bW9kZWwlMjAlM0QlMjBCcmFuZE5ld0JlcnRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyYnJhbmR5JTJGYnJhbmRfbmV3X2JlcnQlMjIpJTBBbW9kZWwuY29uZmlnJTIwJTIwJTIzJTIwbW9kZWwlMjBoYXMlMjBhY2Nlc3MlMjB0byUyMGl0cyUyMGNvbmZpZw==",highlighted:`model = BrandNewBertModel.from_pretrained(<span class="hljs-string">&quot;brandy/brand_new_bert&quot;</span>)
model.config  <span class="hljs-comment"># model has access to its config</span>`,wrap:!1}}),X=new M({props:{title:"Code style",local:"code-style",headingTag:"h3"}}),K=new M({props:{title:"Overview of tokenizers",local:"overview-of-tokenizers",headingTag:"h3"}}),te=new M({props:{title:"Step-by-step recipe to add a model to 🤗 Transformers",local:"step-by-step-recipe-to-add-a-model-to--transformers",headingTag:"h2"}}),me=new M({props:{title:"1. (Optional) Theoretical aspects of BrandNewBert",local:"1-optional-theoretical-aspects-of-brandnewbert",headingTag:"h3"}}),fe=new M({props:{title:"2. Next prepare your environment",local:"2-next-prepare-your-environment",headingTag:"h3"}}),ye=new c({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`,wrap:!1}}),we=new c({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>`,wrap:!1}}),Te=new c({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1lJTIwJTIyLiU1QnF1YWxpdHklNUQlMjI=",highlighted:'pip install -e <span class="hljs-string">&quot;.[quality]&quot;</span>',wrap:!1}}),be=new c({props:{code:"Y2QlMjAuLg==",highlighted:'<span class="hljs-built_in">cd</span> ..',wrap:!1}}),Je=new c({props:{code:"Z2l0JTIwY2xvbmUlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZvcmdfdGhhdF9jcmVhdGVkX2JyYW5kX25ld19iZXJ0X29yZyUyRmJyYW5kX25ld19iZXJ0LmdpdCUwQWNkJTIwYnJhbmRfbmV3X2JlcnQlMEFwaXAlMjBpbnN0YWxsJTIwLWUlMjAu",highlighted:`git <span class="hljs-built_in">clone</span> https://github.com/org_that_created_brand_new_bert_org/brand_new_bert.git
<span class="hljs-built_in">cd</span> brand_new_bert
pip install -e .`,wrap:!1}}),Ce=new M({props:{title:"3.-4. Run a pretrained checkpoint using the original repository",local:"3-4-run-a-pretrained-checkpoint-using-the-original-repository",headingTag:"h3"}}),Ne=new c({props:{code:"bW9kZWwlMjAlM0QlMjBCcmFuZE5ld0JlcnRNb2RlbC5sb2FkX3ByZXRyYWluZWRfY2hlY2twb2ludCglMjIlMkZwYXRoJTJGdG8lMkZjaGVja3BvaW50JTJGJTIyKSUwQWlucHV0X2lkcyUyMCUzRCUyMCU1QjAlMkMlMjA0JTJDJTIwNSUyQyUyMDIlMkMlMjAzJTJDJTIwNyUyQyUyMDklNUQlMjAlMjAlMjMlMjB2ZWN0b3IlMjBvZiUyMGlucHV0JTIwaWRzJTBBb3JpZ2luYWxfb3V0cHV0JTIwJTNEJTIwbW9kZWwucHJlZGljdChpbnB1dF9pZHMp",highlighted:`model = BrandNewBertModel.load_pretrained_checkpoint(<span class="hljs-string">&quot;/path/to/checkpoint/&quot;</span>)
input_ids = [<span class="hljs-number">0</span>, <span class="hljs-number">4</span>, <span class="hljs-number">5</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>, <span class="hljs-number">7</span>, <span class="hljs-number">9</span>]  <span class="hljs-comment"># vector of input ids</span>
original_output = model.predict(input_ids)`,wrap:!1}}),Xe=new c({props:{code:"JTVCJTVCJTBBJTIwJTVCLTAuMTQ2NSUyQyUyMC0wLjY1MDElMkMlMjAlMjAwLjE5OTMlMkMlMjAlMjAuLi4lMkMlMjAlMjAwLjE0NTElMkMlMjAlMjAwLjM0MzAlMkMlMjAlMjAwLjYwMjQlNUQlMkMlMEElMjAlNUItMC40NDE3JTJDJTIwLTAuNTkyMCUyQyUyMCUyMDAuMzQ1MCUyQyUyMCUyMC4uLiUyQyUyMC0wLjMwNjIlMkMlMjAlMjAwLjYxODIlMkMlMjAlMjAwLjcxMzIlNUQlMkMlMEElMjAlNUItMC41MDA5JTJDJTIwLTAuNzEyMiUyQyUyMCUyMDAuNDU0OCUyQyUyMCUyMC4uLiUyQyUyMC0wLjM2NjIlMkMlMjAlMjAwLjYwOTElMkMlMjAlMjAwLjc2NDglNUQlMkMlMEElMjAuLi4lMkMlMEElMjAlNUItMC41NjEzJTJDJTIwLTAuNjMzMiUyQyUyMCUyMDAuNDMyNCUyQyUyMCUyMC4uLiUyQyUyMC0wLjM3OTIlMkMlMjAlMjAwLjczNzIlMkMlMjAlMjAwLjkyODglNUQlMkMlMEElMjAlNUItMC41NDE2JTJDJTIwLTAuNjM0NSUyQyUyMCUyMDAuNDE4MCUyQyUyMCUyMC4uLiUyQyUyMC0wLjM1NjQlMkMlMjAlMjAwLjY5OTIlMkMlMjAlMjAwLjkxOTElNUQlMkMlMEElMjAlNUItMC41MzM0JTJDJTIwLTAuNjQwMyUyQyUyMCUyMDAuNDI3MSUyQyUyMCUyMC4uLiUyQyUyMC0wLjMzMzklMkMlMjAlMjAwLjY1MzMlMkMlMjAlMjAwLjg2OTQlNUQlNUQlNUQlMkM=",highlighted:`<span class="hljs-comment">[<span class="hljs-comment">[
 <span class="hljs-comment">[-0.1465, -0.6501,  0.1993,  ...,  0.1451,  0.3430,  0.6024]</span>,
 <span class="hljs-comment">[-0.4417, -0.5920,  0.3450,  ..., -0.3062,  0.6182,  0.7132]</span>,
 <span class="hljs-comment">[-0.5009, -0.7122,  0.4548,  ..., -0.3662,  0.6091,  0.7648]</span>,
 ...,
 <span class="hljs-comment">[-0.5613, -0.6332,  0.4324,  ..., -0.3792,  0.7372,  0.9288]</span>,
 <span class="hljs-comment">[-0.5416, -0.6345,  0.4180,  ..., -0.3564,  0.6992,  0.9191]</span>,
 <span class="hljs-comment">[-0.5334, -0.6403,  0.4271,  ..., -0.3339,  0.6533,  0.8694]</span>]</span>]</span>,`,wrap:!1}}),et=new M({props:{title:"5.-14. Port BrandNewBert to 🤗 Transformers",local:"5-14-port-brandnewbert-to--transformers",headingTag:"h3"}}),nt=new c({props:{code:"Y2QlMjB0cmFuc2Zvcm1lcnM=",highlighted:'<span class="hljs-built_in">cd</span> transformers',wrap:!1}}),pt=new c({props:{code:"Z2l0JTIwY2hlY2tvdXQlMjAtYiUyMGFkZF9icmFuZF9uZXdfYmVydA==",highlighted:"git checkout -b add_brand_new_bert",wrap:!1}}),ht=new c({props:{code:"Z2l0JTIwYWRkJTIwLiUwQWdpdCUyMGNvbW1pdA==",highlighted:`git add .
git commit`,wrap:!1}}),ut=new c({props:{code:"Z2l0JTIwZmV0Y2glMjB1cHN0cmVhbSUwQWdpdCUyMHJlYmFzZSUyMHVwc3RyZWFtJTJGbWFpbg==",highlighted:`git fetch upstream
git rebase upstream/main`,wrap:!1}}),ft=new c({props:{code:"Z2l0JTIwcHVzaCUyMC11JTIwb3JpZ2luJTIwYS1kZXNjcmlwdGl2ZS1uYW1lLWZvci1teS1jaGFuZ2Vz",highlighted:"git push -u origin a-descriptive-name-for-my-changes",wrap:!1}}),yt=new c({props:{code:"Z2l0JTIwZmV0Y2glMjB1cHN0cmVhbSUwQWdpdCUyMG1lcmdlJTIwdXBzdHJlYW0lMkZtYWlu",highlighted:`git fetch upstream
git merge upstream/main`,wrap:!1}}),jt=new c({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJyYW5kTmV3QmVydE1vZGVsJTJDJTIwQnJhbmROZXdCZXJ0Q29uZmlnJTBBJTBBbW9kZWwlMjAlM0QlMjBCcmFuZE5ld0JlcnRNb2RlbChCcmFuZE5ld0JlcnRDb25maWcoKSk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BrandNewBertModel, BrandNewBertConfig

model = BrandNewBertModel(BrandNewBertConfig())`,wrap:!1}}),Ut=new c({props:{code:"ZGVmJTIwX2luaXRfd2VpZ2h0cyhzZWxmJTJDJTIwbW9kdWxlKSUzQSUwQSUyMCUyMCUyMCUyMCUyMiUyMiUyMkluaXRpYWxpemUlMjB0aGUlM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uZmlsbF8oMS4wKQ==",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">_init_weights</span>(<span class="hljs-params">self, module</span>):
    <span class="hljs-string">&quot;&quot;&quot;Initialize the weights&quot;&quot;&quot;</span>
    <span class="hljs-keyword">if</span> <span class="hljs-built_in">isinstance</span>(module, nn.Linear):
        module.weight.data.normal_(mean=<span class="hljs-number">0.0</span>, std=self.config.initializer_range)
        <span class="hljs-keyword">if</span> module.bias <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> <span class="hljs-literal">None</span>:
            module.bias.data.zero_()
    <span class="hljs-keyword">elif</span> <span class="hljs-built_in">isinstance</span>(module, nn.Embedding):
        module.weight.data.normal_(mean=<span class="hljs-number">0.0</span>, std=self.config.initializer_range)
        <span class="hljs-keyword">if</span> module.padding_idx <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> <span class="hljs-literal">None</span>:
            module.weight.data[module.padding_idx].zero_()
    <span class="hljs-keyword">elif</span> <span class="hljs-built_in">isinstance</span>(module, nn.LayerNorm):
        module.bias.data.zero_()
        module.weight.data.fill_(<span class="hljs-number">1.0</span>)`,wrap:!1}}),It=new c({props:{code:"ZGVmJTIwX2luaXRfd2VpZ2h0cyhzZWxmJTJDJTIwbW9kdWxlKSUzQSUwQSUyMCUyMCUyMCUyMCUyMiUyMiUyMkluaXRpYWxpemUlMjB0aGUlMjB3ZWlnaHRzJTIyJTIyJTIyJTBBJTIwJTIwJTIwJTIwaWYlMjBpc2luc3RhbmNlKG1vZHVsZSUyQyUyMFdhdjJWZWMyRm9yUHJlVHJhaW5pbmcpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbW9kdWxlLnByb2plY3RfaGlkLnJlc2V0X3BhcmFtZXRlcnMoKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG1vZHVsZS5wcm9qZWN0X3EucmVzZXRfcGFyYW1ldGVycygpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbW9kdWxlLnByb2plY3RfaGlkLl9pc19oZl9pbml0aWFsaXplZCUyMCUzRCUyMFRydWUlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBtb2R1bGUucHJvamVjdF9xLl9pc19oZl9pbml0aWFsaXplZCUyMCUzRCUyMFRydWUlMEElMjAlMjAlMjAlMjBlbGlmJTIwaXNpbnN0YW5jZShtb2R1bGUlMkMlMjBubi5MaW5lYXIpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbW9kdWxlLndlaWdodC5kYXRhLm5vcm1hbF8obWVhbiUzRDAuMCUyQyUyMHN0ZCUzRHNlbGYuY29uZmlnLmluaXRpYWxpemVyX3JhbmdlKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGlmJTIwbW9kdWxlLmJpYXMlMjBpcyUyMG5vdCUyME5vbmUlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBtb2R1bGUuYmlhcy5kYXRhLnplcm9fKCk=",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">_init_weights</span>(<span class="hljs-params">self, module</span>):
    <span class="hljs-string">&quot;&quot;&quot;Initialize the weights&quot;&quot;&quot;</span>
    <span class="hljs-keyword">if</span> <span class="hljs-built_in">isinstance</span>(module, Wav2Vec2ForPreTraining):
        module.project_hid.reset_parameters()
        module.project_q.reset_parameters()
        module.project_hid._is_hf_initialized = <span class="hljs-literal">True</span>
        module.project_q._is_hf_initialized = <span class="hljs-literal">True</span>
    <span class="hljs-keyword">elif</span> <span class="hljs-built_in">isinstance</span>(module, nn.Linear):
        module.weight.data.normal_(mean=<span class="hljs-number">0.0</span>, std=self.config.initializer_range)
        <span class="hljs-keyword">if</span> module.bias <span class="hljs-keyword">is</span> <span class="hljs-keyword">not</span> <span class="hljs-literal">None</span>:
            module.bias.data.zero_()`,wrap:!1}}),Zt=new c({props:{code:"ZnJvbSUyMHRvcmNoJTIwaW1wb3J0JTIwbm4lMEElMEElMEFjbGFzcyUyMFNpbXBsZU1vZGVsKG5uLk1vZHVsZSklM0ElMEElMjAlMjAlMjAlMjBkZWYlMjBfX2luaXRfXyhzZWxmKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHN1cGVyKCkuX19pbml0X18oKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHNlbGYuZGVuc2UlMjAlM0QlMjBubi5MaW5lYXIoMTAlMkMlMjAxMCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBzZWxmLmludGVybWVkaWF0ZSUyMCUzRCUyMG5uLkxpbmVhcigxMCUyQyUyMDEwKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHNlbGYubGF5ZXJfbm9ybSUyMCUzRCUyMG5uLkxheWVyTm9ybSgxMCk=",highlighted:`<span class="hljs-keyword">from</span> torch <span class="hljs-keyword">import</span> nn


<span class="hljs-keyword">class</span> <span class="hljs-title class_">SimpleModel</span>(nn.Module):
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__init__</span>(<span class="hljs-params">self</span>):
        <span class="hljs-built_in">super</span>().__init__()
        self.dense = nn.Linear(<span class="hljs-number">10</span>, <span class="hljs-number">10</span>)
        self.intermediate = nn.Linear(<span class="hljs-number">10</span>, <span class="hljs-number">10</span>)
        self.layer_norm = nn.LayerNorm(<span class="hljs-number">10</span>)`,wrap:!1}}),Nt=new c({props:{code:"bW9kZWwlMjAlM0QlMjBTaW1wbGVNb2RlbCgpJTBBJTBBcHJpbnQobW9kZWwp",highlighted:`model = SimpleModel()

<span class="hljs-built_in">print</span>(model)`,wrap:!1}}),Rt=new c({props:{code:"U2ltcGxlTW9kZWwoJTBBJTIwJTIwKGRlbnNlKSUzQSUyMExpbmVhcihpbl9mZWF0dXJlcyUzRDEwJTJDJTIwb3V0X2ZlYXR1cmVzJTNEMTAlMkMlMjBiaWFzJTNEVHJ1ZSklMEElMjAlMjAoaW50ZXJtZWRpYXRlKSUzQSUyMExpbmVhcihpbl9mZWF0dXJlcyUzRDEwJTJDJTIwb3V0X2ZlYXR1cmVzJTNEMTAlMkMlMjBiaWFzJTNEVHJ1ZSklMEElMjAlMjAobGF5ZXJfbm9ybSklM0ElMjBMYXllck5vcm0oKDEwJTJDKSUyQyUyMGVwcyUzRDFlLTA1JTJDJTIwZWxlbWVudHdpc2VfYWZmaW5lJTNEVHJ1ZSklMEEp",highlighted:`SimpleModel(
  (dense): Linear(<span class="hljs-attribute">in_features</span>=10, <span class="hljs-attribute">out_features</span>=10, <span class="hljs-attribute">bias</span>=<span class="hljs-literal">True</span>)
  (intermediate): Linear(<span class="hljs-attribute">in_features</span>=10, <span class="hljs-attribute">out_features</span>=10, <span class="hljs-attribute">bias</span>=<span class="hljs-literal">True</span>)
  (layer_norm): LayerNorm((10,), <span class="hljs-attribute">eps</span>=1e-05, <span class="hljs-attribute">elementwise_affine</span>=<span class="hljs-literal">True</span>)
)`,wrap:!1}}),Pt=new c({props:{code:"cHJpbnQobW9kZWwuZGVuc2Uud2VpZ2h0LmRhdGEp",highlighted:'<span class="hljs-built_in">print</span>(model.dense.weight.data)',wrap:!1}}),Et=new c({props:{code:"dGVuc29yKCU1QiU1Qi0wLjA4MTglMkMlMjAlMjAwLjIyMDclMkMlMjAtMC4wNzQ5JTJDJTIwLTAuMDAzMCUyQyUyMCUyMDAuMDA0NSUyQyUyMC0wLjE1NjklMkMlMjAtMC4xNTk4JTJDJTIwJTIwMC4wMjEyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLTAuMjA3NyUyQyUyMCUyMDAuMjE1NyU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1QiUyMDAuMTA0NCUyQyUyMCUyMDAuMDIwMSUyQyUyMCUyMDAuMDk5MCUyQyUyMCUyMDAuMjQ4MiUyQyUyMCUyMDAuMzExNiUyQyUyMCUyMDAuMjUwOSUyQyUyMCUyMDAuMjg2NiUyQyU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UyMC0wLjI3MTAlMkMlMjAtMC4xNTg2JTJDJTIwJTIwMC4wNzM5JTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwMC4yMjIwJTJDJTIwJTIwMC4yMzU4JTVEJTVEKS4=",highlighted:`tensor([[<span class="hljs-string">-0</span>.0818,  0.2207, <span class="hljs-string">-0</span>.0749, <span class="hljs-string">-0</span>.0030,  0.0045, <span class="hljs-string">-0</span>.1569, <span class="hljs-string">-0</span>.1598,  0.0212,
         <span class="hljs-string">-0</span>.2077,  0.2157],
        [ 0.1044,  0.0201,  0.0990,  0.2482,  0.3116,  0.2509,  0.2866, <span class="hljs-string">-0</span>.2190,
          0.2166, <span class="hljs-string">-0</span>.0212],
        [<span class="hljs-string">-0</span>.2000,  0.1107, <span class="hljs-string">-0</span>.1999, <span class="hljs-string">-0</span>.3119,  0.1559,  0.0993,  0.1776, <span class="hljs-string">-0</span>.1950,
         <span class="hljs-string">-0</span>.1023, <span class="hljs-string">-0</span>.0447],
        [<span class="hljs-string">-0</span>.0888, <span class="hljs-string">-0</span>.1092,  0.2281,  0.0336,  0.1817, <span class="hljs-string">-0</span>.0115,  0.2096,  0.1415,
         <span class="hljs-string">-0</span>.1876, <span class="hljs-string">-0</span>.2467],
        [ 0.2208, <span class="hljs-string">-0</span>.2352, <span class="hljs-string">-0</span>.1426, <span class="hljs-string">-0</span>.2636, <span class="hljs-string">-0</span>.2889, <span class="hljs-string">-0</span>.2061, <span class="hljs-string">-0</span>.2849, <span class="hljs-string">-0</span>.0465,
          0.2577,  0.0402],
        [ 0.1502,  0.2465,  0.2566,  0.0693,  0.2352, <span class="hljs-string">-0</span>.0530,  0.1859, <span class="hljs-string">-0</span>.0604,
          0.2132,  0.1680],
        [ 0.1733, <span class="hljs-string">-0</span>.2407, <span class="hljs-string">-0</span>.1721,  0.1484,  0.0358, <span class="hljs-string">-0</span>.0633, <span class="hljs-string">-0</span>.0721, <span class="hljs-string">-0</span>.0090,
          0.2707, <span class="hljs-string">-0</span>.2509],
        [<span class="hljs-string">-0</span>.1173,  0.1561,  0.2945,  0.0595, <span class="hljs-string">-0</span>.1996,  0.2988, <span class="hljs-string">-0</span>.0802,  0.0407,
          0.1829, <span class="hljs-string">-0</span>.1568],
        [<span class="hljs-string">-0</span>.1164, <span class="hljs-string">-0</span>.2228, <span class="hljs-string">-0</span>.0403,  0.0428,  0.1339,  0.0047,  0.1967,  0.2923,
          0.0333, <span class="hljs-string">-0</span>.0536],
        [<span class="hljs-string">-0</span>.1492, <span class="hljs-string">-0</span>.1616,  0.1057,  0.1950, <span class="hljs-string">-0</span>.2807, <span class="hljs-string">-0</span>.2710, <span class="hljs-string">-0</span>.1586,  0.0739,
          0.2220,  0.2358]]).`,wrap:!1}}),Vt=new c({props:{code:"JTIzJTIwcmV0cmlldmUlMjBtYXRjaGluZyUyMGxheWVyJTIwd2VpZ2h0cyUyQyUyMGUuZy4lMjBieSUwQSUyMyUyMHJlY3Vyc2l2ZSUyMGFsZ29yaXRobSUwQWxheWVyX25hbWUlMjAlM0QlMjAlMjJkZW5zZSUyMiUwQXByZXRyYWluZWRfd2VpZ2h0JTIwJTNEJTIwYXJyYXlfb2ZfZGVuc2VfbGF5ZXIlMEElMEFtb2RlbF9wb2ludGVyJTIwJTNEJTIwZ2V0YXR0cihtb2RlbCUyQyUyMCUyMmRlbnNlJTIyKSUwQSUwQW1vZGVsX3BvaW50ZXIud2VpZ2h0LmRhdGElMjAlM0QlMjB0b3JjaC5mcm9tX251bXB5KHByZXRyYWluZWRfd2VpZ2h0KQ==",highlighted:`<span class="hljs-comment"># retrieve matching layer weights, e.g. by</span>
<span class="hljs-comment"># recursive algorithm</span>
layer_name = <span class="hljs-string">&quot;dense&quot;</span>
pretrained_weight = array_of_dense_layer

model_pointer = <span class="hljs-built_in">getattr</span>(model, <span class="hljs-string">&quot;dense&quot;</span>)

model_pointer.weight.data = torch.from_numpy(pretrained_weight)`,wrap:!1}}),Yt=new c({props:{code:"YXNzZXJ0JTIwKCUwQSUyMCUyMCUyMCUyMG1vZGVsX3BvaW50ZXIud2VpZ2h0LnNoYXBlJTIwJTNEJTNEJTIwcHJldHJhaW5lZF93ZWlnaHQuc2hhcGUlMEEpJTJDJTIwZiUyMlBvaW50ZXIlMjBzaGFwZSUyMG9mJTIwcmFuZG9tJTIwd2VpZ2h0JTIwJTdCbW9kZWxfcG9pbnRlci5zaGFwZSU3RCUyMGFuZCUyMGFycmF5JTIwc2hhcGUlMjBvZiUyMGNoZWNrcG9pbnQlMjB3ZWlnaHQlMjAlN0JwcmV0cmFpbmVkX3dlaWdodC5zaGFwZSU3RCUyMG1pc21hdGNoZWQlMjI=",highlighted:`<span class="hljs-keyword">assert</span> (
    model_pointer.weight.shape == pretrained_weight.shape
), <span class="hljs-string">f&quot;Pointer shape of random weight <span class="hljs-subst">{model_pointer.shape}</span> and array shape of checkpoint weight <span class="hljs-subst">{pretrained_weight.shape}</span> mismatched&quot;</span>`,wrap:!1}}),St=new c({props:{code:"bG9nZ2VyLmluZm8oZiUyMkluaXRpYWxpemUlMjBQeVRvcmNoJTIwd2VpZ2h0JTIwJTdCbGF5ZXJfbmFtZSU3RCUyMGZyb20lMjAlN0JwcmV0cmFpbmVkX3dlaWdodC5uYW1lJTdEJTIyKQ==",highlighted:'logger.info(<span class="hljs-string">f&quot;Initialize PyTorch weight <span class="hljs-subst">{layer_name}</span> from <span class="hljs-subst">{pretrained_weight.name}</span>&quot;</span>)',wrap:!1}}),en=new c({props:{code:"bW9kZWwuc2F2ZV9wcmV0cmFpbmVkKCUyMiUyRnBhdGglMkZ0byUyRmNvbnZlcnRlZCUyRmNoZWNrcG9pbnQlMkZmb2xkZXIlMjIp",highlighted:'model.save_pretrained(<span class="hljs-string">&quot;/path/to/converted/checkpoint/folder&quot;</span>)',wrap:!1}}),ln=new c({props:{code:"bW9kZWwlMjAlM0QlMjBCcmFuZE5ld0JlcnRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyJTJGcGF0aCUyRnRvJTJGY29udmVydGVkJTJGY2hlY2twb2ludCUyRmZvbGRlciUyMiklMEFpbnB1dF9pZHMlMjAlM0QlMjAlNUIwJTJDJTIwNCUyQyUyMDQlMkMlMjAzJTJDJTIwMiUyQyUyMDQlMkMlMjAxJTJDJTIwNyUyQyUyMDE5JTVEJTBBb3V0cHV0JTIwJTNEJTIwbW9kZWwoaW5wdXRfaWRzKS5sYXN0X2hpZGRlbl9zdGF0ZXM=",highlighted:`model = BrandNewBertModel.from_pretrained(<span class="hljs-string">&quot;/path/to/converted/checkpoint/folder&quot;</span>)
input_ids = [<span class="hljs-number">0</span>, <span class="hljs-number">4</span>, <span class="hljs-number">4</span>, <span class="hljs-number">3</span>, <span class="hljs-number">2</span>, <span class="hljs-number">4</span>, <span class="hljs-number">1</span>, <span class="hljs-number">7</span>, <span class="hljs-number">19</span>]
output = model(input_ids).last_hidden_states`,wrap:!1}}),hn=new c({props:{code:"cHl0ZXN0JTIwdGVzdHMlMkZtb2RlbHMlMkZicmFuZF9uZXdfYmVydCUyRnRlc3RfbW9kZWxpbmdfYnJhbmRfbmV3X2JlcnQucHk=",highlighted:"pytest tests/models/brand_new_bert/test_modeling_brand_new_bert.py",wrap:!1}}),yn=new c({props:{code:"UlVOX1NMT1clM0QxJTIwcHl0ZXN0JTIwLXN2JTIwdGVzdHMlMkZtb2RlbHMlMkZicmFuZF9uZXdfYmVydCUyRnRlc3RfbW9kZWxpbmdfYnJhbmRfbmV3X2JlcnQucHklM0ElM0FCcmFuZE5ld0JlcnRNb2RlbEludGVncmF0aW9uVGVzdHM=",highlighted:"RUN_SLOW=1 pytest -sv tests/models/brand_new_bert/test_modeling_brand_new_bert.py::BrandNewBertModelIntegrationTests",wrap:!1}}),x=new Td({props:{$$slots:{default:[Id]},$$scope:{ctx:On}}}),Jn=new c({props:{code:"aW5wdXRfc3RyJTIwJTNEJTIwJTIyVGhpcyUyMGlzJTIwYSUyMGxvbmclMjBleGFtcGxlJTIwaW5wdXQlMjBzdHJpbmclMjBjb250YWluaW5nJTIwc3BlY2lhbCUyMGNoYXJhY3RlcnMlMjAuJTI0JTNGLSUyQyUyMG51bWJlcnMlMjAyODcyJTIwMjM0JTIwMTIlMjBhbmQlMjB3b3Jkcy4lMjIlMEFtb2RlbCUyMCUzRCUyMEJyYW5kTmV3QmVydE1vZGVsLmxvYWRfcHJldHJhaW5lZF9jaGVja3BvaW50KCUyMiUyRnBhdGglMkZ0byUyRmNoZWNrcG9pbnQlMkYlMjIpJTBBaW5wdXRfaWRzJTIwJTNEJTIwbW9kZWwudG9rZW5pemUoaW5wdXRfc3RyKQ==",highlighted:`input_str = <span class="hljs-string">&quot;This is a long example input string containing special characters .$?-, numbers 2872 234 12 and words.&quot;</span>
model = BrandNewBertModel.load_pretrained_checkpoint(<span class="hljs-string">&quot;/path/to/checkpoint/&quot;</span>)
input_ids = model.tokenize(input_str)`,wrap:!1}}),Cn=new c({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEJyYW5kTmV3QmVydFRva2VuaXplciUwQSUwQWlucHV0X3N0ciUyMCUzRCUyMCUyMlRoaXMlMjBpcyUyMGElMjBsb25nJTIwZXhhbXBsZSUyMGlucHV0JTIwc3RyaW5nJTIwY29udGFpbmluZyUyMHNwZWNpYWwlMjBjaGFyYWN0ZXJzJTIwLiUyNCUzRi0lMkMlMjBudW1iZXJzJTIwMjg3MiUyMDIzNCUyMDEyJTIwYW5kJTIwd29yZHMuJTIyJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQnJhbmROZXdCZXJ0VG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjIlMkZwYXRoJTJGdG8lMkZ0b2tlbml6ZXIlMkZmb2xkZXIlMkYlMjIpJTBBJTBBaW5wdXRfaWRzJTIwJTNEJTIwdG9rZW5pemVyKGlucHV0X3N0cikuaW5wdXRfaWRz",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BrandNewBertTokenizer

input_str = <span class="hljs-string">&quot;This is a long example input string containing special characters .$?-, numbers 2872 234 12 and words.&quot;</span>

tokenizer = BrandNewBertTokenizer.from_pretrained(<span class="hljs-string">&quot;/path/to/tokenizer/folder/&quot;</span>)

input_ids = tokenizer(input_str).input_ids`,wrap:!1}}),Zn=new c({props:{code:"bWFrZSUyMHN0eWxl",highlighted:"make style",wrap:!1}}),Nn=new c({props:{code:"bWFrZSUyMHF1YWxpdHk=",highlighted:"make quality",wrap:!1}}),En=new c({props:{code:"YnJhbmRfbmV3X2JlcnQucHVzaF90b19odWIoJTIyYnJhbmRfbmV3X2JlcnQlMjIpJTBBJTIzJTIwVW5jb21tZW50JTIwdGhlJTIwZm9sbG93aW5nJTIwbGluZSUyMHRvJTIwcHVzaCUyMHRvJTIwYW4lMjBvcmdhbml6YXRpb24uJTBBJTIzJTIwYnJhbmRfbmV3X2JlcnQucHVzaF90b19odWIoJTIyJTNDb3JnYW5pemF0aW9uJTNFJTJGYnJhbmRfbmV3X2JlcnQlMjIp",highlighted:`brand_new_bert.push_to_hub(<span class="hljs-string">&quot;brand_new_bert&quot;</span>)
<span class="hljs-comment"># Uncomment the following line to push to an organization.</span>
<span class="hljs-comment"># brand_new_bert.push_to_hub(&quot;&lt;organization&gt;/brand_new_bert&quot;)</span>`,wrap:!1}}),Sn=new M({props:{title:"Share your work!!",local:"share-your-work",headingTag:"h3"}}),{c(){y=s("meta"),T=o(),w=s("p"),b=o(),d($.$$.fragment),tl=o(),L=s("p"),L.innerHTML=As,nl=o(),d(v.$$.fragment),ll=o(),A=s("p"),A.textContent=Hs,ol=o(),H=s("ul"),H.innerHTML=Zs,il=o(),Z=s("p"),Z.textContent=Bs,sl=o(),B=s("p"),B.innerHTML=Ns,al=o(),N=s("p"),N.textContent=Ws,rl=o(),d(W.$$.fragment),dl=o(),R=s("p"),R.textContent=Rs,ml=o(),z=s("p"),z.innerHTML=zs,pl=o(),P=s("ul"),P.innerHTML=Ps,hl=o(),G=s("p"),G.innerHTML=Gs,ul=o(),E=s("p"),E.textContent=Es,fl=o(),d(Q.$$.fragment),cl=o(),V=s("p"),V.innerHTML=Qs,yl=o(),D=s("p"),D.textContent=Vs,wl=o(),Kn=s("img"),Ml=o(),Y=s("p"),Y.innerHTML=Ys,Tl=o(),d(F.$$.fragment),gl=o(),S=s("p"),S.innerHTML=Fs,bl=o(),d(X.$$.fragment),vl=o(),q=s("p"),q.textContent=Ss,Jl=o(),O=s("ol"),O.innerHTML=Xs,jl=o(),d(K.$$.fragment),Cl=o(),ee=s("p"),ee.textContent=qs,kl=o(),d(te.$$.fragment),Ul=o(),ne=s("p"),ne.textContent=Os,_l=o(),le=s("ol"),le.innerHTML=Ks,Il=o(),oe=s("p"),oe.textContent=ea,xl=o(),ie=s("ul"),ie.innerHTML=ta,$l=o(),se=s("p"),se.textContent=na,Ll=o(),ae=s("p"),ae.textContent=la,Al=o(),re=s("p"),re.innerHTML=oa,Hl=o(),de=s("p"),de.innerHTML=ia,Zl=o(),d(me.$$.fragment),Bl=o(),pe=s("p"),pe.innerHTML=sa,Nl=o(),he=s("ul"),he.innerHTML=aa,Wl=o(),ue=s("p"),ue.textContent=ra,Rl=o(),d(fe.$$.fragment),zl=o(),ce=s("ol"),ce.innerHTML=da,Pl=o(),d(ye.$$.fragment),Gl=o(),J=s("ol"),J.innerHTML=ma,El=o(),d(we.$$.fragment),Ql=o(),Me=s("p"),Me.textContent=pa,Vl=o(),d(Te.$$.fragment),Dl=o(),ge=s("p"),ge.textContent=ha,Yl=o(),d(be.$$.fragment),Fl=o(),j=s("ol"),j.innerHTML=ua,Sl=o(),ve=s("p"),ve.innerHTML=fa,Xl=o(),C=s("ol"),C.innerHTML=ca,ql=o(),d(Je.$$.fragment),Ol=o(),je=s("p"),je.innerHTML=ya,Kl=o(),d(Ce.$$.fragment),eo=o(),ke=s("p"),ke.innerHTML=wa,to=o(),Ue=s("p"),Ue.textContent=Ma,no=o(),_e=s("p"),_e.innerHTML=Ta,lo=o(),Ie=s("ul"),Ie.innerHTML=ga,oo=o(),xe=s("p"),xe.innerHTML=ba,io=o(),$e=s("p"),$e.textContent=va,so=o(),Le=s("p"),Le.textContent=Ja,ao=o(),Ae=s("ul"),Ae.innerHTML=ja,ro=o(),He=s("p"),He.textContent=Ca,mo=o(),Ze=s("p"),Ze.innerHTML=ka,po=o(),Be=s("p"),Be.innerHTML=Ua,ho=o(),d(Ne.$$.fragment),uo=o(),We=s("p"),We.textContent=_a,fo=o(),Re=s("ul"),Re.innerHTML=Ia,co=o(),ze=s("p"),ze.textContent=xa,yo=o(),Pe=s("p"),Pe.innerHTML=$a,wo=o(),Ge=s("ul"),Ge.innerHTML=La,Mo=o(),Ee=s("p"),Ee.innerHTML=Aa,To=o(),Qe=s("p"),Qe.innerHTML=Ha,go=o(),Ve=s("p"),Ve.textContent=Za,bo=o(),De=s("p"),De.textContent=Ba,vo=o(),Ye=s("ol"),Ye.innerHTML=Na,Jo=o(),Fe=s("p"),Fe.innerHTML=Wa,jo=o(),Se=s("p"),Se.textContent=Ra,Co=o(),d(Xe.$$.fragment),ko=o(),qe=s("p"),qe.innerHTML=za,Uo=o(),Oe=s("ul"),Oe.innerHTML=Pa,_o=o(),Ke=s("p"),Ke.innerHTML=Ga,Io=o(),d(et.$$.fragment),xo=o(),tt=s("p"),tt.textContent=Ea,$o=o(),d(nt.$$.fragment),Lo=o(),lt=s("p"),lt.innerHTML=Qa,Ao=o(),ot=s("p"),ot.textContent=Va,Ho=o(),it=s("ul"),it.innerHTML=Da,Zo=o(),st=s("p"),st.innerHTML=Ya,Bo=o(),at=s("p"),at.innerHTML=Fa,No=o(),rt=s("p"),rt.innerHTML=Sa,Wo=o(),dt=s("p"),dt.textContent=Xa,Ro=o(),mt=s("ol"),mt.innerHTML=qa,zo=o(),d(pt.$$.fragment),Po=o(),k=s("ol"),k.innerHTML=Oa,Go=o(),d(ht.$$.fragment),Eo=o(),U=s("ol"),U.innerHTML=Ka,Qo=o(),d(ut.$$.fragment),Vo=o(),_=s("ol"),_.innerHTML=er,Do=o(),d(ft.$$.fragment),Yo=o(),I=s("ol"),I.innerHTML=tr,Fo=o(),ct=s("p"),ct.textContent=nr,So=o(),d(yt.$$.fragment),Xo=o(),wt=s("p"),wt.textContent=lr,qo=o(),Mt=s("p"),Mt.textContent=or,Oo=o(),Tt=s("p"),Tt.textContent=ir,Ko=o(),gt=s("p"),gt.innerHTML=sr,ei=o(),bt=s("p"),bt.innerHTML=ar,ti=o(),vt=s("p"),vt.innerHTML=rr,ni=o(),Jt=s("p"),Jt.innerHTML=dr,li=o(),d(jt.$$.fragment),oi=o(),Ct=s("p"),Ct.innerHTML=mr,ii=o(),kt=s("p"),kt.innerHTML=pr,si=o(),d(Ut.$$.fragment),ai=o(),_t=s("p"),_t.innerHTML=hr,ri=o(),d(It.$$.fragment),di=o(),xt=s("p"),xt.innerHTML=ur,mi=o(),$t=s("p"),$t.innerHTML=fr,pi=o(),Lt=s("p"),Lt.innerHTML=cr,hi=o(),At=s("ul"),At.innerHTML=yr,ui=o(),Ht=s("p"),Ht.innerHTML=wr,fi=o(),d(Zt.$$.fragment),ci=o(),Bt=s("p"),Bt.innerHTML=Mr,yi=o(),d(Nt.$$.fragment),wi=o(),Wt=s("p"),Wt.textContent=Tr,Mi=o(),d(Rt.$$.fragment),Ti=o(),zt=s("p"),zt.textContent=gr,gi=o(),d(Pt.$$.fragment),bi=o(),Gt=s("p"),Gt.textContent=br,vi=o(),d(Et.$$.fragment),Ji=o(),Qt=s("p"),Qt.innerHTML=vr,ji=o(),d(Vt.$$.fragment),Ci=o(),Dt=s("p"),Dt.innerHTML=Jr,ki=o(),d(Yt.$$.fragment),Ui=o(),Ft=s("p"),Ft.innerHTML=jr,_i=o(),d(St.$$.fragment),Ii=o(),Xt=s("p"),Xt.textContent=Cr,xi=o(),qt=s("p"),qt.innerHTML=kr,$i=o(),Ot=s("p"),Ot.innerHTML=Ur,Li=o(),Kt=s("p"),Kt.innerHTML=_r,Ai=o(),d(en.$$.fragment),Hi=o(),tn=s("p"),tn.innerHTML=Ir,Zi=o(),nn=s("p"),nn.innerHTML=xr,Bi=o(),d(ln.$$.fragment),Ni=o(),on=s("p"),on.innerHTML=$r,Wi=o(),sn=s("p"),sn.innerHTML=Lr,Ri=o(),an=s("ul"),an.innerHTML=Ar,zi=o(),rn=s("p"),rn.innerHTML=Hr,Pi=o(),dn=s("p"),dn.innerHTML=Zr,Gi=o(),mn=s("p"),mn.innerHTML=Br,Ei=o(),pn=s("p"),pn.innerHTML=Nr,Qi=o(),d(hn.$$.fragment),Vi=o(),un=s("p"),un.textContent=Wr,Di=o(),fn=s("ul"),fn.innerHTML=Rr,Yi=o(),cn=s("p"),cn.innerHTML=zr,Fi=o(),d(yn.$$.fragment),Si=o(),d(x.$$.fragment),Xi=o(),wn=s("p"),wn.innerHTML=Pr,qi=o(),Mn=s("ul"),Mn.innerHTML=Gr,Oi=o(),Tn=s("p"),Tn.innerHTML=Er,Ki=o(),gn=s("p"),gn.innerHTML=Qr,es=o(),bn=s("p"),bn.textContent=Vr,ts=o(),vn=s("p"),vn.textContent=Dr,ns=o(),d(Jn.$$.fragment),ls=o(),jn=s("p"),jn.innerHTML=Yr,os=o(),d(Cn.$$.fragment),is=o(),kn=s("p"),kn.innerHTML=Fr,ss=o(),Un=s("p"),Un.innerHTML=Sr,as=o(),_n=s("p"),_n.innerHTML=Xr,rs=o(),In=s("p"),In.innerHTML=qr,ds=o(),xn=s("p"),xn.innerHTML=Or,ms=o(),$n=s("p"),$n.innerHTML=Kr,ps=o(),Ln=s("p"),Ln.innerHTML=ed,hs=o(),An=s("p"),An.innerHTML=td,us=o(),Hn=s("p"),Hn.innerHTML=nd,fs=o(),d(Zn.$$.fragment),cs=o(),Bn=s("p"),Bn.textContent=ld,ys=o(),d(Nn.$$.fragment),ws=o(),Wn=s("p"),Wn.textContent=od,Ms=o(),Rn=s("p"),Rn.textContent=id,Ts=o(),zn=s("p"),zn.textContent=sd,gs=o(),Pn=s("p"),Pn.innerHTML=ad,bs=o(),Gn=s("p"),Gn.innerHTML=rd,vs=o(),d(En.$$.fragment),Js=o(),Qn=s("p"),Qn.innerHTML=dd,js=o(),Vn=s("p"),Vn.innerHTML=md,Cs=o(),Dn=s("p"),Dn.innerHTML=pd,ks=o(),Yn=s("p"),Yn.innerHTML=hd,Us=o(),Fn=s("p"),Fn.textContent=ud,_s=o(),d(Sn.$$.fragment),Is=o(),Xn=s("p"),Xn.textContent=fd,xs=o(),qn=s("p"),qn.innerHTML=cd,$s=o(),el=s("p"),this.h()},l(e){const t=kd("svelte-u9bgzb",document.head);y=a(t,"META",{name:!0,content:!0}),t.forEach(n),T=i(e),w=a(e,"P",{}),Md(w).forEach(n),b=i(e),m($.$$.fragment,e),tl=i(e),L=a(e,"P",{"data-svelte-h":!0}),r(L)!=="svelte-wxtsp1"&&(L.innerHTML=As),nl=i(e),m(v.$$.fragment,e),ll=i(e),A=a(e,"P",{"data-svelte-h":!0}),r(A)!=="svelte-1k9yxd1"&&(A.textContent=Hs),ol=i(e),H=a(e,"UL",{"data-svelte-h":!0}),r(H)!=="svelte-167a1ja"&&(H.innerHTML=Zs),il=i(e),Z=a(e,"P",{"data-svelte-h":!0}),r(Z)!=="svelte-1wxv5qq"&&(Z.textContent=Bs),sl=i(e),B=a(e,"P",{"data-svelte-h":!0}),r(B)!=="svelte-77fy0j"&&(B.innerHTML=Ns),al=i(e),N=a(e,"P",{"data-svelte-h":!0}),r(N)!=="svelte-ug8854"&&(N.textContent=Ws),rl=i(e),m(W.$$.fragment,e),dl=i(e),R=a(e,"P",{"data-svelte-h":!0}),r(R)!=="svelte-rkgkw1"&&(R.textContent=Rs),ml=i(e),z=a(e,"P",{"data-svelte-h":!0}),r(z)!=="svelte-hekrk0"&&(z.innerHTML=zs),pl=i(e),P=a(e,"UL",{"data-svelte-h":!0}),r(P)!=="svelte-9txdfw"&&(P.innerHTML=Ps),hl=i(e),G=a(e,"P",{"data-svelte-h":!0}),r(G)!=="svelte-77738k"&&(G.innerHTML=Gs),ul=i(e),E=a(e,"P",{"data-svelte-h":!0}),r(E)!=="svelte-1z0o4ph"&&(E.textContent=Es),fl=i(e),m(Q.$$.fragment,e),cl=i(e),V=a(e,"P",{"data-svelte-h":!0}),r(V)!=="svelte-1dh1r4n"&&(V.innerHTML=Qs),yl=i(e),D=a(e,"P",{"data-svelte-h":!0}),r(D)!=="svelte-1bv64m8"&&(D.textContent=Vs),wl=i(e),Kn=a(e,"IMG",{src:!0}),Ml=i(e),Y=a(e,"P",{"data-svelte-h":!0}),r(Y)!=="svelte-zxzexe"&&(Y.innerHTML=Ys),Tl=i(e),m(F.$$.fragment,e),gl=i(e),S=a(e,"P",{"data-svelte-h":!0}),r(S)!=="svelte-h7ys5j"&&(S.innerHTML=Fs),bl=i(e),m(X.$$.fragment,e),vl=i(e),q=a(e,"P",{"data-svelte-h":!0}),r(q)!=="svelte-105bqi8"&&(q.textContent=Ss),Jl=i(e),O=a(e,"OL",{"data-svelte-h":!0}),r(O)!=="svelte-3selcg"&&(O.innerHTML=Xs),jl=i(e),m(K.$$.fragment,e),Cl=i(e),ee=a(e,"P",{"data-svelte-h":!0}),r(ee)!=="svelte-10n9flr"&&(ee.textContent=qs),kl=i(e),m(te.$$.fragment,e),Ul=i(e),ne=a(e,"P",{"data-svelte-h":!0}),r(ne)!=="svelte-u747sz"&&(ne.textContent=Os),_l=i(e),le=a(e,"OL",{"data-svelte-h":!0}),r(le)!=="svelte-b7gw6m"&&(le.innerHTML=Ks),Il=i(e),oe=a(e,"P",{"data-svelte-h":!0}),r(oe)!=="svelte-lru7u6"&&(oe.textContent=ea),xl=i(e),ie=a(e,"UL",{"data-svelte-h":!0}),r(ie)!=="svelte-otnau5"&&(ie.innerHTML=ta),$l=i(e),se=a(e,"P",{"data-svelte-h":!0}),r(se)!=="svelte-sv8a89"&&(se.textContent=na),Ll=i(e),ae=a(e,"P",{"data-svelte-h":!0}),r(ae)!=="svelte-1ydy9mz"&&(ae.textContent=la),Al=i(e),re=a(e,"P",{"data-svelte-h":!0}),r(re)!=="svelte-w74yfn"&&(re.innerHTML=oa),Hl=i(e),de=a(e,"P",{"data-svelte-h":!0}),r(de)!=="svelte-1pmt80l"&&(de.innerHTML=ia),Zl=i(e),m(me.$$.fragment,e),Bl=i(e),pe=a(e,"P",{"data-svelte-h":!0}),r(pe)!=="svelte-10phlbf"&&(pe.innerHTML=sa),Nl=i(e),he=a(e,"UL",{"data-svelte-h":!0}),r(he)!=="svelte-1b4oxlm"&&(he.innerHTML=aa),Wl=i(e),ue=a(e,"P",{"data-svelte-h":!0}),r(ue)!=="svelte-g50mc6"&&(ue.textContent=ra),Rl=i(e),m(fe.$$.fragment,e),zl=i(e),ce=a(e,"OL",{"data-svelte-h":!0}),r(ce)!=="svelte-klt7ii"&&(ce.innerHTML=da),Pl=i(e),m(ye.$$.fragment,e),Gl=i(e),J=a(e,"OL",{start:!0,"data-svelte-h":!0}),r(J)!=="svelte-9h285g"&&(J.innerHTML=ma),El=i(e),m(we.$$.fragment,e),Ql=i(e),Me=a(e,"P",{"data-svelte-h":!0}),r(Me)!=="svelte-4wf1r3"&&(Me.textContent=pa),Vl=i(e),m(Te.$$.fragment,e),Dl=i(e),ge=a(e,"P",{"data-svelte-h":!0}),r(ge)!=="svelte-182t6ba"&&(ge.textContent=ha),Yl=i(e),m(be.$$.fragment,e),Fl=i(e),j=a(e,"OL",{start:!0,"data-svelte-h":!0}),r(j)!=="svelte-fi4dxm"&&(j.innerHTML=ua),Sl=i(e),ve=a(e,"P",{"data-svelte-h":!0}),r(ve)!=="svelte-6bybv3"&&(ve.innerHTML=fa),Xl=i(e),C=a(e,"OL",{start:!0,"data-svelte-h":!0}),r(C)!=="svelte-17p20v0"&&(C.innerHTML=ca),ql=i(e),m(Je.$$.fragment,e),Ol=i(e),je=a(e,"P",{"data-svelte-h":!0}),r(je)!=="svelte-63px9k"&&(je.innerHTML=ya),Kl=i(e),m(Ce.$$.fragment,e),eo=i(e),ke=a(e,"P",{"data-svelte-h":!0}),r(ke)!=="svelte-hj6dkp"&&(ke.innerHTML=wa),to=i(e),Ue=a(e,"P",{"data-svelte-h":!0}),r(Ue)!=="svelte-1wodnvr"&&(Ue.textContent=Ma),no=i(e),_e=a(e,"P",{"data-svelte-h":!0}),r(_e)!=="svelte-172lkai"&&(_e.innerHTML=Ta),lo=i(e),Ie=a(e,"UL",{"data-svelte-h":!0}),r(Ie)!=="svelte-10bloo4"&&(Ie.innerHTML=ga),oo=i(e),xe=a(e,"P",{"data-svelte-h":!0}),r(xe)!=="svelte-1jxuc4f"&&(xe.innerHTML=ba),io=i(e),$e=a(e,"P",{"data-svelte-h":!0}),r($e)!=="svelte-197bmdq"&&($e.textContent=va),so=i(e),Le=a(e,"P",{"data-svelte-h":!0}),r(Le)!=="svelte-9v9j15"&&(Le.textContent=Ja),ao=i(e),Ae=a(e,"UL",{"data-svelte-h":!0}),r(Ae)!=="svelte-1k92mpt"&&(Ae.innerHTML=ja),ro=i(e),He=a(e,"P",{"data-svelte-h":!0}),r(He)!=="svelte-xdlpes"&&(He.textContent=Ca),mo=i(e),Ze=a(e,"P",{"data-svelte-h":!0}),r(Ze)!=="svelte-1u4zdsg"&&(Ze.innerHTML=ka),po=i(e),Be=a(e,"P",{"data-svelte-h":!0}),r(Be)!=="svelte-1g4uiwx"&&(Be.innerHTML=Ua),ho=i(e),m(Ne.$$.fragment,e),uo=i(e),We=a(e,"P",{"data-svelte-h":!0}),r(We)!=="svelte-17f6vr7"&&(We.textContent=_a),fo=i(e),Re=a(e,"UL",{"data-svelte-h":!0}),r(Re)!=="svelte-1w5zp67"&&(Re.innerHTML=Ia),co=i(e),ze=a(e,"P",{"data-svelte-h":!0}),r(ze)!=="svelte-69ds49"&&(ze.textContent=xa),yo=i(e),Pe=a(e,"P",{"data-svelte-h":!0}),r(Pe)!=="svelte-17olrqh"&&(Pe.innerHTML=$a),wo=i(e),Ge=a(e,"UL",{"data-svelte-h":!0}),r(Ge)!=="svelte-uaiiy7"&&(Ge.innerHTML=La),Mo=i(e),Ee=a(e,"P",{"data-svelte-h":!0}),r(Ee)!=="svelte-pv6v4"&&(Ee.innerHTML=Aa),To=i(e),Qe=a(e,"P",{"data-svelte-h":!0}),r(Qe)!=="svelte-1ex3w25"&&(Qe.innerHTML=Ha),go=i(e),Ve=a(e,"P",{"data-svelte-h":!0}),r(Ve)!=="svelte-1480vjb"&&(Ve.textContent=Za),bo=i(e),De=a(e,"P",{"data-svelte-h":!0}),r(De)!=="svelte-1sttzvl"&&(De.textContent=Ba),vo=i(e),Ye=a(e,"OL",{"data-svelte-h":!0}),r(Ye)!=="svelte-1u0bkk8"&&(Ye.innerHTML=Na),Jo=i(e),Fe=a(e,"P",{"data-svelte-h":!0}),r(Fe)!=="svelte-xvgy42"&&(Fe.innerHTML=Wa),jo=i(e),Se=a(e,"P",{"data-svelte-h":!0}),r(Se)!=="svelte-a9oe4g"&&(Se.textContent=Ra),Co=i(e),m(Xe.$$.fragment,e),ko=i(e),qe=a(e,"P",{"data-svelte-h":!0}),r(qe)!=="svelte-1d7jpm"&&(qe.innerHTML=za),Uo=i(e),Oe=a(e,"UL",{"data-svelte-h":!0}),r(Oe)!=="svelte-1bsafyj"&&(Oe.innerHTML=Pa),_o=i(e),Ke=a(e,"P",{"data-svelte-h":!0}),r(Ke)!=="svelte-1fog5tn"&&(Ke.innerHTML=Ga),Io=i(e),m(et.$$.fragment,e),xo=i(e),tt=a(e,"P",{"data-svelte-h":!0}),r(tt)!=="svelte-hwuqxz"&&(tt.textContent=Ea),$o=i(e),m(nt.$$.fragment,e),Lo=i(e),lt=a(e,"P",{"data-svelte-h":!0}),r(lt)!=="svelte-1492az0"&&(lt.innerHTML=Qa),Ao=i(e),ot=a(e,"P",{"data-svelte-h":!0}),r(ot)!=="svelte-1xw3dz2"&&(ot.textContent=Va),Ho=i(e),it=a(e,"UL",{"data-svelte-h":!0}),r(it)!=="svelte-1k5sxi0"&&(it.innerHTML=Da),Zo=i(e),st=a(e,"P",{"data-svelte-h":!0}),r(st)!=="svelte-1a60q7m"&&(st.innerHTML=Ya),Bo=i(e),at=a(e,"P",{"data-svelte-h":!0}),r(at)!=="svelte-1e0s43k"&&(at.innerHTML=Fa),No=i(e),rt=a(e,"P",{"data-svelte-h":!0}),r(rt)!=="svelte-1aoj71c"&&(rt.innerHTML=Sa),Wo=i(e),dt=a(e,"P",{"data-svelte-h":!0}),r(dt)!=="svelte-3h83p"&&(dt.textContent=Xa),Ro=i(e),mt=a(e,"OL",{"data-svelte-h":!0}),r(mt)!=="svelte-14ngdyo"&&(mt.innerHTML=qa),zo=i(e),m(pt.$$.fragment,e),Po=i(e),k=a(e,"OL",{start:!0,"data-svelte-h":!0}),r(k)!=="svelte-ebgta7"&&(k.innerHTML=Oa),Go=i(e),m(ht.$$.fragment,e),Eo=i(e),U=a(e,"OL",{start:!0,"data-svelte-h":!0}),r(U)!=="svelte-1xlslu7"&&(U.innerHTML=Ka),Qo=i(e),m(ut.$$.fragment,e),Vo=i(e),_=a(e,"OL",{start:!0,"data-svelte-h":!0}),r(_)!=="svelte-1wwc89z"&&(_.innerHTML=er),Do=i(e),m(ft.$$.fragment,e),Yo=i(e),I=a(e,"OL",{start:!0,"data-svelte-h":!0}),r(I)!=="svelte-1k28gwf"&&(I.innerHTML=tr),Fo=i(e),ct=a(e,"P",{"data-svelte-h":!0}),r(ct)!=="svelte-fby7tz"&&(ct.textContent=nr),So=i(e),m(yt.$$.fragment,e),Xo=i(e),wt=a(e,"P",{"data-svelte-h":!0}),r(wt)!=="svelte-707ott"&&(wt.textContent=lr),qo=i(e),Mt=a(e,"P",{"data-svelte-h":!0}),r(Mt)!=="svelte-10vuoyb"&&(Mt.textContent=or),Oo=i(e),Tt=a(e,"P",{"data-svelte-h":!0}),r(Tt)!=="svelte-1rsqt8e"&&(Tt.textContent=ir),Ko=i(e),gt=a(e,"P",{"data-svelte-h":!0}),r(gt)!=="svelte-e56uo0"&&(gt.innerHTML=sr),ei=i(e),bt=a(e,"P",{"data-svelte-h":!0}),r(bt)!=="svelte-1pev0u3"&&(bt.innerHTML=ar),ti=i(e),vt=a(e,"P",{"data-svelte-h":!0}),r(vt)!=="svelte-o2c99d"&&(vt.innerHTML=rr),ni=i(e),Jt=a(e,"P",{"data-svelte-h":!0}),r(Jt)!=="svelte-cf404e"&&(Jt.innerHTML=dr),li=i(e),m(jt.$$.fragment,e),oi=i(e),Ct=a(e,"P",{"data-svelte-h":!0}),r(Ct)!=="svelte-1dloo7i"&&(Ct.innerHTML=mr),ii=i(e),kt=a(e,"P",{"data-svelte-h":!0}),r(kt)!=="svelte-nsqyfa"&&(kt.innerHTML=pr),si=i(e),m(Ut.$$.fragment,e),ai=i(e),_t=a(e,"P",{"data-svelte-h":!0}),r(_t)!=="svelte-sj6wf0"&&(_t.innerHTML=hr),ri=i(e),m(It.$$.fragment,e),di=i(e),xt=a(e,"P",{"data-svelte-h":!0}),r(xt)!=="svelte-1pfm0sb"&&(xt.innerHTML=ur),mi=i(e),$t=a(e,"P",{"data-svelte-h":!0}),r($t)!=="svelte-f68cwo"&&($t.innerHTML=fr),pi=i(e),Lt=a(e,"P",{"data-svelte-h":!0}),r(Lt)!=="svelte-vdut7s"&&(Lt.innerHTML=cr),hi=i(e),At=a(e,"UL",{"data-svelte-h":!0}),r(At)!=="svelte-16vb6hw"&&(At.innerHTML=yr),ui=i(e),Ht=a(e,"P",{"data-svelte-h":!0}),r(Ht)!=="svelte-14nqqv0"&&(Ht.innerHTML=wr),fi=i(e),m(Zt.$$.fragment,e),ci=i(e),Bt=a(e,"P",{"data-svelte-h":!0}),r(Bt)!=="svelte-p81vjw"&&(Bt.innerHTML=Mr),yi=i(e),m(Nt.$$.fragment,e),wi=i(e),Wt=a(e,"P",{"data-svelte-h":!0}),r(Wt)!=="svelte-ilov09"&&(Wt.textContent=Tr),Mi=i(e),m(Rt.$$.fragment,e),Ti=i(e),zt=a(e,"P",{"data-svelte-h":!0}),r(zt)!=="svelte-13dugi2"&&(zt.textContent=gr),gi=i(e),m(Pt.$$.fragment,e),bi=i(e),Gt=a(e,"P",{"data-svelte-h":!0}),r(Gt)!=="svelte-1lx6n8g"&&(Gt.textContent=br),vi=i(e),m(Et.$$.fragment,e),Ji=i(e),Qt=a(e,"P",{"data-svelte-h":!0}),r(Qt)!=="svelte-1t5qty0"&&(Qt.innerHTML=vr),ji=i(e),m(Vt.$$.fragment,e),Ci=i(e),Dt=a(e,"P",{"data-svelte-h":!0}),r(Dt)!=="svelte-1b67ucv"&&(Dt.innerHTML=Jr),ki=i(e),m(Yt.$$.fragment,e),Ui=i(e),Ft=a(e,"P",{"data-svelte-h":!0}),r(Ft)!=="svelte-10rxzj1"&&(Ft.innerHTML=jr),_i=i(e),m(St.$$.fragment,e),Ii=i(e),Xt=a(e,"P",{"data-svelte-h":!0}),r(Xt)!=="svelte-tq4e7m"&&(Xt.textContent=Cr),xi=i(e),qt=a(e,"P",{"data-svelte-h":!0}),r(qt)!=="svelte-nguxo0"&&(qt.innerHTML=kr),$i=i(e),Ot=a(e,"P",{"data-svelte-h":!0}),r(Ot)!=="svelte-5g2dr4"&&(Ot.innerHTML=Ur),Li=i(e),Kt=a(e,"P",{"data-svelte-h":!0}),r(Kt)!=="svelte-jkulr9"&&(Kt.innerHTML=_r),Ai=i(e),m(en.$$.fragment,e),Hi=i(e),tn=a(e,"P",{"data-svelte-h":!0}),r(tn)!=="svelte-8ivqw6"&&(tn.innerHTML=Ir),Zi=i(e),nn=a(e,"P",{"data-svelte-h":!0}),r(nn)!=="svelte-1v8xetm"&&(nn.innerHTML=xr),Bi=i(e),m(ln.$$.fragment,e),Ni=i(e),on=a(e,"P",{"data-svelte-h":!0}),r(on)!=="svelte-txar7q"&&(on.innerHTML=$r),Wi=i(e),sn=a(e,"P",{"data-svelte-h":!0}),r(sn)!=="svelte-10rs2ro"&&(sn.innerHTML=Lr),Ri=i(e),an=a(e,"UL",{"data-svelte-h":!0}),r(an)!=="svelte-1r46n3h"&&(an.innerHTML=Ar),zi=i(e),rn=a(e,"P",{"data-svelte-h":!0}),r(rn)!=="svelte-1i2mpdn"&&(rn.innerHTML=Hr),Pi=i(e),dn=a(e,"P",{"data-svelte-h":!0}),r(dn)!=="svelte-16p1dlw"&&(dn.innerHTML=Zr),Gi=i(e),mn=a(e,"P",{"data-svelte-h":!0}),r(mn)!=="svelte-1q8o052"&&(mn.innerHTML=Br),Ei=i(e),pn=a(e,"P",{"data-svelte-h":!0}),r(pn)!=="svelte-13ruakv"&&(pn.innerHTML=Nr),Qi=i(e),m(hn.$$.fragment,e),Vi=i(e),un=a(e,"P",{"data-svelte-h":!0}),r(un)!=="svelte-1z4cf"&&(un.textContent=Wr),Di=i(e),fn=a(e,"UL",{"data-svelte-h":!0}),r(fn)!=="svelte-1msq586"&&(fn.innerHTML=Rr),Yi=i(e),cn=a(e,"P",{"data-svelte-h":!0}),r(cn)!=="svelte-2t6h0z"&&(cn.innerHTML=zr),Fi=i(e),m(yn.$$.fragment,e),Si=i(e),m(x.$$.fragment,e),Xi=i(e),wn=a(e,"P",{"data-svelte-h":!0}),r(wn)!=="svelte-1wqbt18"&&(wn.innerHTML=Pr),qi=i(e),Mn=a(e,"UL",{"data-svelte-h":!0}),r(Mn)!=="svelte-1192mxo"&&(Mn.innerHTML=Gr),Oi=i(e),Tn=a(e,"P",{"data-svelte-h":!0}),r(Tn)!=="svelte-1l7w7z9"&&(Tn.innerHTML=Er),Ki=i(e),gn=a(e,"P",{"data-svelte-h":!0}),r(gn)!=="svelte-17g0btz"&&(gn.innerHTML=Qr),es=i(e),bn=a(e,"P",{"data-svelte-h":!0}),r(bn)!=="svelte-w3jgow"&&(bn.textContent=Vr),ts=i(e),vn=a(e,"P",{"data-svelte-h":!0}),r(vn)!=="svelte-1g2gl02"&&(vn.textContent=Dr),ns=i(e),m(Jn.$$.fragment,e),ls=i(e),jn=a(e,"P",{"data-svelte-h":!0}),r(jn)!=="svelte-12b6z3d"&&(jn.innerHTML=Yr),os=i(e),m(Cn.$$.fragment,e),is=i(e),kn=a(e,"P",{"data-svelte-h":!0}),r(kn)!=="svelte-12o38jn"&&(kn.innerHTML=Fr),ss=i(e),Un=a(e,"P",{"data-svelte-h":!0}),r(Un)!=="svelte-m9dhdl"&&(Un.innerHTML=Sr),as=i(e),_n=a(e,"P",{"data-svelte-h":!0}),r(_n)!=="svelte-1r4x1hz"&&(_n.innerHTML=Xr),rs=i(e),In=a(e,"P",{"data-svelte-h":!0}),r(In)!=="svelte-1a2qjdi"&&(In.innerHTML=qr),ds=i(e),xn=a(e,"P",{"data-svelte-h":!0}),r(xn)!=="svelte-lu4l51"&&(xn.innerHTML=Or),ms=i(e),$n=a(e,"P",{"data-svelte-h":!0}),r($n)!=="svelte-ngbmem"&&($n.innerHTML=Kr),ps=i(e),Ln=a(e,"P",{"data-svelte-h":!0}),r(Ln)!=="svelte-y9aahr"&&(Ln.innerHTML=ed),hs=i(e),An=a(e,"P",{"data-svelte-h":!0}),r(An)!=="svelte-1h13ics"&&(An.innerHTML=td),us=i(e),Hn=a(e,"P",{"data-svelte-h":!0}),r(Hn)!=="svelte-1o0dhcg"&&(Hn.innerHTML=nd),fs=i(e),m(Zn.$$.fragment,e),cs=i(e),Bn=a(e,"P",{"data-svelte-h":!0}),r(Bn)!=="svelte-1hnvgw6"&&(Bn.textContent=ld),ys=i(e),m(Nn.$$.fragment,e),ws=i(e),Wn=a(e,"P",{"data-svelte-h":!0}),r(Wn)!=="svelte-158gt2o"&&(Wn.textContent=od),Ms=i(e),Rn=a(e,"P",{"data-svelte-h":!0}),r(Rn)!=="svelte-z20wkr"&&(Rn.textContent=id),Ts=i(e),zn=a(e,"P",{"data-svelte-h":!0}),r(zn)!=="svelte-1uwhc8b"&&(zn.textContent=sd),gs=i(e),Pn=a(e,"P",{"data-svelte-h":!0}),r(Pn)!=="svelte-cmu0wm"&&(Pn.innerHTML=ad),bs=i(e),Gn=a(e,"P",{"data-svelte-h":!0}),r(Gn)!=="svelte-11c1nk5"&&(Gn.innerHTML=rd),vs=i(e),m(En.$$.fragment,e),Js=i(e),Qn=a(e,"P",{"data-svelte-h":!0}),r(Qn)!=="svelte-hwxs76"&&(Qn.innerHTML=dd),js=i(e),Vn=a(e,"P",{"data-svelte-h":!0}),r(Vn)!=="svelte-1gie4tq"&&(Vn.innerHTML=md),Cs=i(e),Dn=a(e,"P",{"data-svelte-h":!0}),r(Dn)!=="svelte-1so49zx"&&(Dn.innerHTML=pd),ks=i(e),Yn=a(e,"P",{"data-svelte-h":!0}),r(Yn)!=="svelte-144ouhf"&&(Yn.innerHTML=hd),Us=i(e),Fn=a(e,"P",{"data-svelte-h":!0}),r(Fn)!=="svelte-jag54x"&&(Fn.textContent=ud),_s=i(e),m(Sn.$$.fragment,e),Is=i(e),Xn=a(e,"P",{"data-svelte-h":!0}),r(Xn)!=="svelte-d34izn"&&(Xn.textContent=fd),xs=i(e),qn=a(e,"P",{"data-svelte-h":!0}),r(qn)!=="svelte-1f9gbqf"&&(qn.innerHTML=cd),$s=i(e),el=a(e,"P",{}),Md(el).forEach(n),this.h()},h(){g(y,"name","hf:doc:metadata"),g(y,"content",$d),vd(Kn.src,Ds="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers_overview.png")||g(Kn,"src",Ds),g(J,"start","3"),g(j,"start","4"),g(C,"start","5"),g(k,"start","2"),g(U,"start","3"),g(_,"start","4"),g(I,"start","5")},m(e,t){Ud(document.head,y),l(e,T,t),l(e,w,t),l(e,b,t),p($,e,t),l(e,tl,t),l(e,L,t),l(e,nl,t),p(v,e,t),l(e,ll,t),l(e,A,t),l(e,ol,t),l(e,H,t),l(e,il,t),l(e,Z,t),l(e,sl,t),l(e,B,t),l(e,al,t),l(e,N,t),l(e,rl,t),p(W,e,t),l(e,dl,t),l(e,R,t),l(e,ml,t),l(e,z,t),l(e,pl,t),l(e,P,t),l(e,hl,t),l(e,G,t),l(e,ul,t),l(e,E,t),l(e,fl,t),p(Q,e,t),l(e,cl,t),l(e,V,t),l(e,yl,t),l(e,D,t),l(e,wl,t),l(e,Kn,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t),l(e,Vn,t),l(e,Cs,t),l(e,Dn,t),l(e,ks,t),l(e,Yn,t),l(e,Us,t),l(e,Fn,t),l(e,_s,t),p(Sn,e,t),l(e,Is,t),l(e,Xn,t),l(e,xs,t),l(e,qn,t),l(e,$s,t),l(e,el,t),Ls=!0},p(e,[t]){const yd={};t&2&&(yd.$$scope={dirty:t,ctx:e}),v.$set(yd);const wd={};t&2&&(wd.$$scope={dirty:t,ctx:e}),x.$set(wd)},i(e){Ls||(h($.$$.fragment,e),h(v.$$.fragment,e),h(W.$$.fragment,e),h(Q.$$.fragment,e),h(F.$$.fragment,e),h(X.$$.fragment,e),h(K.$$.fragment,e),h(te.$$.fragment,e),h(me.$$.fragment,e),h(fe.$$.fragment,e),h(ye.$$.fragment,e),h(we.$$.fragment,e),h(Te.$$.fragment,e),h(be.$$.fragment,e),h(Je.$$.fragment,e),h(Ce.$$.fragment,e),h(Ne.$$.fragment,e),h(Xe.$$.fragment,e),h(et.$$.fragment,e),h(nt.$$.fragment,e),h(pt.$$.fragment,e),h(ht.$$.fragment,e),h(ut.$$.fragment,e),h(ft.$$.fragment,e),h(yt.$$.fragment,e),h(jt.$$.fragment,e),h(Ut.$$.fragment,e),h(It.$$.fragment,e),h(Zt.$$.fragment,e),h(Nt.$$.fragment,e),h(Rt.$$.fragment,e),h(Pt.$$.fragment,e),h(Et.$$.fragment,e),h(Vt.$$.fragment,e),h(Yt.$$.fragment,e),h(St.$$.fragment,e),h(en.$$.fragment,e),h(ln.$$.fragment,e),h(hn.$$.fragment,e),h(yn.$$.fragment,e),h(x.$$.fragment,e),h(Jn.$$.fragment,e),h(Cn.$$.fragment,e),h(Zn.$$.fragment,e),h(Nn.$$.fragment,e),h(En.$$.fragment,e),h(Sn.$$.fragment,e),Ls=!0)},o(e){u($.$$.fragment,e),u(v.$$.fragment,e),u(W.$$.fragment,e),u(Q.$$.fragment,e),u(F.$$.fragment,e),u(X.$$.fragment,e),u(K.$$.fragment,e),u(te.$$.fragment,e),u(me.$$.fragment,e),u(fe.$$.fragment,e),u(ye.$$.fragment,e),u(we.$$.fragment,e),u(Te.$$.fragment,e),u(be.$$.fragment,e),u(Je.$$.fragment,e),u(Ce.$$.fragment,e),u(Ne.$$.fragment,e),u(Xe.$$.fragment,e),u(et.$$.fragment,e),u(nt.$$.fragment,e),u(pt.$$.fragment,e),u(ht.$$.fragment,e),u(ut.$$.fragment,e),u(ft.$$.fragment,e),u(yt.$$.fragment,e),u(jt.$$.fragment,e),u(Ut.$$.fragment,e),u(It.$$.fragment,e),u(Zt.$$.fragment,e),u(Nt.$$.fragment,e),u(Rt.$$.fragment,e),u(Pt.$$.fragment,e),u(Et.$$.fragment,e),u(Vt.$$.fragment,e),u(Yt.$$.fragment,e),u(St.$$.fragment,e),u(en.$$.fragment,e),u(ln.$$.fragment,e),u(hn.$$.fragment,e),u(yn.$$.fragment,e),u(x.$$.fragment,e),u(Jn.$$.fragment,e),u(Cn.$$.fragment,e),u(Zn.$$.fragment,e),u(Nn.$$.fragment,e),u(En.$$.fragment,e),u(Sn.$$.fragment,e),Ls=!1},d(e){e&&(n(T),n(w),n(b),n(tl),n(L),n(nl),n(ll),n(A),n(ol),n(H),n(il),n(Z),n(sl),n(B),n(al),n(N),n(rl),n(dl),n(R),n(ml),n(z),n(pl),n(P),n(hl),n(G),n(ul),n(E),n(fl),n(cl),n(V),n(yl),n(D),n(wl),n(Kn),n(Ml),n(Y),n(Tl),n(gl),n(S),n(bl),n(vl),n(q),n(Jl),n(O),n(jl),n(Cl),n(ee),n(kl),n(Ul),n(ne),n(_l),n(le),n(Il),n(oe),n(xl),n(ie),n($l),n(se),n(Ll),n(ae),n(Al),n(re),n(Hl),n(de),n(Zl),n(Bl),n(pe),n(Nl),n(he),n(Wl),n(ue),n(Rl),n(zl),n(ce),n(Pl),n(Gl),n(J),n(El),n(Ql),n(Me),n(Vl),n(Dl),n(ge),n(Yl),n(Fl),n(j),n(Sl),n(ve),n(Xl),n(C),n(ql),n(Ol),n(je),n(Kl),n(eo),n(ke),n(to),n(Ue),n(no),n(_e),n(lo),n(Ie),n(oo),n(xe),n(io),n($e),n(so),n(Le),n(ao),n(Ae),n(ro),n(He),n(mo),n(Ze),n(po),n(Be),n(ho),n(uo),n(We),n(fo),n(Re),n(co),n(ze),n(yo),n(Pe),n(wo),n(Ge),n(Mo),n(Ee),n(To),n(Qe),n(go),n(Ve),n(bo),n(De),n(vo),n(Ye),n(Jo),n(Fe),n(jo),n(Se),n(Co),n(ko),n(qe),n(Uo),n(Oe),n(_o),n(Ke),n(Io),n(xo),n(tt),n($o),n(Lo),n(lt),n(Ao),n(ot),n(Ho),n(it),n(Zo),n(st),n(Bo),n(at),n(No),n(rt),n(Wo),n(dt),n(Ro),n(mt),n(zo),n(Po),n(k),n(Go),n(Eo),n(U),n(Qo),n(Vo),n(_),n(Do),n(Yo),n(I),n(Fo),n(ct),n(So),n(Xo),n(wt),n(qo),n(Mt),n(Oo),n(Tt),n(Ko),n(gt),n(ei),n(bt),n(ti),n(vt),n(ni),n(Jt),n(li),n(oi),n(Ct),n(ii),n(kt),n(si),n(ai),n(_t),n(ri),n(di),n(xt),n(mi),n($t),n(pi),n(Lt),n(hi),n(At),n(ui),n(Ht),n(fi),n(ci),n(Bt),n(yi),n(wi),n(Wt),n(Mi),n(Ti),n(zt),n(gi),n(bi),n(Gt),n(vi),n(Ji),n(Qt),n(ji),n(Ci),n(Dt),n(ki),n(Ui),n(Ft),n(_i),n(Ii),n(Xt),n(xi),n(qt),n($i),n(Ot),n(Li),n(Kt),n(Ai),n(Hi),n(tn),n(Zi),n(nn),n(Bi),n(Ni),n(on),n(Wi),n(sn),n(Ri),n(an),n(zi),n(rn),n(Pi),n(dn),n(Gi),n(mn),n(Ei),n(pn),n(Qi),n(Vi),n(un),n(Di),n(fn),n(Yi),n(cn),n(Fi),n(Si),n(Xi),n(wn),n(qi),n(Mn),n(Oi),n(Tn),n(Ki),n(gn),n(es),n(bn),n(ts),n(vn),n(ns),n(ls),n(jn),n(os),n(is),n(kn),n(ss),n(Un),n(as),n(_n),n(rs),n(In),n(ds),n(xn),n(ms),n($n),n(ps),n(Ln),n(hs),n(An),n(us),n(Hn),n(fs),n(cs),n(Bn),n(ys),n(ws),n(Wn),n(Ms),n(Rn),n(Ts),n(zn),n(gs),n(Pn),n(bs),n(Gn),n(vs),n(Js),n(Qn),n(js),n(Vn),n(Cs),n(Dn),n(ks),n(Yn),n(Us),n(Fn),n(_s),n(Is),n(Xn),n(xs),n(qn),n($s),n(el)),n(y),f($,e),f(v,e),f(W,e),f(Q,e),f(F,e),f(X,e),f(K,e),f(te,e),f(me,e),f(fe,e),f(ye,e),f(we,e),f(Te,e),f(be,e),f(Je,e),f(Ce,e),f(Ne,e),f(Xe,e),f(et,e),f(nt,e),f(pt,e),f(ht,e),f(ut,e),f(ft,e),f(yt,e),f(jt,e),f(Ut,e),f(It,e),f(Zt,e),f(Nt,e),f(Rt,e),f(Pt,e),f(Et,e),f(Vt,e),f(Yt,e),f(St,e),f(en,e),f(ln,e),f(hn,e),f(yn,e),f(x,e),f(Jn,e),f(Cn,e),f(Zn,e),f(Nn,e),f(En,e),f(Sn,e)}}}const $d='{"title":"How to add a model to 🤗 Transformers?","local":"how-to-add-a-model-to--transformers","sections":[{"title":"General overview of 🤗 Transformers","local":"general-overview-of--transformers","sections":[{"title":"Overview of models","local":"overview-of-models","sections":[],"depth":3},{"title":"Code style","local":"code-style","sections":[],"depth":3},{"title":"Overview of tokenizers","local":"overview-of-tokenizers","sections":[],"depth":3}],"depth":2},{"title":"Step-by-step recipe to add a model to 🤗 Transformers","local":"step-by-step-recipe-to-add-a-model-to--transformers","sections":[{"title":"1. (Optional) Theoretical aspects of BrandNewBert","local":"1-optional-theoretical-aspects-of-brandnewbert","sections":[],"depth":3},{"title":"2. Next prepare your environment","local":"2-next-prepare-your-environment","sections":[],"depth":3},{"title":"3.-4. Run a pretrained checkpoint using the original repository","local":"3-4-run-a-pretrained-checkpoint-using-the-original-repository","sections":[],"depth":3},{"title":"5.-14. Port BrandNewBert to 🤗 Transformers","local":"5-14-port-brandnewbert-to--transformers","sections":[],"depth":3},{"title":"Share your work!!","local":"share-your-work","sections":[],"depth":3}],"depth":2}],"depth":1}';function Ld(On){return Jd(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Wd extends jd{constructor(y){super(),Cd(this,y,Ld,xd,bd,{})}}export{Wd as component};
