import{s as bs,o as js,n as F}from"../chunks/scheduler.9bc65507.js";import{S as _s,i as ws,g as u,s as o,r as h,A as Ms,h as f,f as s,c as i,j as gs,u as g,x as d,k as ys,y as vs,a,v as y,d as $,t as b,w as j}from"../chunks/index.707bf1b6.js";import{T as Ge}from"../chunks/Tip.c2ecdbf4.js";import{C as k}from"../chunks/CodeBlock.54a9f38d.js";import{F as $s,M as Gt}from"../chunks/Markdown.8ab98a13.js";import{H as I}from"../chunks/Heading.342b1fa6.js";function Ts(q){let n,c='You can also save your configuration file as a dictionary or even just the difference between your custom configuration attributes and the default configuration attributes! See the <a href="main_classes/configuration">configuration</a> documentation for more details.';return{c(){n=u("p"),n.innerHTML=c},l(l){n=f(l,"P",{"data-svelte-h":!0}),d(n)!=="svelte-4asqog"&&(n.innerHTML=c)},m(l,p){a(l,n,p)},p:F,d(l){l&&s(n)}}}function qs(q){let n,c="Load your custom configuration attributes into the model:",l,p,_,w,V="This creates a model with random values instead of pretrained weights. You won’t be able to use this model for anything useful yet until you train it. Training is a costly and time-consuming process. It is generally better to use a pretrained model to obtain better results faster, while using only a fraction of the resources required for training.",C,M,Z='Create a pretrained model with <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a>:',m,v,x,J,R="When you load pretrained weights, the default model configuration is automatically loaded if the model is provided by 🤗 Transformers. However, you can still replace - some or all of - the default model configuration attributes with your own if you’d like:",U,W,z;return p=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpc3RpbEJlcnRNb2RlbCUwQSUwQW15X2NvbmZpZyUyMCUzRCUyMERpc3RpbEJlcnRDb25maWcuZnJvbV9wcmV0cmFpbmVkKCUyMi4lMkZ5b3VyX21vZGVsX3NhdmVfcGF0aCUyRmNvbmZpZy5qc29uJTIyKSUwQW1vZGVsJTIwJTNEJTIwRGlzdGlsQmVydE1vZGVsKG15X2NvbmZpZyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertModel

<span class="hljs-meta">&gt;&gt;&gt; </span>my_config = DistilBertConfig.from_pretrained(<span class="hljs-string">&quot;./your_model_save_path/config.json&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = DistilBertModel(my_config)`,wrap:!1}}),v=new k({props:{code:"bW9kZWwlMjAlM0QlMjBEaXN0aWxCZXJ0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model = DistilBertModel.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)',wrap:!1}}),W=new k({props:{code:"bW9kZWwlMjAlM0QlMjBEaXN0aWxCZXJ0TW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyJTJDJTIwY29uZmlnJTNEbXlfY29uZmlnKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model = DistilBertModel.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>, config=my_config)',wrap:!1}}),{c(){n=u("p"),n.textContent=c,l=o(),h(p.$$.fragment),_=o(),w=u("p"),w.textContent=V,C=o(),M=u("p"),M.innerHTML=Z,m=o(),h(v.$$.fragment),x=o(),J=u("p"),J.textContent=R,U=o(),h(W.$$.fragment)},l(r){n=f(r,"P",{"data-svelte-h":!0}),d(n)!=="svelte-16yp9sj"&&(n.textContent=c),l=i(r),g(p.$$.fragment,r),_=i(r),w=f(r,"P",{"data-svelte-h":!0}),d(w)!=="svelte-17byrht"&&(w.textContent=V),C=i(r),M=f(r,"P",{"data-svelte-h":!0}),d(M)!=="svelte-tpvila"&&(M.innerHTML=Z),m=i(r),g(v.$$.fragment,r),x=i(r),J=f(r,"P",{"data-svelte-h":!0}),d(J)!=="svelte-1dfgiok"&&(J.textContent=R),U=i(r),g(W.$$.fragment,r)},m(r,T){a(r,n,T),a(r,l,T),y(p,r,T),a(r,_,T),a(r,w,T),a(r,C,T),a(r,M,T),a(r,m,T),y(v,r,T),a(r,x,T),a(r,J,T),a(r,U,T),y(W,r,T),z=!0},p:F,i(r){z||($(p.$$.fragment,r),$(v.$$.fragment,r),$(W.$$.fragment,r),z=!0)},o(r){b(p.$$.fragment,r),b(v.$$.fragment,r),b(W.$$.fragment,r),z=!1},d(r){r&&(s(n),s(l),s(_),s(w),s(C),s(M),s(m),s(x),s(J),s(U)),j(p,r),j(v,r),j(W,r)}}}function ks(q){let n,c;return n=new Gt({props:{$$slots:{default:[qs]},$$scope:{ctx:q}}}),{c(){h(n.$$.fragment)},l(l){g(n.$$.fragment,l)},m(l,p){y(n,l,p),c=!0},p(l,p){const _={};p&2&&(_.$$scope={dirty:p,ctx:l}),n.$set(_)},i(l){c||($(n.$$.fragment,l),c=!0)},o(l){b(n.$$.fragment,l),c=!1},d(l){j(n,l)}}}function Zs(q){let n,c="Load your custom configuration attributes into the model:",l,p,_,w,V="This creates a model with random values instead of pretrained weights. You won’t be able to use this model for anything useful yet until you train it. Training is a costly and time-consuming process. It is generally better to use a pretrained model to obtain better results faster, while using only a fraction of the resources required for training.",C,M,Z='Create a pretrained model with <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel.from_pretrained">from_pretrained()</a>:',m,v,x,J,R="When you load pretrained weights, the default model configuration is automatically loaded if the model is provided by 🤗 Transformers. However, you can still replace - some or all of - the default model configuration attributes with your own if you’d like:",U,W,z;return p=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGRGlzdGlsQmVydE1vZGVsJTBBJTBBbXlfY29uZmlnJTIwJTNEJTIwRGlzdGlsQmVydENvbmZpZy5mcm9tX3ByZXRyYWluZWQoJTIyLiUyRnlvdXJfbW9kZWxfc2F2ZV9wYXRoJTJGbXlfY29uZmlnLmpzb24lMjIpJTBBdGZfbW9kZWwlMjAlM0QlMjBURkRpc3RpbEJlcnRNb2RlbChteV9jb25maWcp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFDistilBertModel

<span class="hljs-meta">&gt;&gt;&gt; </span>my_config = DistilBertConfig.from_pretrained(<span class="hljs-string">&quot;./your_model_save_path/my_config.json&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertModel(my_config)`,wrap:!1}}),v=new k({props:{code:"dGZfbW9kZWwlMjAlM0QlMjBURkRpc3RpbEJlcnRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertModel.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)',wrap:!1}}),W=new k({props:{code:"dGZfbW9kZWwlMjAlM0QlMjBURkRpc3RpbEJlcnRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIlMkMlMjBjb25maWclM0RteV9jb25maWcp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertModel.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>, config=my_config)',wrap:!1}}),{c(){n=u("p"),n.textContent=c,l=o(),h(p.$$.fragment),_=o(),w=u("p"),w.textContent=V,C=o(),M=u("p"),M.innerHTML=Z,m=o(),h(v.$$.fragment),x=o(),J=u("p"),J.textContent=R,U=o(),h(W.$$.fragment)},l(r){n=f(r,"P",{"data-svelte-h":!0}),d(n)!=="svelte-16yp9sj"&&(n.textContent=c),l=i(r),g(p.$$.fragment,r),_=i(r),w=f(r,"P",{"data-svelte-h":!0}),d(w)!=="svelte-17byrht"&&(w.textContent=V),C=i(r),M=f(r,"P",{"data-svelte-h":!0}),d(M)!=="svelte-lmxxbw"&&(M.innerHTML=Z),m=i(r),g(v.$$.fragment,r),x=i(r),J=f(r,"P",{"data-svelte-h":!0}),d(J)!=="svelte-1dfgiok"&&(J.textContent=R),U=i(r),g(W.$$.fragment,r)},m(r,T){a(r,n,T),a(r,l,T),y(p,r,T),a(r,_,T),a(r,w,T),a(r,C,T),a(r,M,T),a(r,m,T),y(v,r,T),a(r,x,T),a(r,J,T),a(r,U,T),y(W,r,T),z=!0},p:F,i(r){z||($(p.$$.fragment,r),$(v.$$.fragment,r),$(W.$$.fragment,r),z=!0)},o(r){b(p.$$.fragment,r),b(v.$$.fragment,r),b(W.$$.fragment,r),z=!1},d(r){r&&(s(n),s(l),s(_),s(w),s(C),s(M),s(m),s(x),s(J),s(U)),j(p,r),j(v,r),j(W,r)}}}function Cs(q){let n,c;return n=new Gt({props:{$$slots:{default:[Zs]},$$scope:{ctx:q}}}),{c(){h(n.$$.fragment)},l(l){g(n.$$.fragment,l)},m(l,p){y(n,l,p),c=!0},p(l,p){const _={};p&2&&(_.$$scope={dirty:p,ctx:l}),n.$set(_)},i(l){c||($(n.$$.fragment,l),c=!0)},o(l){b(n.$$.fragment,l),c=!1},d(l){j(n,l)}}}function Js(q){let n,c='For example, <a href="/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertForSequenceClassification">DistilBertForSequenceClassification</a> is a base DistilBERT model with a sequence classification head. The sequence classification head is a linear layer on top of the pooled outputs.',l,p,_,w,V='Easily reuse this checkpoint for another task by switching to a different model head. For a question answering task, you would use the <a href="/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertForQuestionAnswering">DistilBertForQuestionAnswering</a> model head. The question answering head is similar to the sequence classification head except it is a linear layer on top of the hidden states output.',C,M,Z;return p=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpc3RpbEJlcnRGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBbW9kZWwlMjAlM0QlMjBEaXN0aWxCZXJ0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = DistilBertForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`,wrap:!1}}),M=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpc3RpbEJlcnRGb3JRdWVzdGlvbkFuc3dlcmluZyUwQSUwQW1vZGVsJTIwJTNEJTIwRGlzdGlsQmVydEZvclF1ZXN0aW9uQW5zd2VyaW5nLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertForQuestionAnswering

<span class="hljs-meta">&gt;&gt;&gt; </span>model = DistilBertForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`,wrap:!1}}),{c(){n=u("p"),n.innerHTML=c,l=o(),h(p.$$.fragment),_=o(),w=u("p"),w.innerHTML=V,C=o(),h(M.$$.fragment)},l(m){n=f(m,"P",{"data-svelte-h":!0}),d(n)!=="svelte-uspjcb"&&(n.innerHTML=c),l=i(m),g(p.$$.fragment,m),_=i(m),w=f(m,"P",{"data-svelte-h":!0}),d(w)!=="svelte-1vvpxtz"&&(w.innerHTML=V),C=i(m),g(M.$$.fragment,m)},m(m,v){a(m,n,v),a(m,l,v),y(p,m,v),a(m,_,v),a(m,w,v),a(m,C,v),y(M,m,v),Z=!0},p:F,i(m){Z||($(p.$$.fragment,m),$(M.$$.fragment,m),Z=!0)},o(m){b(p.$$.fragment,m),b(M.$$.fragment,m),Z=!1},d(m){m&&(s(n),s(l),s(_),s(w),s(C)),j(p,m),j(M,m)}}}function Ws(q){let n,c;return n=new Gt({props:{$$slots:{default:[Js]},$$scope:{ctx:q}}}),{c(){h(n.$$.fragment)},l(l){g(n.$$.fragment,l)},m(l,p){y(n,l,p),c=!0},p(l,p){const _={};p&2&&(_.$$scope={dirty:p,ctx:l}),n.$set(_)},i(l){c||($(n.$$.fragment,l),c=!0)},o(l){b(n.$$.fragment,l),c=!1},d(l){j(n,l)}}}function Vs(q){let n,c='For example, <a href="/docs/transformers/main/en/model_doc/distilbert#transformers.TFDistilBertForSequenceClassification">TFDistilBertForSequenceClassification</a> is a base DistilBERT model with a sequence classification head. The sequence classification head is a linear layer on top of the pooled outputs.',l,p,_,w,V='Easily reuse this checkpoint for another task by switching to a different model head. For a question answering task, you would use the <a href="/docs/transformers/main/en/model_doc/distilbert#transformers.TFDistilBertForQuestionAnswering">TFDistilBertForQuestionAnswering</a> model head. The question answering head is similar to the sequence classification head except it is a linear layer on top of the hidden states output.',C,M,Z;return p=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGRGlzdGlsQmVydEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEF0Zl9tb2RlbCUyMCUzRCUyMFRGRGlzdGlsQmVydEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFDistilBertForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`,wrap:!1}}),M=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGRGlzdGlsQmVydEZvclF1ZXN0aW9uQW5zd2VyaW5nJTBBJTBBdGZfbW9kZWwlMjAlM0QlMjBURkRpc3RpbEJlcnRGb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFDistilBertForQuestionAnswering

<span class="hljs-meta">&gt;&gt;&gt; </span>tf_model = TFDistilBertForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`,wrap:!1}}),{c(){n=u("p"),n.innerHTML=c,l=o(),h(p.$$.fragment),_=o(),w=u("p"),w.innerHTML=V,C=o(),h(M.$$.fragment)},l(m){n=f(m,"P",{"data-svelte-h":!0}),d(n)!=="svelte-1acqkur"&&(n.innerHTML=c),l=i(m),g(p.$$.fragment,m),_=i(m),w=f(m,"P",{"data-svelte-h":!0}),d(w)!=="svelte-usn93"&&(w.innerHTML=V),C=i(m),g(M.$$.fragment,m)},m(m,v){a(m,n,v),a(m,l,v),y(p,m,v),a(m,_,v),a(m,w,v),a(m,C,v),y(M,m,v),Z=!0},p:F,i(m){Z||($(p.$$.fragment,m),$(M.$$.fragment,m),Z=!0)},o(m){b(p.$$.fragment,m),b(M.$$.fragment,m),Z=!1},d(m){m&&(s(n),s(l),s(_),s(w),s(C)),j(p,m),j(M,m)}}}function xs(q){let n,c;return n=new Gt({props:{$$slots:{default:[Vs]},$$scope:{ctx:q}}}),{c(){h(n.$$.fragment)},l(l){g(n.$$.fragment,l)},m(l,p){y(n,l,p),c=!0},p(l,p){const _={};p&2&&(_.$$scope={dirty:p,ctx:l}),n.$set(_)},i(l){c||($(n.$$.fragment,l),c=!0)},o(l){b(n.$$.fragment,l),c=!1},d(l){j(n,l)}}}function zs(q){let n,c='Not every model supports a fast tokenizer. Take a look at this <a href="index#supported-frameworks">table</a> to check if a model has fast tokenizer support.';return{c(){n=u("p"),n.innerHTML=c},l(l){n=f(l,"P",{"data-svelte-h":!0}),d(n)!=="svelte-18y3slz"&&(n.innerHTML=c)},m(l,p){a(l,n,p)},p:F,d(l){l&&s(n)}}}function Rs(q){let n,c='By default, <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a> will try to load a fast tokenizer. You can disable this behavior by setting <code>use_fast=False</code> in <code>from_pretrained</code>.';return{c(){n=u("p"),n.innerHTML=c},l(l){n=f(l,"P",{"data-svelte-h":!0}),d(n)!=="svelte-1krn5l6"&&(n.innerHTML=c)},m(l,p){a(l,n,p)},p:F,d(l){l&&s(n)}}}function Us(q){let n,c="If you aren’t looking for any customization, just use the <code>from_pretrained</code> method to load a model’s default image processor parameters.";return{c(){n=u("p"),n.innerHTML=c},l(l){n=f(l,"P",{"data-svelte-h":!0}),d(n)!=="svelte-10var38"&&(n.innerHTML=c)},m(l,p){a(l,n,p)},p:F,d(l){l&&s(n)}}}function Fs(q){let n,c="If you aren’t looking for any customization, just use the <code>from_pretrained</code> method to load a model’s default feature extractor parameters.";return{c(){n=u("p"),n.innerHTML=c},l(l){n=f(l,"P",{"data-svelte-h":!0}),d(n)!=="svelte-1e7p61z"&&(n.innerHTML=c)},m(l,p){a(l,n,p)},p:F,d(l){l&&s(n)}}}function Gs(q){let n,c,l,p,_,w,V,C='An <a href="model_doc/auto"><code>AutoClass</code></a> automatically infers the model architecture and downloads pretrained configuration and weights. Generally, we recommend using an <code>AutoClass</code> to produce checkpoint-agnostic code. But users who want more control over specific model parameters can create a custom 🤗 Transformers model from just a few base classes. This could be particularly useful for anyone who is interested in studying, training or experimenting with a 🤗 Transformers model. In this guide, dive deeper into creating a custom model without an <code>AutoClass</code>. Learn how to:',M,Z,m="<li>Load and customize a model configuration.</li> <li>Create a model architecture.</li> <li>Create a slow and fast tokenizer for text.</li> <li>Create an image processor for vision tasks.</li> <li>Create a feature extractor for audio tasks.</li> <li>Create a processor for multimodal tasks.</li>",v,x,J,R,U='A <a href="main_classes/configuration">configuration</a> refers to a model’s specific attributes. Each model configuration has different attributes; for instance, all NLP models have the <code>hidden_size</code>, <code>num_attention_heads</code>, <code>num_hidden_layers</code> and <code>vocab_size</code> attributes in common. These attributes specify the number of attention heads or hidden layers to construct a model with.',W,z,r='Get a closer look at <a href="model_doc/distilbert">DistilBERT</a> by accessing <a href="/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a> to inspect it’s attributes:',T,P,He,Q,Ht='<a href="/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a> displays all the default attributes used to build a base <a href="/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertModel">DistilBertModel</a>. All attributes are customizable, creating space for experimentation. For example, you can customize a default model to:',Be,N,Bt="<li>Try a different activation function with the <code>activation</code> parameter.</li> <li>Use a higher dropout ratio for the attention probabilities with the <code>attention_dropout</code> parameter.</li>",Xe,D,Ee,S,Xt='Pretrained model attributes can be modified in the <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig.from_pretrained">from_pretrained()</a> function:',Ye,A,Le,K,Et='Once you are satisfied with your model configuration, you can save it with <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig.save_pretrained">save_pretrained()</a>. Your configuration file is stored as a JSON file in the specified save directory:',Ie,O,Pe,ee,Yt='To reuse the configuration file, load it with <a href="/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig.from_pretrained">from_pretrained()</a>:',Qe,te,Ne,G,De,se,Se,ae,Lt='The next step is to create a <a href="main_classes/models">model</a>. The model - also loosely referred to as the architecture - defines what each layer is doing and what operations are happening. Attributes like <code>num_hidden_layers</code> from the configuration are used to define the architecture. Every model shares the base class <a href="/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a> and a few common methods like resizing input embeddings and pruning self-attention heads. In addition, all models are also either a <a href="https://pytorch.org/docs/stable/generated/torch.nn.Module.html" rel="nofollow"><code>torch.nn.Module</code></a>, <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow"><code>tf.keras.Model</code></a> or <a href="https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html" rel="nofollow"><code>flax.linen.Module</code></a> subclass. This means models are compatible with each of their respective framework’s usage.',Ae,H,Ke,ne,Oe,le,It="At this point, you have a base DistilBERT model which outputs the <em>hidden states</em>. The hidden states are passed as inputs to a model head to produce the final output. 🤗 Transformers provides a different model head for each task as long as a model supports the task (i.e., you can’t use DistilBERT for a sequence-to-sequence task like translation).",et,B,tt,re,st,oe,Pt='The last base class you need before using a model for textual data is a <a href="main_classes/tokenizer">tokenizer</a> to convert raw text to tensors. There are two types of tokenizers you can use with 🤗 Transformers:',at,ie,Qt='<li><a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a>: a Python implementation of a tokenizer.</li> <li><a href="/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast">PreTrainedTokenizerFast</a>: a tokenizer from our Rust-based <a href="https://huggingface.co/docs/tokenizers/python/latest/" rel="nofollow">🤗 Tokenizer</a> library. This tokenizer type is significantly faster - especially during batch tokenization - due to its Rust implementation. The fast tokenizer also offers additional methods like <em>offset mapping</em> which maps tokens to their original words or characters.</li>',nt,pe,Nt="Both tokenizers support common methods such as encoding and decoding, adding new tokens, and managing special tokens.",lt,X,rt,me,Dt="If you trained your own tokenizer, you can create one from your <em>vocabulary</em> file:",ot,ce,it,ue,St='It is important to remember the vocabulary from a custom tokenizer will be different from the vocabulary generated by a pretrained model’s tokenizer. You need to use a pretrained model’s vocabulary if you are using a pretrained model, otherwise the inputs won’t make sense. Create a tokenizer with a pretrained model’s vocabulary with the <a href="/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertTokenizer">DistilBertTokenizer</a> class:',pt,fe,mt,de,At='Create a fast tokenizer with the <a href="/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertTokenizerFast">DistilBertTokenizerFast</a> class:',ct,he,ut,E,ft,ge,dt,ye,Kt='An image processor processes vision inputs. It inherits from the base <a href="/docs/transformers/main/en/main_classes/image_processor#transformers.ImageProcessingMixin">ImageProcessingMixin</a> class.',ht,$e,Ot='To use, create an image processor associated with the model you’re using. For example, create a default <a href="/docs/transformers/main/en/model_doc/vit#transformers.ViTImageProcessor">ViTImageProcessor</a> if you are using <a href="model_doc/vit">ViT</a> for image classification:',gt,be,yt,Y,$t,je,es='Modify any of the <a href="/docs/transformers/main/en/model_doc/vit#transformers.ViTImageProcessor">ViTImageProcessor</a> parameters to create your custom image processor:',bt,_e,jt,we,_t,Me,ts='A feature extractor processes audio inputs. It inherits from the base <a href="/docs/transformers/main/en/main_classes/feature_extractor#transformers.FeatureExtractionMixin">FeatureExtractionMixin</a> class, and may also inherit from the <a href="/docs/transformers/main/en/main_classes/feature_extractor#transformers.SequenceFeatureExtractor">SequenceFeatureExtractor</a> class for processing audio inputs.',wt,ve,ss='To use, create a feature extractor associated with the model you’re using. For example, create a default <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2FeatureExtractor">Wav2Vec2FeatureExtractor</a> if you are using <a href="model_doc/wav2vec2">Wav2Vec2</a> for audio classification:',Mt,Te,vt,L,Tt,qe,as='Modify any of the <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2FeatureExtractor">Wav2Vec2FeatureExtractor</a> parameters to create your custom feature extractor:',qt,ke,kt,Ze,Zt,Ce,ns='For models that support multimodal tasks, 🤗 Transformers offers a processor class that conveniently wraps processing classes such as a feature extractor and a tokenizer into a single object. For example, let’s use the <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor">Wav2Vec2Processor</a> for an automatic speech recognition task (ASR). ASR transcribes audio to text, so you will need a feature extractor and a tokenizer.',Ct,Je,ls="Create a feature extractor to handle the audio inputs:",Jt,We,Wt,Ve,rs="Create a tokenizer to handle the text inputs:",Vt,xe,xt,ze,os='Combine the feature extractor and tokenizer in <a href="/docs/transformers/main/en/model_doc/wav2vec2#transformers.Wav2Vec2Processor">Wav2Vec2Processor</a>:',zt,Re,Rt,Ue,is="With two basic classes - configuration and model - and an additional preprocessing class (tokenizer, image processor, feature extractor, or processor), you can create any of the models supported by 🤗 Transformers. Each of these base classes are configurable, allowing you to use the specific attributes you want. You can easily setup a model for training or modify an existing pretrained model to fine-tune.",Ut,Fe,Ft;return _=new I({props:{title:"Create a custom architecture",local:"create-a-custom-architecture",headingTag:"h1"}}),x=new I({props:{title:"Configuration",local:"configuration",headingTag:"h2"}}),P=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpc3RpbEJlcnRDb25maWclMEElMEFjb25maWclMjAlM0QlMjBEaXN0aWxCZXJ0Q29uZmlnKCklMEFwcmludChjb25maWcp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertConfig

<span class="hljs-meta">&gt;&gt;&gt; </span>config = DistilBertConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(config)
DistilBertConfig {
  <span class="hljs-string">&quot;activation&quot;</span>: <span class="hljs-string">&quot;gelu&quot;</span>,
  <span class="hljs-string">&quot;attention_dropout&quot;</span>: <span class="hljs-number">0.1</span>,
  <span class="hljs-string">&quot;dim&quot;</span>: <span class="hljs-number">768</span>,
  <span class="hljs-string">&quot;dropout&quot;</span>: <span class="hljs-number">0.1</span>,
  <span class="hljs-string">&quot;hidden_dim&quot;</span>: <span class="hljs-number">3072</span>,
  <span class="hljs-string">&quot;initializer_range&quot;</span>: <span class="hljs-number">0.02</span>,
  <span class="hljs-string">&quot;max_position_embeddings&quot;</span>: <span class="hljs-number">512</span>,
  <span class="hljs-string">&quot;model_type&quot;</span>: <span class="hljs-string">&quot;distilbert&quot;</span>,
  <span class="hljs-string">&quot;n_heads&quot;</span>: <span class="hljs-number">12</span>,
  <span class="hljs-string">&quot;n_layers&quot;</span>: <span class="hljs-number">6</span>,
  <span class="hljs-string">&quot;pad_token_id&quot;</span>: <span class="hljs-number">0</span>,
  <span class="hljs-string">&quot;qa_dropout&quot;</span>: <span class="hljs-number">0.1</span>,
  <span class="hljs-string">&quot;seq_classif_dropout&quot;</span>: <span class="hljs-number">0.2</span>,
  <span class="hljs-string">&quot;sinusoidal_pos_embds&quot;</span>: false,
  <span class="hljs-string">&quot;transformers_version&quot;</span>: <span class="hljs-string">&quot;4.16.2&quot;</span>,
  <span class="hljs-string">&quot;vocab_size&quot;</span>: <span class="hljs-number">30522</span>
}`,wrap:!1}}),D=new k({props:{code:"bXlfY29uZmlnJTIwJTNEJTIwRGlzdGlsQmVydENvbmZpZyhhY3RpdmF0aW9uJTNEJTIycmVsdSUyMiUyQyUyMGF0dGVudGlvbl9kcm9wb3V0JTNEMC40KSUwQXByaW50KG15X2NvbmZpZyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>my_config = DistilBertConfig(activation=<span class="hljs-string">&quot;relu&quot;</span>, attention_dropout=<span class="hljs-number">0.4</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(my_config)
DistilBertConfig {
  <span class="hljs-string">&quot;activation&quot;</span>: <span class="hljs-string">&quot;relu&quot;</span>,
  <span class="hljs-string">&quot;attention_dropout&quot;</span>: <span class="hljs-number">0.4</span>,
  <span class="hljs-string">&quot;dim&quot;</span>: <span class="hljs-number">768</span>,
  <span class="hljs-string">&quot;dropout&quot;</span>: <span class="hljs-number">0.1</span>,
  <span class="hljs-string">&quot;hidden_dim&quot;</span>: <span class="hljs-number">3072</span>,
  <span class="hljs-string">&quot;initializer_range&quot;</span>: <span class="hljs-number">0.02</span>,
  <span class="hljs-string">&quot;max_position_embeddings&quot;</span>: <span class="hljs-number">512</span>,
  <span class="hljs-string">&quot;model_type&quot;</span>: <span class="hljs-string">&quot;distilbert&quot;</span>,
  <span class="hljs-string">&quot;n_heads&quot;</span>: <span class="hljs-number">12</span>,
  <span class="hljs-string">&quot;n_layers&quot;</span>: <span class="hljs-number">6</span>,
  <span class="hljs-string">&quot;pad_token_id&quot;</span>: <span class="hljs-number">0</span>,
  <span class="hljs-string">&quot;qa_dropout&quot;</span>: <span class="hljs-number">0.1</span>,
  <span class="hljs-string">&quot;seq_classif_dropout&quot;</span>: <span class="hljs-number">0.2</span>,
  <span class="hljs-string">&quot;sinusoidal_pos_embds&quot;</span>: false,
  <span class="hljs-string">&quot;transformers_version&quot;</span>: <span class="hljs-string">&quot;4.16.2&quot;</span>,
  <span class="hljs-string">&quot;vocab_size&quot;</span>: <span class="hljs-number">30522</span>
}`,wrap:!1}}),A=new k({props:{code:"bXlfY29uZmlnJTIwJTNEJTIwRGlzdGlsQmVydENvbmZpZy5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIlMkMlMjBhY3RpdmF0aW9uJTNEJTIycmVsdSUyMiUyQyUyMGF0dGVudGlvbl9kcm9wb3V0JTNEMC40KQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>my_config = DistilBertConfig.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>, activation=<span class="hljs-string">&quot;relu&quot;</span>, attention_dropout=<span class="hljs-number">0.4</span>)',wrap:!1}}),O=new k({props:{code:"bXlfY29uZmlnLnNhdmVfcHJldHJhaW5lZChzYXZlX2RpcmVjdG9yeSUzRCUyMi4lMkZ5b3VyX21vZGVsX3NhdmVfcGF0aCUyMik=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>my_config.save_pretrained(save_directory=<span class="hljs-string">&quot;./your_model_save_path&quot;</span>)',wrap:!1}}),te=new k({props:{code:"bXlfY29uZmlnJTIwJTNEJTIwRGlzdGlsQmVydENvbmZpZy5mcm9tX3ByZXRyYWluZWQoJTIyLiUyRnlvdXJfbW9kZWxfc2F2ZV9wYXRoJTJGY29uZmlnLmpzb24lMjIp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>my_config = DistilBertConfig.from_pretrained(<span class="hljs-string">&quot;./your_model_save_path/config.json&quot;</span>)',wrap:!1}}),G=new Ge({props:{$$slots:{default:[Ts]},$$scope:{ctx:q}}}),se=new I({props:{title:"Model",local:"model",headingTag:"h2"}}),H=new $s({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Cs],pytorch:[ks]},$$scope:{ctx:q}}}),ne=new I({props:{title:"Model heads",local:"model-heads",headingTag:"h3"}}),B=new $s({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[xs],pytorch:[Ws]},$$scope:{ctx:q}}}),re=new I({props:{title:"Tokenizer",local:"tokenizer",headingTag:"h2"}}),X=new Ge({props:{warning:!0,$$slots:{default:[zs]},$$scope:{ctx:q}}}),ce=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpc3RpbEJlcnRUb2tlbml6ZXIlMEElMEFteV90b2tlbml6ZXIlMjAlM0QlMjBEaXN0aWxCZXJ0VG9rZW5pemVyKHZvY2FiX2ZpbGUlM0QlMjJteV92b2NhYl9maWxlLnR4dCUyMiUyQyUyMGRvX2xvd2VyX2Nhc2UlM0RGYWxzZSUyQyUyMHBhZGRpbmdfc2lkZSUzRCUyMmxlZnQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>my_tokenizer = DistilBertTokenizer(vocab_file=<span class="hljs-string">&quot;my_vocab_file.txt&quot;</span>, do_lower_case=<span class="hljs-literal">False</span>, padding_side=<span class="hljs-string">&quot;left&quot;</span>)`,wrap:!1}}),fe=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpc3RpbEJlcnRUb2tlbml6ZXIlMEElMEFzbG93X3Rva2VuaXplciUyMCUzRCUyMERpc3RpbEJlcnRUb2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>slow_tokenizer = DistilBertTokenizer.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`,wrap:!1}}),he=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpc3RpbEJlcnRUb2tlbml6ZXJGYXN0JTBBJTBBZmFzdF90b2tlbml6ZXIlMjAlM0QlMjBEaXN0aWxCZXJ0VG9rZW5pemVyRmFzdC5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertTokenizerFast

<span class="hljs-meta">&gt;&gt;&gt; </span>fast_tokenizer = DistilBertTokenizerFast.from_pretrained(<span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>)`,wrap:!1}}),E=new Ge({props:{$$slots:{default:[Rs]},$$scope:{ctx:q}}}),ge=new I({props:{title:"Image Processor",local:"image-processor",headingTag:"h2"}}),be=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFZpVEltYWdlUHJvY2Vzc29yJTBBJTBBdml0X2V4dHJhY3RvciUyMCUzRCUyMFZpVEltYWdlUHJvY2Vzc29yKCklMEFwcmludCh2aXRfZXh0cmFjdG9yKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ViTImageProcessor

<span class="hljs-meta">&gt;&gt;&gt; </span>vit_extractor = ViTImageProcessor()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(vit_extractor)
ViTImageProcessor {
  <span class="hljs-string">&quot;do_normalize&quot;</span>: true,
  <span class="hljs-string">&quot;do_resize&quot;</span>: true,
  <span class="hljs-string">&quot;image_processor_type&quot;</span>: <span class="hljs-string">&quot;ViTImageProcessor&quot;</span>,
  <span class="hljs-string">&quot;image_mean&quot;</span>: [
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>
  ],
  <span class="hljs-string">&quot;image_std&quot;</span>: [
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>
  ],
  <span class="hljs-string">&quot;resample&quot;</span>: <span class="hljs-number">2</span>,
  <span class="hljs-string">&quot;size&quot;</span>: <span class="hljs-number">224</span>
}`,wrap:!1}}),Y=new Ge({props:{$$slots:{default:[Us]},$$scope:{ctx:q}}}),_e=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFZpVEltYWdlUHJvY2Vzc29yJTBBJTBBbXlfdml0X2V4dHJhY3RvciUyMCUzRCUyMFZpVEltYWdlUHJvY2Vzc29yKHJlc2FtcGxlJTNEJTIyUElMLkltYWdlLkJPWCUyMiUyQyUyMGRvX25vcm1hbGl6ZSUzREZhbHNlJTJDJTIwaW1hZ2VfbWVhbiUzRCU1QjAuMyUyQyUyMDAuMyUyQyUyMDAuMyU1RCklMEFwcmludChteV92aXRfZXh0cmFjdG9yKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> ViTImageProcessor

<span class="hljs-meta">&gt;&gt;&gt; </span>my_vit_extractor = ViTImageProcessor(resample=<span class="hljs-string">&quot;PIL.Image.BOX&quot;</span>, do_normalize=<span class="hljs-literal">False</span>, image_mean=[<span class="hljs-number">0.3</span>, <span class="hljs-number">0.3</span>, <span class="hljs-number">0.3</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(my_vit_extractor)
ViTImageProcessor {
  <span class="hljs-string">&quot;do_normalize&quot;</span>: false,
  <span class="hljs-string">&quot;do_resize&quot;</span>: true,
  <span class="hljs-string">&quot;image_processor_type&quot;</span>: <span class="hljs-string">&quot;ViTImageProcessor&quot;</span>,
  <span class="hljs-string">&quot;image_mean&quot;</span>: [
    <span class="hljs-number">0.3</span>,
    <span class="hljs-number">0.3</span>,
    <span class="hljs-number">0.3</span>
  ],
  <span class="hljs-string">&quot;image_std&quot;</span>: [
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>,
    <span class="hljs-number">0.5</span>
  ],
  <span class="hljs-string">&quot;resample&quot;</span>: <span class="hljs-string">&quot;PIL.Image.BOX&quot;</span>,
  <span class="hljs-string">&quot;size&quot;</span>: <span class="hljs-number">224</span>
}`,wrap:!1}}),we=new I({props:{title:"Feature Extractor",local:"feature-extractor",headingTag:"h2"}}),Te=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFdhdjJWZWMyRmVhdHVyZUV4dHJhY3RvciUwQSUwQXcydjJfZXh0cmFjdG9yJTIwJTNEJTIwV2F2MlZlYzJGZWF0dXJlRXh0cmFjdG9yKCklMEFwcmludCh3MnYyX2V4dHJhY3Rvcik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Wav2Vec2FeatureExtractor

<span class="hljs-meta">&gt;&gt;&gt; </span>w2v2_extractor = Wav2Vec2FeatureExtractor()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(w2v2_extractor)
Wav2Vec2FeatureExtractor {
  <span class="hljs-string">&quot;do_normalize&quot;</span>: true,
  <span class="hljs-string">&quot;feature_extractor_type&quot;</span>: <span class="hljs-string">&quot;Wav2Vec2FeatureExtractor&quot;</span>,
  <span class="hljs-string">&quot;feature_size&quot;</span>: <span class="hljs-number">1</span>,
  <span class="hljs-string">&quot;padding_side&quot;</span>: <span class="hljs-string">&quot;right&quot;</span>,
  <span class="hljs-string">&quot;padding_value&quot;</span>: <span class="hljs-number">0.0</span>,
  <span class="hljs-string">&quot;return_attention_mask&quot;</span>: false,
  <span class="hljs-string">&quot;sampling_rate&quot;</span>: <span class="hljs-number">16000</span>
}`,wrap:!1}}),L=new Ge({props:{$$slots:{default:[Fs]},$$scope:{ctx:q}}}),ke=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFdhdjJWZWMyRmVhdHVyZUV4dHJhY3RvciUwQSUwQXcydjJfZXh0cmFjdG9yJTIwJTNEJTIwV2F2MlZlYzJGZWF0dXJlRXh0cmFjdG9yKHNhbXBsaW5nX3JhdGUlM0Q4MDAwJTJDJTIwZG9fbm9ybWFsaXplJTNERmFsc2UpJTBBcHJpbnQodzJ2Ml9leHRyYWN0b3Ip",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Wav2Vec2FeatureExtractor

<span class="hljs-meta">&gt;&gt;&gt; </span>w2v2_extractor = Wav2Vec2FeatureExtractor(sampling_rate=<span class="hljs-number">8000</span>, do_normalize=<span class="hljs-literal">False</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(w2v2_extractor)
Wav2Vec2FeatureExtractor {
  <span class="hljs-string">&quot;do_normalize&quot;</span>: false,
  <span class="hljs-string">&quot;feature_extractor_type&quot;</span>: <span class="hljs-string">&quot;Wav2Vec2FeatureExtractor&quot;</span>,
  <span class="hljs-string">&quot;feature_size&quot;</span>: <span class="hljs-number">1</span>,
  <span class="hljs-string">&quot;padding_side&quot;</span>: <span class="hljs-string">&quot;right&quot;</span>,
  <span class="hljs-string">&quot;padding_value&quot;</span>: <span class="hljs-number">0.0</span>,
  <span class="hljs-string">&quot;return_attention_mask&quot;</span>: false,
  <span class="hljs-string">&quot;sampling_rate&quot;</span>: <span class="hljs-number">8000</span>
}`,wrap:!1}}),Ze=new I({props:{title:"Processor",local:"processor",headingTag:"h2"}}),We=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFdhdjJWZWMyRmVhdHVyZUV4dHJhY3RvciUwQSUwQWZlYXR1cmVfZXh0cmFjdG9yJTIwJTNEJTIwV2F2MlZlYzJGZWF0dXJlRXh0cmFjdG9yKHBhZGRpbmdfdmFsdWUlM0QxLjAlMkMlMjBkb19ub3JtYWxpemUlM0RUcnVlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Wav2Vec2FeatureExtractor

<span class="hljs-meta">&gt;&gt;&gt; </span>feature_extractor = Wav2Vec2FeatureExtractor(padding_value=<span class="hljs-number">1.0</span>, do_normalize=<span class="hljs-literal">True</span>)`,wrap:!1}}),xe=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFdhdjJWZWMyQ1RDVG9rZW5pemVyJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwV2F2MlZlYzJDVENUb2tlbml6ZXIodm9jYWJfZmlsZSUzRCUyMm15X3ZvY2FiX2ZpbGUudHh0JTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Wav2Vec2CTCTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = Wav2Vec2CTCTokenizer(vocab_file=<span class="hljs-string">&quot;my_vocab_file.txt&quot;</span>)`,wrap:!1}}),Re=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFdhdjJWZWMyUHJvY2Vzc29yJTBBJTBBcHJvY2Vzc29yJTIwJTNEJTIwV2F2MlZlYzJQcm9jZXNzb3IoZmVhdHVyZV9leHRyYWN0b3IlM0RmZWF0dXJlX2V4dHJhY3RvciUyQyUyMHRva2VuaXplciUzRHRva2VuaXplcik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Wav2Vec2Processor

<span class="hljs-meta">&gt;&gt;&gt; </span>processor = Wav2Vec2Processor(feature_extractor=feature_extractor, tokenizer=tokenizer)`,wrap:!1}}),{c(){n=u("meta"),c=o(),l=u("p"),p=o(),h(_.$$.fragment),w=o(),V=u("p"),V.innerHTML=C,M=o(),Z=u("ul"),Z.innerHTML=m,v=o(),h(x.$$.fragment),J=o(),R=u("p"),R.innerHTML=U,W=o(),z=u("p"),z.innerHTML=r,T=o(),h(P.$$.fragment),He=o(),Q=u("p"),Q.innerHTML=Ht,Be=o(),N=u("ul"),N.innerHTML=Bt,Xe=o(),h(D.$$.fragment),Ee=o(),S=u("p"),S.innerHTML=Xt,Ye=o(),h(A.$$.fragment),Le=o(),K=u("p"),K.innerHTML=Et,Ie=o(),h(O.$$.fragment),Pe=o(),ee=u("p"),ee.innerHTML=Yt,Qe=o(),h(te.$$.fragment),Ne=o(),h(G.$$.fragment),De=o(),h(se.$$.fragment),Se=o(),ae=u("p"),ae.innerHTML=Lt,Ae=o(),h(H.$$.fragment),Ke=o(),h(ne.$$.fragment),Oe=o(),le=u("p"),le.innerHTML=It,et=o(),h(B.$$.fragment),tt=o(),h(re.$$.fragment),st=o(),oe=u("p"),oe.innerHTML=Pt,at=o(),ie=u("ul"),ie.innerHTML=Qt,nt=o(),pe=u("p"),pe.textContent=Nt,lt=o(),h(X.$$.fragment),rt=o(),me=u("p"),me.innerHTML=Dt,ot=o(),h(ce.$$.fragment),it=o(),ue=u("p"),ue.innerHTML=St,pt=o(),h(fe.$$.fragment),mt=o(),de=u("p"),de.innerHTML=At,ct=o(),h(he.$$.fragment),ut=o(),h(E.$$.fragment),ft=o(),h(ge.$$.fragment),dt=o(),ye=u("p"),ye.innerHTML=Kt,ht=o(),$e=u("p"),$e.innerHTML=Ot,gt=o(),h(be.$$.fragment),yt=o(),h(Y.$$.fragment),$t=o(),je=u("p"),je.innerHTML=es,bt=o(),h(_e.$$.fragment),jt=o(),h(we.$$.fragment),_t=o(),Me=u("p"),Me.innerHTML=ts,wt=o(),ve=u("p"),ve.innerHTML=ss,Mt=o(),h(Te.$$.fragment),vt=o(),h(L.$$.fragment),Tt=o(),qe=u("p"),qe.innerHTML=as,qt=o(),h(ke.$$.fragment),kt=o(),h(Ze.$$.fragment),Zt=o(),Ce=u("p"),Ce.innerHTML=ns,Ct=o(),Je=u("p"),Je.textContent=ls,Jt=o(),h(We.$$.fragment),Wt=o(),Ve=u("p"),Ve.textContent=rs,Vt=o(),h(xe.$$.fragment),xt=o(),ze=u("p"),ze.innerHTML=os,zt=o(),h(Re.$$.fragment),Rt=o(),Ue=u("p"),Ue.textContent=is,Ut=o(),Fe=u("p"),this.h()},l(e){const t=Ms("svelte-u9bgzb",document.head);n=f(t,"META",{name:!0,content:!0}),t.forEach(s),c=i(e),l=f(e,"P",{}),gs(l).forEach(s),p=i(e),g(_.$$.fragment,e),w=i(e),V=f(e,"P",{"data-svelte-h":!0}),d(V)!=="svelte-1rebmo9"&&(V.innerHTML=C),M=i(e),Z=f(e,"UL",{"data-svelte-h":!0}),d(Z)!=="svelte-p41iia"&&(Z.innerHTML=m),v=i(e),g(x.$$.fragment,e),J=i(e),R=f(e,"P",{"data-svelte-h":!0}),d(R)!=="svelte-mxa1qr"&&(R.innerHTML=U),W=i(e),z=f(e,"P",{"data-svelte-h":!0}),d(z)!=="svelte-vrxcow"&&(z.innerHTML=r),T=i(e),g(P.$$.fragment,e),He=i(e),Q=f(e,"P",{"data-svelte-h":!0}),d(Q)!=="svelte-1lmljjk"&&(Q.innerHTML=Ht),Be=i(e),N=f(e,"UL",{"data-svelte-h":!0}),d(N)!=="svelte-1ohji3r"&&(N.innerHTML=Bt),Xe=i(e),g(D.$$.fragment,e),Ee=i(e),S=f(e,"P",{"data-svelte-h":!0}),d(S)!=="svelte-1xkajim"&&(S.innerHTML=Xt),Ye=i(e),g(A.$$.fragment,e),Le=i(e),K=f(e,"P",{"data-svelte-h":!0}),d(K)!=="svelte-1et9obi"&&(K.innerHTML=Et),Ie=i(e),g(O.$$.fragment,e),Pe=i(e),ee=f(e,"P",{"data-svelte-h":!0}),d(ee)!=="svelte-ru6nfz"&&(ee.innerHTML=Yt),Qe=i(e),g(te.$$.fragment,e),Ne=i(e),g(G.$$.fragment,e),De=i(e),g(se.$$.fragment,e),Se=i(e),ae=f(e,"P",{"data-svelte-h":!0}),d(ae)!=="svelte-17cfqfu"&&(ae.innerHTML=Lt),Ae=i(e),g(H.$$.fragment,e),Ke=i(e),g(ne.$$.fragment,e),Oe=i(e),le=f(e,"P",{"data-svelte-h":!0}),d(le)!=="svelte-1a6phur"&&(le.innerHTML=It),et=i(e),g(B.$$.fragment,e),tt=i(e),g(re.$$.fragment,e),st=i(e),oe=f(e,"P",{"data-svelte-h":!0}),d(oe)!=="svelte-1czw1fm"&&(oe.innerHTML=Pt),at=i(e),ie=f(e,"UL",{"data-svelte-h":!0}),d(ie)!=="svelte-ynby9s"&&(ie.innerHTML=Qt),nt=i(e),pe=f(e,"P",{"data-svelte-h":!0}),d(pe)!=="svelte-9binde"&&(pe.textContent=Nt),lt=i(e),g(X.$$.fragment,e),rt=i(e),me=f(e,"P",{"data-svelte-h":!0}),d(me)!=="svelte-9kjh08"&&(me.innerHTML=Dt),ot=i(e),g(ce.$$.fragment,e),it=i(e),ue=f(e,"P",{"data-svelte-h":!0}),d(ue)!=="svelte-1v3vqzb"&&(ue.innerHTML=St),pt=i(e),g(fe.$$.fragment,e),mt=i(e),de=f(e,"P",{"data-svelte-h":!0}),d(de)!=="svelte-36ahsm"&&(de.innerHTML=At),ct=i(e),g(he.$$.fragment,e),ut=i(e),g(E.$$.fragment,e),ft=i(e),g(ge.$$.fragment,e),dt=i(e),ye=f(e,"P",{"data-svelte-h":!0}),d(ye)!=="svelte-ir3sju"&&(ye.innerHTML=Kt),ht=i(e),$e=f(e,"P",{"data-svelte-h":!0}),d($e)!=="svelte-1pc38py"&&($e.innerHTML=Ot),gt=i(e),g(be.$$.fragment,e),yt=i(e),g(Y.$$.fragment,e),$t=i(e),je=f(e,"P",{"data-svelte-h":!0}),d(je)!=="svelte-5euq7e"&&(je.innerHTML=es),bt=i(e),g(_e.$$.fragment,e),jt=i(e),g(we.$$.fragment,e),_t=i(e),Me=f(e,"P",{"data-svelte-h":!0}),d(Me)!=="svelte-1uwunme"&&(Me.innerHTML=ts),wt=i(e),ve=f(e,"P",{"data-svelte-h":!0}),d(ve)!=="svelte-1dt9qv9"&&(ve.innerHTML=ss),Mt=i(e),g(Te.$$.fragment,e),vt=i(e),g(L.$$.fragment,e),Tt=i(e),qe=f(e,"P",{"data-svelte-h":!0}),d(qe)!=="svelte-i8ex5y"&&(qe.innerHTML=as),qt=i(e),g(ke.$$.fragment,e),kt=i(e),g(Ze.$$.fragment,e),Zt=i(e),Ce=f(e,"P",{"data-svelte-h":!0}),d(Ce)!=="svelte-fopbq2"&&(Ce.innerHTML=ns),Ct=i(e),Je=f(e,"P",{"data-svelte-h":!0}),d(Je)!=="svelte-gl9p7k"&&(Je.textContent=ls),Jt=i(e),g(We.$$.fragment,e),Wt=i(e),Ve=f(e,"P",{"data-svelte-h":!0}),d(Ve)!=="svelte-1qntmzi"&&(Ve.textContent=rs),Vt=i(e),g(xe.$$.fragment,e),xt=i(e),ze=f(e,"P",{"data-svelte-h":!0}),d(ze)!=="svelte-1sega3y"&&(ze.innerHTML=os),zt=i(e),g(Re.$$.fragment,e),Rt=i(e),Ue=f(e,"P",{"data-svelte-h":!0}),d(Ue)!=="svelte-1wdo2ao"&&(Ue.textContent=is),Ut=i(e),Fe=f(e,"P",{}),gs(Fe).forEach(s),this.h()},h(){ys(n,"name","hf:doc:metadata"),ys(n,"content",Hs)},m(e,t){vs(document.head,n),a(e,c,t),a(e,l,t),a(e,p,t),y(_,e,t),a(e,w,t),a(e,V,t),a(e,M,t),a(e,Z,t),a(e,v,t),y(x,e,t),a(e,J,t),a(e,R,t),a(e,W,t),a(e,z,t),a(e,T,t),y(P,e,t),a(e,He,t),a(e,Q,t),a(e,Be,t),a(e,N,t),a(e,Xe,t),y(D,e,t),a(e,Ee,t),a(e,S,t),a(e,Ye,t),y(A,e,t),a(e,Le,t),a(e,K,t),a(e,Ie,t),y(O,e,t),a(e,Pe,t),a(e,ee,t),a(e,Qe,t),y(te,e,t),a(e,Ne,t),y(G,e,t),a(e,De,t),y(se,e,t),a(e,Se,t),a(e,ae,t),a(e,Ae,t),y(H,e,t),a(e,Ke,t),y(ne,e,t),a(e,Oe,t),a(e,le,t),a(e,et,t),y(B,e,t),a(e,tt,t),y(re,e,t),a(e,st,t),a(e,oe,t),a(e,at,t),a(e,ie,t),a(e,nt,t),a(e,pe,t),a(e,lt,t),y(X,e,t),a(e,rt,t),a(e,me,t),a(e,ot,t),y(ce,e,t),a(e,it,t),a(e,ue,t),a(e,pt,t),y(fe,e,t),a(e,mt,t),a(e,de,t),a(e,ct,t),y(he,e,t),a(e,ut,t),y(E,e,t),a(e,ft,t),y(ge,e,t),a(e,dt,t),a(e,ye,t),a(e,ht,t),a(e,$e,t),a(e,gt,t),y(be,e,t),a(e,yt,t),y(Y,e,t),a(e,$t,t),a(e,je,t),a(e,bt,t),y(_e,e,t),a(e,jt,t),y(we,e,t),a(e,_t,t),a(e,Me,t),a(e,wt,t),a(e,ve,t),a(e,Mt,t),y(Te,e,t),a(e,vt,t),y(L,e,t),a(e,Tt,t),a(e,qe,t),a(e,qt,t),y(ke,e,t),a(e,kt,t),y(Ze,e,t),a(e,Zt,t),a(e,Ce,t),a(e,Ct,t),a(e,Je,t),a(e,Jt,t),y(We,e,t),a(e,Wt,t),a(e,Ve,t),a(e,Vt,t),y(xe,e,t),a(e,xt,t),a(e,ze,t),a(e,zt,t),y(Re,e,t),a(e,Rt,t),a(e,Ue,t),a(e,Ut,t),a(e,Fe,t),Ft=!0},p(e,[t]){const ps={};t&2&&(ps.$$scope={dirty:t,ctx:e}),G.$set(ps);const ms={};t&2&&(ms.$$scope={dirty:t,ctx:e}),H.$set(ms);const cs={};t&2&&(cs.$$scope={dirty:t,ctx:e}),B.$set(cs);const us={};t&2&&(us.$$scope={dirty:t,ctx:e}),X.$set(us);const fs={};t&2&&(fs.$$scope={dirty:t,ctx:e}),E.$set(fs);const ds={};t&2&&(ds.$$scope={dirty:t,ctx:e}),Y.$set(ds);const hs={};t&2&&(hs.$$scope={dirty:t,ctx:e}),L.$set(hs)},i(e){Ft||($(_.$$.fragment,e),$(x.$$.fragment,e),$(P.$$.fragment,e),$(D.$$.fragment,e),$(A.$$.fragment,e),$(O.$$.fragment,e),$(te.$$.fragment,e),$(G.$$.fragment,e),$(se.$$.fragment,e),$(H.$$.fragment,e),$(ne.$$.fragment,e),$(B.$$.fragment,e),$(re.$$.fragment,e),$(X.$$.fragment,e),$(ce.$$.fragment,e),$(fe.$$.fragment,e),$(he.$$.fragment,e),$(E.$$.fragment,e),$(ge.$$.fragment,e),$(be.$$.fragment,e),$(Y.$$.fragment,e),$(_e.$$.fragment,e),$(we.$$.fragment,e),$(Te.$$.fragment,e),$(L.$$.fragment,e),$(ke.$$.fragment,e),$(Ze.$$.fragment,e),$(We.$$.fragment,e),$(xe.$$.fragment,e),$(Re.$$.fragment,e),Ft=!0)},o(e){b(_.$$.fragment,e),b(x.$$.fragment,e),b(P.$$.fragment,e),b(D.$$.fragment,e),b(A.$$.fragment,e),b(O.$$.fragment,e),b(te.$$.fragment,e),b(G.$$.fragment,e),b(se.$$.fragment,e),b(H.$$.fragment,e),b(ne.$$.fragment,e),b(B.$$.fragment,e),b(re.$$.fragment,e),b(X.$$.fragment,e),b(ce.$$.fragment,e),b(fe.$$.fragment,e),b(he.$$.fragment,e),b(E.$$.fragment,e),b(ge.$$.fragment,e),b(be.$$.fragment,e),b(Y.$$.fragment,e),b(_e.$$.fragment,e),b(we.$$.fragment,e),b(Te.$$.fragment,e),b(L.$$.fragment,e),b(ke.$$.fragment,e),b(Ze.$$.fragment,e),b(We.$$.fragment,e),b(xe.$$.fragment,e),b(Re.$$.fragment,e),Ft=!1},d(e){e&&(s(c),s(l),s(p),s(w),s(V),s(M),s(Z),s(v),s(J),s(R),s(W),s(z),s(T),s(He),s(Q),s(Be),s(N),s(Xe),s(Ee),s(S),s(Ye),s(Le),s(K),s(Ie),s(Pe),s(ee),s(Qe),s(Ne),s(De),s(Se),s(ae),s(Ae),s(Ke),s(Oe),s(le),s(et),s(tt),s(st),s(oe),s(at),s(ie),s(nt),s(pe),s(lt),s(rt),s(me),s(ot),s(it),s(ue),s(pt),s(mt),s(de),s(ct),s(ut),s(ft),s(dt),s(ye),s(ht),s($e),s(gt),s(yt),s($t),s(je),s(bt),s(jt),s(_t),s(Me),s(wt),s(ve),s(Mt),s(vt),s(Tt),s(qe),s(qt),s(kt),s(Zt),s(Ce),s(Ct),s(Je),s(Jt),s(Wt),s(Ve),s(Vt),s(xt),s(ze),s(zt),s(Rt),s(Ue),s(Ut),s(Fe)),s(n),j(_,e),j(x,e),j(P,e),j(D,e),j(A,e),j(O,e),j(te,e),j(G,e),j(se,e),j(H,e),j(ne,e),j(B,e),j(re,e),j(X,e),j(ce,e),j(fe,e),j(he,e),j(E,e),j(ge,e),j(be,e),j(Y,e),j(_e,e),j(we,e),j(Te,e),j(L,e),j(ke,e),j(Ze,e),j(We,e),j(xe,e),j(Re,e)}}}const Hs='{"title":"Create a custom architecture","local":"create-a-custom-architecture","sections":[{"title":"Configuration","local":"configuration","sections":[],"depth":2},{"title":"Model","local":"model","sections":[{"title":"Model heads","local":"model-heads","sections":[],"depth":3}],"depth":2},{"title":"Tokenizer","local":"tokenizer","sections":[],"depth":2},{"title":"Image Processor","local":"image-processor","sections":[],"depth":2},{"title":"Feature Extractor","local":"feature-extractor","sections":[],"depth":2},{"title":"Processor","local":"processor","sections":[],"depth":2}],"depth":1}';function Bs(q){return js(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Qs extends _s{constructor(n){super(),ws(this,n,Bs,Gs,bs,{})}}export{Qs as component};
