Buckets:
| import{s as zs,o as Us,n as I}from"../chunks/scheduler.25b97de1.js";import{S as Ds,i as Ws,g as c,s as a,r as g,A as Zs,h as p,f as i,c as r,j as R,u as _,x as m,k as G,y as l,a as d,v as b,d as T,t as M,w as y}from"../chunks/index.d9030fc9.js";import{T as ct}from"../chunks/Tip.baa67368.js";import{D as q}from"../chunks/Docstring.ffac8efa.js";import{C as Be}from"../chunks/CodeBlock.e6cd0d95.js";import{F as Is,M as js}from"../chunks/Markdown.7217f838.js";import{E as Ve}from"../chunks/ExampleCodeBlock.22dfe688.js";import{P as vs}from"../chunks/PipelineTag.5f100392.js";import{H as xe,E as Gs}from"../chunks/EditOnGithub.91d95064.js";function Rs(B){let e,u="Examples:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpc3RpbEJlcnRDb25maWclMkMlMjBEaXN0aWxCZXJ0TW9kZWwlMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwRGlzdGlsQkVSVCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwRGlzdGlsQmVydENvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBEaXN0aWxCZXJ0TW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DistilBertConfig, DistilBertModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Initializing a DistilBERT configuration</span> | |
| <span class="hljs-meta">>>> </span>configuration = DistilBertConfig() | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Initializing a model (with random weights) from the configuration</span> | |
| <span class="hljs-meta">>>> </span>model = DistilBertModel(configuration) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Accessing the model configuration</span> | |
| <span class="hljs-meta">>>> </span>configuration = model.config`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-kvfsh7"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function qs(B){let e,u="pair mask has the following format:",n,s,w;return s=new Be({props:{code:"MCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMEElN0MlMjBmaXJzdCUyMHNlcXVlbmNlJTIwJTIwJTIwJTIwJTdDJTIwc2Vjb25kJTIwc2VxdWVuY2UlMjAlN0M=",highlighted:`0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1 1 | |
| | first sequence | second sequence |`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-qjgeij"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function Ns(B){let e,u="pair mask has the following format:",n,s,w;return s=new Be({props:{code:"MCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMEElN0MlMjBmaXJzdCUyMHNlcXVlbmNlJTIwJTIwJTIwJTIwJTdDJTIwc2Vjb25kJTIwc2VxdWVuY2UlMjAlN0M=",highlighted:`0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1 1 | |
| | first sequence | second sequence |`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-qjgeij"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function Hs(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function Ls(B){let e,u="Example:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBEaXN0aWxCZXJ0TW9kZWwlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKSUwQW1vZGVsJTIwJTNEJTIwRGlzdGlsQmVydE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, DistilBertModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = DistilBertModel.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>last_hidden_states = outputs.last_hidden_state`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-11lpom8"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function Xs(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function Vs(B){let e,u="Example:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBEaXN0aWxCZXJ0Rm9yTWFza2VkTE0lMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKSUwQW1vZGVsJTIwJTNEJTIwRGlzdGlsQmVydEZvck1hc2tlZExNLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIyVGhlJTIwY2FwaXRhbCUyMG9mJTIwRnJhbmNlJTIwaXMlMjAlNUJNQVNLJTVELiUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEElMjMlMjByZXRyaWV2ZSUyMGluZGV4JTIwb2YlMjAlNUJNQVNLJTVEJTBBbWFza190b2tlbl9pbmRleCUyMCUzRCUyMChpbnB1dHMuaW5wdXRfaWRzJTIwJTNEJTNEJTIwdG9rZW5pemVyLm1hc2tfdG9rZW5faWQpJTVCMCU1RC5ub256ZXJvKGFzX3R1cGxlJTNEVHJ1ZSklNUIwJTVEJTBBJTBBcHJlZGljdGVkX3Rva2VuX2lkJTIwJTNEJTIwbG9naXRzJTVCMCUyQyUyMG1hc2tfdG9rZW5faW5kZXglNUQuYXJnbWF4KGF4aXMlM0QtMSklMEElMEFsYWJlbHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIyVGhlJTIwY2FwaXRhbCUyMG9mJTIwRnJhbmNlJTIwaXMlMjBQYXJpcy4lMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSU1QiUyMmlucHV0X2lkcyUyMiU1RCUwQSUyMyUyMG1hc2slMjBsYWJlbHMlMjBvZiUyMG5vbi0lNUJNQVNLJTVEJTIwdG9rZW5zJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2gud2hlcmUoaW5wdXRzLmlucHV0X2lkcyUyMCUzRCUzRCUyMHRva2VuaXplci5tYXNrX3Rva2VuX2lkJTJDJTIwbGFiZWxzJTJDJTIwLTEwMCklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMlMkMlMjBsYWJlbHMlM0RsYWJlbHMp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, DistilBertForMaskedLM | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = DistilBertForMaskedLM.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"The capital of France is [MASK]."</span>, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># retrieve index of [MASK]</span> | |
| <span class="hljs-meta">>>> </span>mask_token_index = (inputs.input_ids == tokenizer.mask_token_id)[<span class="hljs-number">0</span>].nonzero(as_tuple=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>] | |
| <span class="hljs-meta">>>> </span>predicted_token_id = logits[<span class="hljs-number">0</span>, mask_token_index].argmax(axis=-<span class="hljs-number">1</span>) | |
| <span class="hljs-meta">>>> </span>labels = tokenizer(<span class="hljs-string">"The capital of France is Paris."</span>, return_tensors=<span class="hljs-string">"pt"</span>)[<span class="hljs-string">"input_ids"</span>] | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># mask labels of non-[MASK] tokens</span> | |
| <span class="hljs-meta">>>> </span>labels = torch.where(inputs.input_ids == tokenizer.mask_token_id, labels, -<span class="hljs-number">100</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs, labels=labels)`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-11lpom8"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function Es(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function Qs(B){let e,u="Example of single-label classification:",n,s,w;return s=new Be({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMERpc3RpbEJlcnRGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBEaXN0aWxCZXJ0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX2NsYXNzX2lkJTIwJTNEJTIwbG9naXRzLmFyZ21heCgpLml0ZW0oKSUwQSUwQSUyMyUyMFRvJTIwdHJhaW4lMjBhJTIwbW9kZWwlMjBvbiUyMCU2MG51bV9sYWJlbHMlNjAlMjBjbGFzc2VzJTJDJTIweW91JTIwY2FuJTIwcGFzcyUyMCU2MG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTYwJTIwdG8lMjAlNjAuZnJvbV9wcmV0cmFpbmVkKC4uLiklNjAlMEFudW1fbGFiZWxzJTIwJTNEJTIwbGVuKG1vZGVsLmNvbmZpZy5pZDJsYWJlbCklMEFtb2RlbCUyMCUzRCUyMERpc3RpbEJlcnRGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTVEKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, DistilBertForSequenceClassification | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = DistilBertForSequenceClassification.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span>predicted_class_id = logits.argmax().item() | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span> | |
| <span class="hljs-meta">>>> </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label) | |
| <span class="hljs-meta">>>> </span>model = DistilBertForSequenceClassification.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>, num_labels=num_labels) | |
| <span class="hljs-meta">>>> </span>labels = torch.tensor([<span class="hljs-number">1</span>]) | |
| <span class="hljs-meta">>>> </span>loss = model(**inputs, labels=labels).loss`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-ykxpe4"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function Ss(B){let e,u="Example of multi-label classification:",n,s,w;return s=new Be({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMERpc3RpbEJlcnRGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBEaXN0aWxCZXJ0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIlMkMlMjBwcm9ibGVtX3R5cGUlM0QlMjJtdWx0aV9sYWJlbF9jbGFzc2lmaWNhdGlvbiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfY2xhc3NfaWRzJTIwJTNEJTIwdG9yY2guYXJhbmdlKDAlMkMlMjBsb2dpdHMuc2hhcGUlNUItMSU1RCklNUJ0b3JjaC5zaWdtb2lkKGxvZ2l0cykuc3F1ZWV6ZShkaW0lM0QwKSUyMCUzRSUyMDAuNSU1RCUwQSUwQSUyMyUyMFRvJTIwdHJhaW4lMjBhJTIwbW9kZWwlMjBvbiUyMCU2MG51bV9sYWJlbHMlNjAlMjBjbGFzc2VzJTJDJTIweW91JTIwY2FuJTIwcGFzcyUyMCU2MG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTYwJTIwdG8lMjAlNjAuZnJvbV9wcmV0cmFpbmVkKC4uLiklNjAlMEFudW1fbGFiZWxzJTIwJTNEJTIwbGVuKG1vZGVsLmNvbmZpZy5pZDJsYWJlbCklMEFtb2RlbCUyMCUzRCUyMERpc3RpbEJlcnRGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIlMEEpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2guc3VtKCUwQSUyMCUyMCUyMCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwub25lX2hvdChwcmVkaWN0ZWRfY2xhc3NfaWRzJTVCTm9uZSUyQyUyMCUzQSU1RC5jbG9uZSgpJTJDJTIwbnVtX2NsYXNzZXMlM0RudW1fbGFiZWxzKSUyQyUyMGRpbSUzRDElMEEpLnRvKHRvcmNoLmZsb2F0KSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, DistilBertForSequenceClassification | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = DistilBertForSequenceClassification.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>, problem_type=<span class="hljs-string">"multi_label_classification"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span>predicted_class_ids = torch.arange(<span class="hljs-number">0</span>, logits.shape[-<span class="hljs-number">1</span>])[torch.sigmoid(logits).squeeze(dim=<span class="hljs-number">0</span>) > <span class="hljs-number">0.5</span>] | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`</span> | |
| <span class="hljs-meta">>>> </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label) | |
| <span class="hljs-meta">>>> </span>model = DistilBertForSequenceClassification.from_pretrained( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"distilbert-base-uncased"</span>, num_labels=num_labels, problem_type=<span class="hljs-string">"multi_label_classification"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>labels = torch.<span class="hljs-built_in">sum</span>( | |
| <span class="hljs-meta">... </span> torch.nn.functional.one_hot(predicted_class_ids[<span class="hljs-literal">None</span>, :].clone(), num_classes=num_labels), dim=<span class="hljs-number">1</span> | |
| <span class="hljs-meta">... </span>).to(torch.<span class="hljs-built_in">float</span>) | |
| <span class="hljs-meta">>>> </span>loss = model(**inputs, labels=labels).loss`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-1l8e32d"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function As(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function Ps(B){let e,u="Examples:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBEaXN0aWxCZXJ0Rm9yTXVsdGlwbGVDaG9pY2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQtYmFzZS1jYXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMERpc3RpbEJlcnRGb3JNdWx0aXBsZUNob2ljZS5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLWNhc2VkJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkluJTIwSXRhbHklMkMlMjBwaXp6YSUyMHNlcnZlZCUyMGluJTIwZm9ybWFsJTIwc2V0dGluZ3MlMkMlMjBzdWNoJTIwYXMlMjBhdCUyMGElMjByZXN0YXVyYW50JTJDJTIwaXMlMjBwcmVzZW50ZWQlMjB1bnNsaWNlZC4lMjIlMEFjaG9pY2UwJTIwJTNEJTIwJTIySXQlMjBpcyUyMGVhdGVuJTIwd2l0aCUyMGElMjBmb3JrJTIwYW5kJTIwYSUyMGtuaWZlLiUyMiUwQWNob2ljZTElMjAlM0QlMjAlMjJJdCUyMGlzJTIwZWF0ZW4lMjB3aGlsZSUyMGhlbGQlMjBpbiUyMHRoZSUyMGhhbmQuJTIyJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2gudGVuc29yKDApLnVuc3F1ZWV6ZSgwKSUyMCUyMCUyMyUyMGNob2ljZTAlMjBpcyUyMGNvcnJlY3QlMjAoYWNjb3JkaW5nJTIwdG8lMjBXaWtpcGVkaWElMjAlM0IpKSUyQyUyMGJhdGNoJTIwc2l6ZSUyMDElMEElMEFlbmNvZGluZyUyMCUzRCUyMHRva2VuaXplciglNUIlNUJwcm9tcHQlMkMlMjBjaG9pY2UwJTVEJTJDJTIwJTVCcHJvbXB0JTJDJTIwY2hvaWNlMSU1RCU1RCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMkMlMjBwYWRkaW5nJTNEVHJ1ZSklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKiolN0JrJTNBJTIwdi51bnNxdWVlemUoMCklMjBmb3IlMjBrJTJDJTIwdiUyMGluJTIwZW5jb2RpbmcuaXRlbXMoKSU3RCUyQyUyMGxhYmVscyUzRGxhYmVscyklMjAlMjAlMjMlMjBiYXRjaCUyMHNpemUlMjBpcyUyMDElMEElMEElMjMlMjB0aGUlMjBsaW5lYXIlMjBjbGFzc2lmaWVyJTIwc3RpbGwlMjBuZWVkcyUyMHRvJTIwYmUlMjB0cmFpbmVkJTBBbG9zcyUyMCUzRCUyMG91dHB1dHMubG9zcyUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, DistilBertForMultipleChoice | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-cased"</span>) | |
| <span class="hljs-meta">>>> </span>model = DistilBertForMultipleChoice.from_pretrained(<span class="hljs-string">"distilbert-base-cased"</span>) | |
| <span class="hljs-meta">>>> </span>prompt = <span class="hljs-string">"In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced."</span> | |
| <span class="hljs-meta">>>> </span>choice0 = <span class="hljs-string">"It is eaten with a fork and a knife."</span> | |
| <span class="hljs-meta">>>> </span>choice1 = <span class="hljs-string">"It is eaten while held in the hand."</span> | |
| <span class="hljs-meta">>>> </span>labels = torch.tensor(<span class="hljs-number">0</span>).unsqueeze(<span class="hljs-number">0</span>) <span class="hljs-comment"># choice0 is correct (according to Wikipedia ;)), batch size 1</span> | |
| <span class="hljs-meta">>>> </span>encoding = tokenizer([[prompt, choice0], [prompt, choice1]], return_tensors=<span class="hljs-string">"pt"</span>, padding=<span class="hljs-literal">True</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**{k: v.unsqueeze(<span class="hljs-number">0</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> encoding.items()}, labels=labels) <span class="hljs-comment"># batch size is 1</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># the linear classifier still needs to be trained</span> | |
| <span class="hljs-meta">>>> </span>loss = outputs.loss | |
| <span class="hljs-meta">>>> </span>logits = outputs.logits`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-kvfsh7"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function Ys(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function Os(B){let e,u="Example:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBEaXN0aWxCZXJ0Rm9yVG9rZW5DbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBEaXN0aWxCZXJ0Rm9yVG9rZW5DbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUwQSUyMCUyMCUyMCUyMCUyMkh1Z2dpbmdGYWNlJTIwaXMlMjBhJTIwY29tcGFueSUyMGJhc2VkJTIwaW4lMjBQYXJpcyUyMGFuZCUyME5ldyUyMFlvcmslMjIlMkMlMjBhZGRfc3BlY2lhbF90b2tlbnMlM0RGYWxzZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMEEpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfdG9rZW5fY2xhc3NfaWRzJTIwJTNEJTIwbG9naXRzLmFyZ21heCgtMSklMEElMEElMjMlMjBOb3RlJTIwdGhhdCUyMHRva2VucyUyMGFyZSUyMGNsYXNzaWZpZWQlMjByYXRoZXIlMjB0aGVuJTIwaW5wdXQlMjB3b3JkcyUyMHdoaWNoJTIwbWVhbnMlMjB0aGF0JTBBJTIzJTIwdGhlcmUlMjBtaWdodCUyMGJlJTIwbW9yZSUyMHByZWRpY3RlZCUyMHRva2VuJTIwY2xhc3NlcyUyMHRoYW4lMjB3b3Jkcy4lMEElMjMlMjBNdWx0aXBsZSUyMHRva2VuJTIwY2xhc3NlcyUyMG1pZ2h0JTIwYWNjb3VudCUyMGZvciUyMHRoZSUyMHNhbWUlMjB3b3JkJTBBcHJlZGljdGVkX3Rva2Vuc19jbGFzc2VzJTIwJTNEJTIwJTVCbW9kZWwuY29uZmlnLmlkMmxhYmVsJTVCdC5pdGVtKCklNUQlMjBmb3IlMjB0JTIwaW4lMjBwcmVkaWN0ZWRfdG9rZW5fY2xhc3NfaWRzJTVCMCU1RCU1RCUwQSUwQWxhYmVscyUyMCUzRCUyMHByZWRpY3RlZF90b2tlbl9jbGFzc19pZHMlMEFsb3NzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMlMkMlMjBsYWJlbHMlM0RsYWJlbHMpLmxvc3M=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, DistilBertForTokenClassification | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = DistilBertForTokenClassification.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"HuggingFace is a company based in Paris and New York"</span>, add_special_tokens=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">"pt"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span>predicted_token_class_ids = logits.argmax(-<span class="hljs-number">1</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Note that tokens are classified rather then input words which means that</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># there might be more predicted token classes than words.</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Multiple token classes might account for the same word</span> | |
| <span class="hljs-meta">>>> </span>predicted_tokens_classes = [model.config.id2label[t.item()] <span class="hljs-keyword">for</span> t <span class="hljs-keyword">in</span> predicted_token_class_ids[<span class="hljs-number">0</span>]] | |
| <span class="hljs-meta">>>> </span>labels = predicted_token_class_ids | |
| <span class="hljs-meta">>>> </span>loss = model(**inputs, labels=labels).loss`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-11lpom8"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function Ks(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function eo(B){let e,u="Example:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBEaXN0aWxCZXJ0Rm9yUXVlc3Rpb25BbnN3ZXJpbmclMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKSUwQW1vZGVsJTIwJTNEJTIwRGlzdGlsQmVydEZvclF1ZXN0aW9uQW5zd2VyaW5nLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEElMEFxdWVzdGlvbiUyQyUyMHRleHQlMjAlM0QlMjAlMjJXaG8lMjB3YXMlMjBKaW0lMjBIZW5zb24lM0YlMjIlMkMlMjAlMjJKaW0lMjBIZW5zb24lMjB3YXMlMjBhJTIwbmljZSUyMHB1cHBldCUyMiUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihxdWVzdGlvbiUyQyUyMHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBYW5zd2VyX3N0YXJ0X2luZGV4JTIwJTNEJTIwb3V0cHV0cy5zdGFydF9sb2dpdHMuYXJnbWF4KCklMEFhbnN3ZXJfZW5kX2luZGV4JTIwJTNEJTIwb3V0cHV0cy5lbmRfbG9naXRzLmFyZ21heCgpJTBBJTBBcHJlZGljdF9hbnN3ZXJfdG9rZW5zJTIwJTNEJTIwaW5wdXRzLmlucHV0X2lkcyU1QjAlMkMlMjBhbnN3ZXJfc3RhcnRfaW5kZXglMjAlM0ElMjBhbnN3ZXJfZW5kX2luZGV4JTIwJTJCJTIwMSU1RCUwQSUwQSUyMyUyMHRhcmdldCUyMGlzJTIwJTIybmljZSUyMHB1cHBldCUyMiUwQXRhcmdldF9zdGFydF9pbmRleCUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxNCU1RCklMEF0YXJnZXRfZW5kX2luZGV4JTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QjE1JTVEKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMHN0YXJ0X3Bvc2l0aW9ucyUzRHRhcmdldF9zdGFydF9pbmRleCUyQyUyMGVuZF9wb3NpdGlvbnMlM0R0YXJnZXRfZW5kX2luZGV4KSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3M=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, DistilBertForQuestionAnswering | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = DistilBertForQuestionAnswering.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>question, text = <span class="hljs-string">"Who was Jim Henson?"</span>, <span class="hljs-string">"Jim Henson was a nice puppet"</span> | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(question, text, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>answer_start_index = outputs.start_logits.argmax() | |
| <span class="hljs-meta">>>> </span>answer_end_index = outputs.end_logits.argmax() | |
| <span class="hljs-meta">>>> </span>predict_answer_tokens = inputs.input_ids[<span class="hljs-number">0</span>, answer_start_index : answer_end_index + <span class="hljs-number">1</span>] | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># target is "nice puppet"</span> | |
| <span class="hljs-meta">>>> </span>target_start_index = torch.tensor([<span class="hljs-number">14</span>]) | |
| <span class="hljs-meta">>>> </span>target_end_index = torch.tensor([<span class="hljs-number">15</span>]) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index) | |
| <span class="hljs-meta">>>> </span>loss = outputs.loss`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-11lpom8"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function to(B){let e,u,n,s,w,t,k="The bare DistilBERT encoder/transformer outputting raw hidden-states without any specific head on top.",ae,Z,z=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,O,D,U=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,K,f,j,Ee,Me,ns='The <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertModel">DistilBertModel</a> forward method, overrides the <code>__call__</code> special method.',ln,re,_n,De,pt,tt,It,P,Gt,E,nt,wt="DistilBert Model with a <code>masked language modeling</code> head on top.",bn,ee,kt=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,Jn,Rt,zn=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,dn,he,Un,qt,Qe,mt='The <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertForMaskedLM">DistilBertForMaskedLM</a> forward method, overrides the <code>__call__</code> special method.',At,je,Tn,ut,Mn,st,Pt,H,Ce,cn,ht,Nt=`DistilBert Model transformer with a sequence classification/regression head on top (a linear layer on top of the | |
| pooled output) e.g. for GLUE tasks.`,Dn,L,Wn=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,Ht,We,yn=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,Yt,N,ft,pn,Se,Nn='The <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertForSequenceClassification">DistilBertForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',An,ye,wn,ie,Ze,kn,Ot,Ae,Hn,A,Lt,Kt,$t,Je=`DistilBert Model with a multiple choice classification head on top (a linear layer on top of the pooled output and | |
| a softmax) e.g. for RocStories/SWAG tasks.`,Xt,Ie,Zn=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,we,Ge,$n=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,mn,le,un,gt,vt,ke='The <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertForMultipleChoice">DistilBertForMultipleChoice</a> forward method, overrides the <code>__call__</code> special method.',_t,bt,In,Pe,en,fe,tn,ce,ot,Pn,xt,Tt=`DistilBert Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. | |
| for Named-Entity-Recognition (NER) tasks.`,vn,Bt,hn=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,Ft,nn,X=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,jt,Ye,$e,ss,fn,Re='The <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertForTokenClassification">DistilBertForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',Xn,ve,sn,se,Vt,V,Mt,S,qe,Gn,on,Ln=`DistilBert Model with a span classification head on top for extractive question-answering tasks like SQuAD (a | |
| linear layers on top of the hidden-states output to compute <code>span start logits</code> and <code>span end logits</code>).`,gn,at,Et=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,an,te,Ne=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,Vn,pe,Ct,Fe,Oe,Jt='The <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertForQuestionAnswering">DistilBertForQuestionAnswering</a> forward method, overrides the <code>__call__</code> special method.',zt,He,Ut,Dt,xn;return e=new xe({props:{title:"DistilBertModel",local:"transformers.DistilBertModel",headingTag:"h2"}}),s=new q({props:{name:"class transformers.DistilBertModel",anchor:"transformers.DistilBertModel",parameters:[{name:"config",val:": PretrainedConfig"}],parametersDescription:[{anchor:"transformers.DistilBertModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_distilbert.py#L669"}}),j=new q({props:{name:"forward",anchor:"transformers.DistilBertModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.DistilBertModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.DistilBertModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.DistilBertModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 indicates the head is <strong>not masked</strong>,</li> | |
| <li>0 indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.DistilBertModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.DistilBertModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.DistilBertModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail.`,name:"output_hidden_states"},{anchor:"transformers.DistilBertModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_distilbert.py#L747",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput" | |
| >transformers.modeling_outputs.BaseModelOutput</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, + | |
| one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput" | |
| >transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),re=new ct({props:{$$slots:{default:[Hs]},$$scope:{ctx:B}}}),De=new Ve({props:{anchor:"transformers.DistilBertModel.forward.example",$$slots:{default:[Ls]},$$scope:{ctx:B}}}),tt=new xe({props:{title:"DistilBertForMaskedLM",local:"transformers.DistilBertForMaskedLM",headingTag:"h2"}}),Gt=new q({props:{name:"class transformers.DistilBertForMaskedLM",anchor:"transformers.DistilBertForMaskedLM",parameters:[{name:"config",val:": PretrainedConfig"}],parametersDescription:[{anchor:"transformers.DistilBertForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_distilbert.py#L808"}}),Un=new q({props:{name:"forward",anchor:"transformers.DistilBertForMaskedLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.DistilBertForMaskedLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.DistilBertForMaskedLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.DistilBertForMaskedLM.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 indicates the head is <strong>not masked</strong>,</li> | |
| <li>0 indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.DistilBertForMaskedLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.DistilBertForMaskedLM.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.DistilBertForMaskedLM.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail.`,name:"output_hidden_states"},{anchor:"transformers.DistilBertForMaskedLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.DistilBertForMaskedLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Labels for computing the masked language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are ignored (masked), the | |
| loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_distilbert.py#L856",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput" | |
| >transformers.modeling_outputs.MaskedLMOutput</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Masked language modeling (MLM) loss.</p> | |
| </li> | |
| <li> | |
| <p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, + | |
| one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput" | |
| >transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),je=new ct({props:{$$slots:{default:[Xs]},$$scope:{ctx:B}}}),ut=new Ve({props:{anchor:"transformers.DistilBertForMaskedLM.forward.example",$$slots:{default:[Vs]},$$scope:{ctx:B}}}),st=new xe({props:{title:"DistilBertForSequenceClassification",local:"transformers.DistilBertForSequenceClassification",headingTag:"h2"}}),Ce=new q({props:{name:"class transformers.DistilBertForSequenceClassification",anchor:"transformers.DistilBertForSequenceClassification",parameters:[{name:"config",val:": PretrainedConfig"}],parametersDescription:[{anchor:"transformers.DistilBertForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_distilbert.py#L912"}}),ft=new q({props:{name:"forward",anchor:"transformers.DistilBertForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.DistilBertForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.DistilBertForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.DistilBertForSequenceClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 indicates the head is <strong>not masked</strong>,</li> | |
| <li>0 indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.DistilBertForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.DistilBertForSequenceClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.DistilBertForSequenceClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail.`,name:"output_hidden_states"},{anchor:"transformers.DistilBertForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.DistilBertForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If | |
| <code>config.num_labels > 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_distilbert.py#L953",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput" | |
| >transformers.modeling_outputs.SequenceClassifierOutput</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Classification (or regression if config.num_labels==1) loss.</p> | |
| </li> | |
| <li> | |
| <p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) — Classification (or regression if config.num_labels==1) scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, + | |
| one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput" | |
| >transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),ye=new ct({props:{$$slots:{default:[Es]},$$scope:{ctx:B}}}),ie=new Ve({props:{anchor:"transformers.DistilBertForSequenceClassification.forward.example",$$slots:{default:[Qs]},$$scope:{ctx:B}}}),kn=new Ve({props:{anchor:"transformers.DistilBertForSequenceClassification.forward.example-2",$$slots:{default:[Ss]},$$scope:{ctx:B}}}),Ae=new xe({props:{title:"DistilBertForMultipleChoice",local:"transformers.DistilBertForMultipleChoice",headingTag:"h2"}}),Lt=new q({props:{name:"class transformers.DistilBertForMultipleChoice",anchor:"transformers.DistilBertForMultipleChoice",parameters:[{name:"config",val:": PretrainedConfig"}],parametersDescription:[{anchor:"transformers.DistilBertForMultipleChoice.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_distilbert.py#L1241"}}),un=new q({props:{name:"forward",anchor:"transformers.DistilBertForMultipleChoice.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.DistilBertForMultipleChoice.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.DistilBertForMultipleChoice.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.DistilBertForMultipleChoice.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 indicates the head is <strong>not masked</strong>,</li> | |
| <li>0 indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.DistilBertForMultipleChoice.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.DistilBertForMultipleChoice.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.DistilBertForMultipleChoice.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail.`,name:"output_hidden_states"},{anchor:"transformers.DistilBertForMultipleChoice.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.DistilBertForMultipleChoice.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Labels for computing the multiple choice classification loss. Indices should be in <code>[0, ..., num_choices-1]</code> where <code>num_choices</code> is the size of the second dimension of the input tensors. (See | |
| <code>input_ids</code> above)`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_distilbert.py#L1280",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_outputs.MultipleChoiceModelOutput" | |
| >transformers.modeling_outputs.MultipleChoiceModelOutput</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <em>(1,)</em>, <em>optional</em>, returned when <code>labels</code> is provided) — Classification loss.</p> | |
| </li> | |
| <li> | |
| <p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices)</code>) — <em>num_choices</em> is the second dimension of the input tensors. (see <em>input_ids</em> above).</p> | |
| <p>Classification scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, + | |
| one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_outputs.MultipleChoiceModelOutput" | |
| >transformers.modeling_outputs.MultipleChoiceModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),bt=new ct({props:{$$slots:{default:[As]},$$scope:{ctx:B}}}),Pe=new Ve({props:{anchor:"transformers.DistilBertForMultipleChoice.forward.example",$$slots:{default:[Ps]},$$scope:{ctx:B}}}),fe=new xe({props:{title:"DistilBertForTokenClassification",local:"transformers.DistilBertForTokenClassification",headingTag:"h2"}}),ot=new q({props:{name:"class transformers.DistilBertForTokenClassification",anchor:"transformers.DistilBertForTokenClassification",parameters:[{name:"config",val:": PretrainedConfig"}],parametersDescription:[{anchor:"transformers.DistilBertForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_distilbert.py#L1147"}}),$e=new q({props:{name:"forward",anchor:"transformers.DistilBertForTokenClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.DistilBertForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>({0})</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.DistilBertForTokenClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>({0})</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.DistilBertForTokenClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 indicates the head is <strong>not masked</strong>,</li> | |
| <li>0 indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.DistilBertForTokenClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>({0}, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.DistilBertForTokenClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.DistilBertForTokenClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail.`,name:"output_hidden_states"},{anchor:"transformers.DistilBertForTokenClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.DistilBertForTokenClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Labels for computing the token classification loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_distilbert.py#L1186",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput" | |
| >transformers.modeling_outputs.TokenClassifierOutput</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Classification loss.</p> | |
| </li> | |
| <li> | |
| <p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) — Classification scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, + | |
| one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput" | |
| >transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),ve=new ct({props:{$$slots:{default:[Ys]},$$scope:{ctx:B}}}),se=new Ve({props:{anchor:"transformers.DistilBertForTokenClassification.forward.example",$$slots:{default:[Os]},$$scope:{ctx:B}}}),V=new xe({props:{title:"DistilBertForQuestionAnswering",local:"transformers.DistilBertForQuestionAnswering",headingTag:"h2"}}),qe=new q({props:{name:"class transformers.DistilBertForQuestionAnswering",anchor:"transformers.DistilBertForQuestionAnswering",parameters:[{name:"config",val:": PretrainedConfig"}],parametersDescription:[{anchor:"transformers.DistilBertForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_distilbert.py#L1029"}}),Ct=new q({props:{name:"forward",anchor:"transformers.DistilBertForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.Tensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"start_positions",val:": typing.Optional[torch.Tensor] = None"},{name:"end_positions",val:": typing.Optional[torch.Tensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.DistilBertForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.DistilBertForQuestionAnswering.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.DistilBertForQuestionAnswering.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 indicates the head is <strong>not masked</strong>,</li> | |
| <li>0 indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.DistilBertForQuestionAnswering.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.DistilBertForQuestionAnswering.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.DistilBertForQuestionAnswering.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail.`,name:"output_hidden_states"},{anchor:"transformers.DistilBertForQuestionAnswering.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.DistilBertForQuestionAnswering.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Labels for position (index) of the start of the labelled span for computing the token classification loss. | |
| Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence | |
| are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.DistilBertForQuestionAnswering.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Labels for position (index) of the end of the labelled span for computing the token classification loss. | |
| Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence | |
| are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_distilbert.py#L1070",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput" | |
| >transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p> | |
| </li> | |
| <li> | |
| <p><strong>start_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) — Span-start scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>end_logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) — Span-end scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, + | |
| one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput" | |
| >transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),He=new ct({props:{$$slots:{default:[Ks]},$$scope:{ctx:B}}}),Dt=new Ve({props:{anchor:"transformers.DistilBertForQuestionAnswering.forward.example",$$slots:{default:[eo]},$$scope:{ctx:B}}}),{c(){g(e.$$.fragment),u=a(),n=c("div"),g(s.$$.fragment),w=a(),t=c("p"),t.textContent=k,ae=a(),Z=c("p"),Z.innerHTML=z,O=a(),D=c("p"),D.innerHTML=U,K=a(),f=c("div"),g(j.$$.fragment),Ee=a(),Me=c("p"),Me.innerHTML=ns,ln=a(),g(re.$$.fragment),_n=a(),g(De.$$.fragment),pt=a(),g(tt.$$.fragment),It=a(),P=c("div"),g(Gt.$$.fragment),E=a(),nt=c("p"),nt.innerHTML=wt,bn=a(),ee=c("p"),ee.innerHTML=kt,Jn=a(),Rt=c("p"),Rt.innerHTML=zn,dn=a(),he=c("div"),g(Un.$$.fragment),qt=a(),Qe=c("p"),Qe.innerHTML=mt,At=a(),g(je.$$.fragment),Tn=a(),g(ut.$$.fragment),Mn=a(),g(st.$$.fragment),Pt=a(),H=c("div"),g(Ce.$$.fragment),cn=a(),ht=c("p"),ht.textContent=Nt,Dn=a(),L=c("p"),L.innerHTML=Wn,Ht=a(),We=c("p"),We.innerHTML=yn,Yt=a(),N=c("div"),g(ft.$$.fragment),pn=a(),Se=c("p"),Se.innerHTML=Nn,An=a(),g(ye.$$.fragment),wn=a(),g(ie.$$.fragment),Ze=a(),g(kn.$$.fragment),Ot=a(),g(Ae.$$.fragment),Hn=a(),A=c("div"),g(Lt.$$.fragment),Kt=a(),$t=c("p"),$t.textContent=Je,Xt=a(),Ie=c("p"),Ie.innerHTML=Zn,we=a(),Ge=c("p"),Ge.innerHTML=$n,mn=a(),le=c("div"),g(un.$$.fragment),gt=a(),vt=c("p"),vt.innerHTML=ke,_t=a(),g(bt.$$.fragment),In=a(),g(Pe.$$.fragment),en=a(),g(fe.$$.fragment),tn=a(),ce=c("div"),g(ot.$$.fragment),Pn=a(),xt=c("p"),xt.textContent=Tt,vn=a(),Bt=c("p"),Bt.innerHTML=hn,Ft=a(),nn=c("p"),nn.innerHTML=X,jt=a(),Ye=c("div"),g($e.$$.fragment),ss=a(),fn=c("p"),fn.innerHTML=Re,Xn=a(),g(ve.$$.fragment),sn=a(),g(se.$$.fragment),Vt=a(),g(V.$$.fragment),Mt=a(),S=c("div"),g(qe.$$.fragment),Gn=a(),on=c("p"),on.innerHTML=Ln,gn=a(),at=c("p"),at.innerHTML=Et,an=a(),te=c("p"),te.innerHTML=Ne,Vn=a(),pe=c("div"),g(Ct.$$.fragment),Fe=a(),Oe=c("p"),Oe.innerHTML=Jt,zt=a(),g(He.$$.fragment),Ut=a(),g(Dt.$$.fragment),this.h()},l($){_(e.$$.fragment,$),u=r($),n=p($,"DIV",{class:!0});var C=R(n);_(s.$$.fragment,C),w=r(C),t=p(C,"P",{"data-svelte-h":!0}),m(t)!=="svelte-1ololo3"&&(t.textContent=k),ae=r(C),Z=p(C,"P",{"data-svelte-h":!0}),m(Z)!=="svelte-11lo3q8"&&(Z.innerHTML=z),O=r(C),D=p(C,"P",{"data-svelte-h":!0}),m(D)!=="svelte-hswkmf"&&(D.innerHTML=U),K=r(C),f=p(C,"DIV",{class:!0});var ge=R(f);_(j.$$.fragment,ge),Ee=r(ge),Me=p(ge,"P",{"data-svelte-h":!0}),m(Me)!=="svelte-167r8g5"&&(Me.innerHTML=ns),ln=r(ge),_(re.$$.fragment,ge),_n=r(ge),_(De.$$.fragment,ge),ge.forEach(i),C.forEach(i),pt=r($),_(tt.$$.fragment,$),It=r($),P=p($,"DIV",{class:!0});var Ke=R(P);_(Gt.$$.fragment,Ke),E=r(Ke),nt=p(Ke,"P",{"data-svelte-h":!0}),m(nt)!=="svelte-23pii1"&&(nt.innerHTML=wt),bn=r(Ke),ee=p(Ke,"P",{"data-svelte-h":!0}),m(ee)!=="svelte-11lo3q8"&&(ee.innerHTML=kt),Jn=r(Ke),Rt=p(Ke,"P",{"data-svelte-h":!0}),m(Rt)!=="svelte-hswkmf"&&(Rt.innerHTML=zn),dn=r(Ke),he=p(Ke,"DIV",{class:!0});var de=R(he);_(Un.$$.fragment,de),qt=r(de),Qe=p(de,"P",{"data-svelte-h":!0}),m(Qe)!=="svelte-kvti8h"&&(Qe.innerHTML=mt),At=r(de),_(je.$$.fragment,de),Tn=r(de),_(ut.$$.fragment,de),de.forEach(i),Ke.forEach(i),Mn=r($),_(st.$$.fragment,$),Pt=r($),H=p($,"DIV",{class:!0});var me=R(H);_(Ce.$$.fragment,me),cn=r(me),ht=p(me,"P",{"data-svelte-h":!0}),m(ht)!=="svelte-1kr5cyc"&&(ht.textContent=Nt),Dn=r(me),L=p(me,"P",{"data-svelte-h":!0}),m(L)!=="svelte-11lo3q8"&&(L.innerHTML=Wn),Ht=r(me),We=p(me,"P",{"data-svelte-h":!0}),m(We)!=="svelte-hswkmf"&&(We.innerHTML=yn),Yt=r(me),N=p(me,"DIV",{class:!0});var W=R(N);_(ft.$$.fragment,W),pn=r(W),Se=p(W,"P",{"data-svelte-h":!0}),m(Se)!=="svelte-1k1w96h"&&(Se.innerHTML=Nn),An=r(W),_(ye.$$.fragment,W),wn=r(W),_(ie.$$.fragment,W),Ze=r(W),_(kn.$$.fragment,W),W.forEach(i),me.forEach(i),Ot=r($),_(Ae.$$.fragment,$),Hn=r($),A=p($,"DIV",{class:!0});var oe=R(A);_(Lt.$$.fragment,oe),Kt=r(oe),$t=p(oe,"P",{"data-svelte-h":!0}),m($t)!=="svelte-i84iso"&&($t.textContent=Je),Xt=r(oe),Ie=p(oe,"P",{"data-svelte-h":!0}),m(Ie)!=="svelte-11lo3q8"&&(Ie.innerHTML=Zn),we=r(oe),Ge=p(oe,"P",{"data-svelte-h":!0}),m(Ge)!=="svelte-hswkmf"&&(Ge.innerHTML=$n),mn=r(oe),le=p(oe,"DIV",{class:!0});var Le=R(le);_(un.$$.fragment,Le),gt=r(Le),vt=p(Le,"P",{"data-svelte-h":!0}),m(vt)!=="svelte-h043op"&&(vt.innerHTML=ke),_t=r(Le),_(bt.$$.fragment,Le),In=r(Le),_(Pe.$$.fragment,Le),Le.forEach(i),oe.forEach(i),en=r($),_(fe.$$.fragment,$),tn=r($),ce=p($,"DIV",{class:!0});var _e=R(ce);_(ot.$$.fragment,_e),Pn=r(_e),xt=p(_e,"P",{"data-svelte-h":!0}),m(xt)!=="svelte-14y5xfr"&&(xt.textContent=Tt),vn=r(_e),Bt=p(_e,"P",{"data-svelte-h":!0}),m(Bt)!=="svelte-11lo3q8"&&(Bt.innerHTML=hn),Ft=r(_e),nn=p(_e,"P",{"data-svelte-h":!0}),m(nn)!=="svelte-hswkmf"&&(nn.innerHTML=X),jt=r(_e),Ye=p(_e,"DIV",{class:!0});var Qt=R(Ye);_($e.$$.fragment,Qt),ss=r(Qt),fn=p(Qt,"P",{"data-svelte-h":!0}),m(fn)!=="svelte-1noq4fx"&&(fn.innerHTML=Re),Xn=r(Qt),_(ve.$$.fragment,Qt),sn=r(Qt),_(se.$$.fragment,Qt),Qt.forEach(i),_e.forEach(i),Vt=r($),_(V.$$.fragment,$),Mt=r($),S=p($,"DIV",{class:!0});var ne=R(S);_(qe.$$.fragment,ne),Gn=r(ne),on=p(ne,"P",{"data-svelte-h":!0}),m(on)!=="svelte-18jj0o9"&&(on.innerHTML=Ln),gn=r(ne),at=p(ne,"P",{"data-svelte-h":!0}),m(at)!=="svelte-11lo3q8"&&(at.innerHTML=Et),an=r(ne),te=p(ne,"P",{"data-svelte-h":!0}),m(te)!=="svelte-hswkmf"&&(te.innerHTML=Ne),Vn=r(ne),pe=p(ne,"DIV",{class:!0});var Y=R(pe);_(Ct.$$.fragment,Y),Fe=r(Y),Oe=p(Y,"P",{"data-svelte-h":!0}),m(Oe)!=="svelte-1k0o60j"&&(Oe.innerHTML=Jt),zt=r(Y),_(He.$$.fragment,Y),Ut=r(Y),_(Dt.$$.fragment,Y),Y.forEach(i),ne.forEach(i),this.h()},h(){G(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(n,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(Ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m($,C){b(e,$,C),d($,u,C),d($,n,C),b(s,n,null),l(n,w),l(n,t),l(n,ae),l(n,Z),l(n,O),l(n,D),l(n,K),l(n,f),b(j,f,null),l(f,Ee),l(f,Me),l(f,ln),b(re,f,null),l(f,_n),b(De,f,null),d($,pt,C),b(tt,$,C),d($,It,C),d($,P,C),b(Gt,P,null),l(P,E),l(P,nt),l(P,bn),l(P,ee),l(P,Jn),l(P,Rt),l(P,dn),l(P,he),b(Un,he,null),l(he,qt),l(he,Qe),l(he,At),b(je,he,null),l(he,Tn),b(ut,he,null),d($,Mn,C),b(st,$,C),d($,Pt,C),d($,H,C),b(Ce,H,null),l(H,cn),l(H,ht),l(H,Dn),l(H,L),l(H,Ht),l(H,We),l(H,Yt),l(H,N),b(ft,N,null),l(N,pn),l(N,Se),l(N,An),b(ye,N,null),l(N,wn),b(ie,N,null),l(N,Ze),b(kn,N,null),d($,Ot,C),b(Ae,$,C),d($,Hn,C),d($,A,C),b(Lt,A,null),l(A,Kt),l(A,$t),l(A,Xt),l(A,Ie),l(A,we),l(A,Ge),l(A,mn),l(A,le),b(un,le,null),l(le,gt),l(le,vt),l(le,_t),b(bt,le,null),l(le,In),b(Pe,le,null),d($,en,C),b(fe,$,C),d($,tn,C),d($,ce,C),b(ot,ce,null),l(ce,Pn),l(ce,xt),l(ce,vn),l(ce,Bt),l(ce,Ft),l(ce,nn),l(ce,jt),l(ce,Ye),b($e,Ye,null),l(Ye,ss),l(Ye,fn),l(Ye,Xn),b(ve,Ye,null),l(Ye,sn),b(se,Ye,null),d($,Vt,C),b(V,$,C),d($,Mt,C),d($,S,C),b(qe,S,null),l(S,Gn),l(S,on),l(S,gn),l(S,at),l(S,an),l(S,te),l(S,Vn),l(S,pe),b(Ct,pe,null),l(pe,Fe),l(pe,Oe),l(pe,zt),b(He,pe,null),l(pe,Ut),b(Dt,pe,null),xn=!0},p($,C){const ge={};C&2&&(ge.$$scope={dirty:C,ctx:$}),re.$set(ge);const Ke={};C&2&&(Ke.$$scope={dirty:C,ctx:$}),De.$set(Ke);const de={};C&2&&(de.$$scope={dirty:C,ctx:$}),je.$set(de);const me={};C&2&&(me.$$scope={dirty:C,ctx:$}),ut.$set(me);const W={};C&2&&(W.$$scope={dirty:C,ctx:$}),ye.$set(W);const oe={};C&2&&(oe.$$scope={dirty:C,ctx:$}),ie.$set(oe);const Le={};C&2&&(Le.$$scope={dirty:C,ctx:$}),kn.$set(Le);const _e={};C&2&&(_e.$$scope={dirty:C,ctx:$}),bt.$set(_e);const Qt={};C&2&&(Qt.$$scope={dirty:C,ctx:$}),Pe.$set(Qt);const ne={};C&2&&(ne.$$scope={dirty:C,ctx:$}),ve.$set(ne);const Y={};C&2&&(Y.$$scope={dirty:C,ctx:$}),se.$set(Y);const es={};C&2&&(es.$$scope={dirty:C,ctx:$}),He.$set(es);const Wt={};C&2&&(Wt.$$scope={dirty:C,ctx:$}),Dt.$set(Wt)},i($){xn||(T(e.$$.fragment,$),T(s.$$.fragment,$),T(j.$$.fragment,$),T(re.$$.fragment,$),T(De.$$.fragment,$),T(tt.$$.fragment,$),T(Gt.$$.fragment,$),T(Un.$$.fragment,$),T(je.$$.fragment,$),T(ut.$$.fragment,$),T(st.$$.fragment,$),T(Ce.$$.fragment,$),T(ft.$$.fragment,$),T(ye.$$.fragment,$),T(ie.$$.fragment,$),T(kn.$$.fragment,$),T(Ae.$$.fragment,$),T(Lt.$$.fragment,$),T(un.$$.fragment,$),T(bt.$$.fragment,$),T(Pe.$$.fragment,$),T(fe.$$.fragment,$),T(ot.$$.fragment,$),T($e.$$.fragment,$),T(ve.$$.fragment,$),T(se.$$.fragment,$),T(V.$$.fragment,$),T(qe.$$.fragment,$),T(Ct.$$.fragment,$),T(He.$$.fragment,$),T(Dt.$$.fragment,$),xn=!0)},o($){M(e.$$.fragment,$),M(s.$$.fragment,$),M(j.$$.fragment,$),M(re.$$.fragment,$),M(De.$$.fragment,$),M(tt.$$.fragment,$),M(Gt.$$.fragment,$),M(Un.$$.fragment,$),M(je.$$.fragment,$),M(ut.$$.fragment,$),M(st.$$.fragment,$),M(Ce.$$.fragment,$),M(ft.$$.fragment,$),M(ye.$$.fragment,$),M(ie.$$.fragment,$),M(kn.$$.fragment,$),M(Ae.$$.fragment,$),M(Lt.$$.fragment,$),M(un.$$.fragment,$),M(bt.$$.fragment,$),M(Pe.$$.fragment,$),M(fe.$$.fragment,$),M(ot.$$.fragment,$),M($e.$$.fragment,$),M(ve.$$.fragment,$),M(se.$$.fragment,$),M(V.$$.fragment,$),M(qe.$$.fragment,$),M(Ct.$$.fragment,$),M(He.$$.fragment,$),M(Dt.$$.fragment,$),xn=!1},d($){$&&(i(u),i(n),i(pt),i(It),i(P),i(Mn),i(Pt),i(H),i(Ot),i(Hn),i(A),i(en),i(tn),i(ce),i(Vt),i(Mt),i(S)),y(e,$),y(s),y(j),y(re),y(De),y(tt,$),y(Gt),y(Un),y(je),y(ut),y(st,$),y(Ce),y(ft),y(ye),y(ie),y(kn),y(Ae,$),y(Lt),y(un),y(bt),y(Pe),y(fe,$),y(ot),y($e),y(ve),y(se),y(V,$),y(qe),y(Ct),y(He),y(Dt)}}}function no(B){let e,u;return e=new js({props:{$$slots:{default:[to]},$$scope:{ctx:B}}}),{c(){g(e.$$.fragment)},l(n){_(e.$$.fragment,n)},m(n,s){b(e,n,s),u=!0},p(n,s){const w={};s&2&&(w.$$scope={dirty:s,ctx:n}),e.$set(w)},i(n){u||(T(e.$$.fragment,n),u=!0)},o(n){M(e.$$.fragment,n),u=!1},d(n){y(e,n)}}}function so(B){let e,u="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,s,w="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,k,ae=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models | |
| and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just | |
| pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second | |
| format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with | |
| the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first | |
| positional argument:`,Z,z,O=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: | |
| <code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring: | |
| <code>model({"input_ids": input_ids, "token_type_ids": token_type_ids})</code></li>`,D,U,K=`Note that when creating models and layers with | |
| <a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry | |
| about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=u,n=a(),s=c("ul"),s.innerHTML=w,t=a(),k=c("p"),k.innerHTML=ae,Z=a(),z=c("ul"),z.innerHTML=O,D=a(),U=c("p"),U.innerHTML=K},l(f){e=p(f,"P",{"data-svelte-h":!0}),m(e)!=="svelte-1ajbfxg"&&(e.innerHTML=u),n=r(f),s=p(f,"UL",{"data-svelte-h":!0}),m(s)!=="svelte-qm1t26"&&(s.innerHTML=w),t=r(f),k=p(f,"P",{"data-svelte-h":!0}),m(k)!=="svelte-1v9qsc5"&&(k.innerHTML=ae),Z=r(f),z=p(f,"UL",{"data-svelte-h":!0}),m(z)!=="svelte-15scerc"&&(z.innerHTML=O),D=r(f),U=p(f,"P",{"data-svelte-h":!0}),m(U)!=="svelte-1an3odd"&&(U.innerHTML=K)},m(f,j){d(f,e,j),d(f,n,j),d(f,s,j),d(f,t,j),d(f,k,j),d(f,Z,j),d(f,z,j),d(f,D,j),d(f,U,j)},p:I,d(f){f&&(i(e),i(n),i(s),i(t),i(k),i(Z),i(z),i(D),i(U))}}}function oo(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function ao(B){let e,u="Example:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkRpc3RpbEJlcnRNb2RlbCUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBURkRpc3RpbEJlcnRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbChpbnB1dHMpJTBBJTBBbGFzdF9oaWRkZW5fc3RhdGVzJTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFDistilBertModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = TFDistilBertModel.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"tf"</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(inputs) | |
| <span class="hljs-meta">>>> </span>last_hidden_states = outputs.last_hidden_state`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-11lpom8"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function ro(B){let e,u="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,s,w="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,k,ae=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models | |
| and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just | |
| pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second | |
| format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with | |
| the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first | |
| positional argument:`,Z,z,O=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: | |
| <code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring: | |
| <code>model({"input_ids": input_ids, "token_type_ids": token_type_ids})</code></li>`,D,U,K=`Note that when creating models and layers with | |
| <a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry | |
| about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=u,n=a(),s=c("ul"),s.innerHTML=w,t=a(),k=c("p"),k.innerHTML=ae,Z=a(),z=c("ul"),z.innerHTML=O,D=a(),U=c("p"),U.innerHTML=K},l(f){e=p(f,"P",{"data-svelte-h":!0}),m(e)!=="svelte-1ajbfxg"&&(e.innerHTML=u),n=r(f),s=p(f,"UL",{"data-svelte-h":!0}),m(s)!=="svelte-qm1t26"&&(s.innerHTML=w),t=r(f),k=p(f,"P",{"data-svelte-h":!0}),m(k)!=="svelte-1v9qsc5"&&(k.innerHTML=ae),Z=r(f),z=p(f,"UL",{"data-svelte-h":!0}),m(z)!=="svelte-15scerc"&&(z.innerHTML=O),D=r(f),U=p(f,"P",{"data-svelte-h":!0}),m(U)!=="svelte-1an3odd"&&(U.innerHTML=K)},m(f,j){d(f,e,j),d(f,n,j),d(f,s,j),d(f,t,j),d(f,k,j),d(f,Z,j),d(f,z,j),d(f,D,j),d(f,U,j)},p:I,d(f){f&&(i(e),i(n),i(s),i(t),i(k),i(Z),i(z),i(D),i(U))}}}function io(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function lo(B){let e,u="Example:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkRpc3RpbEJlcnRGb3JNYXNrZWRMTSUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBURkRpc3RpbEJlcnRGb3JNYXNrZWRMTS5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMlRoZSUyMGNhcGl0YWwlMjBvZiUyMEZyYW5jZSUyMGlzJTIwJTVCTUFTSyU1RC4lMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQWxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEElMjMlMjByZXRyaWV2ZSUyMGluZGV4JTIwb2YlMjAlNUJNQVNLJTVEJTBBbWFza190b2tlbl9pbmRleCUyMCUzRCUyMHRmLndoZXJlKChpbnB1dHMuaW5wdXRfaWRzJTIwJTNEJTNEJTIwdG9rZW5pemVyLm1hc2tfdG9rZW5faWQpJTVCMCU1RCklMEFzZWxlY3RlZF9sb2dpdHMlMjAlM0QlMjB0Zi5nYXRoZXJfbmQobG9naXRzJTVCMCU1RCUyQyUyMGluZGljZXMlM0RtYXNrX3Rva2VuX2luZGV4KSUwQSUwQXByZWRpY3RlZF90b2tlbl9pZCUyMCUzRCUyMHRmLm1hdGguYXJnbWF4KHNlbGVjdGVkX2xvZ2l0cyUyQyUyMGF4aXMlM0QtMSk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFDistilBertForMaskedLM | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = TFDistilBertForMaskedLM.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"The capital of France is [MASK]."</span>, return_tensors=<span class="hljs-string">"tf"</span>) | |
| <span class="hljs-meta">>>> </span>logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># retrieve index of [MASK]</span> | |
| <span class="hljs-meta">>>> </span>mask_token_index = tf.where((inputs.input_ids == tokenizer.mask_token_id)[<span class="hljs-number">0</span>]) | |
| <span class="hljs-meta">>>> </span>selected_logits = tf.gather_nd(logits[<span class="hljs-number">0</span>], indices=mask_token_index) | |
| <span class="hljs-meta">>>> </span>predicted_token_id = tf.math.argmax(selected_logits, axis=-<span class="hljs-number">1</span>)`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-11lpom8"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function co(B){let e,u;return e=new Be({props:{code:"bGFiZWxzJTIwJTNEJTIwdG9rZW5pemVyKCUyMlRoZSUyMGNhcGl0YWwlMjBvZiUyMEZyYW5jZSUyMGlzJTIwUGFyaXMuJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklNUIlMjJpbnB1dF9pZHMlMjIlNUQlMEElMjMlMjBtYXNrJTIwbGFiZWxzJTIwb2YlMjBub24tJTVCTUFTSyU1RCUyMHRva2VucyUwQWxhYmVscyUyMCUzRCUyMHRmLndoZXJlKGlucHV0cy5pbnB1dF9pZHMlMjAlM0QlM0QlMjB0b2tlbml6ZXIubWFza190b2tlbl9pZCUyQyUyMGxhYmVscyUyQyUyMC0xMDApJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKQ==",highlighted:`<span class="hljs-meta">>>> </span>labels = tokenizer(<span class="hljs-string">"The capital of France is Paris."</span>, return_tensors=<span class="hljs-string">"tf"</span>)[<span class="hljs-string">"input_ids"</span>] | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># mask labels of non-[MASK] tokens</span> | |
| <span class="hljs-meta">>>> </span>labels = tf.where(inputs.input_ids == tokenizer.mask_token_id, labels, -<span class="hljs-number">100</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs, labels=labels)`,wrap:!1}}),{c(){g(e.$$.fragment)},l(n){_(e.$$.fragment,n)},m(n,s){b(e,n,s),u=!0},p:I,i(n){u||(T(e.$$.fragment,n),u=!0)},o(n){M(e.$$.fragment,n),u=!1},d(n){y(e,n)}}}function po(B){let e,u="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,s,w="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,k,ae=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models | |
| and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just | |
| pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second | |
| format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with | |
| the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first | |
| positional argument:`,Z,z,O=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: | |
| <code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring: | |
| <code>model({"input_ids": input_ids, "token_type_ids": token_type_ids})</code></li>`,D,U,K=`Note that when creating models and layers with | |
| <a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry | |
| about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=u,n=a(),s=c("ul"),s.innerHTML=w,t=a(),k=c("p"),k.innerHTML=ae,Z=a(),z=c("ul"),z.innerHTML=O,D=a(),U=c("p"),U.innerHTML=K},l(f){e=p(f,"P",{"data-svelte-h":!0}),m(e)!=="svelte-1ajbfxg"&&(e.innerHTML=u),n=r(f),s=p(f,"UL",{"data-svelte-h":!0}),m(s)!=="svelte-qm1t26"&&(s.innerHTML=w),t=r(f),k=p(f,"P",{"data-svelte-h":!0}),m(k)!=="svelte-1v9qsc5"&&(k.innerHTML=ae),Z=r(f),z=p(f,"UL",{"data-svelte-h":!0}),m(z)!=="svelte-15scerc"&&(z.innerHTML=O),D=r(f),U=p(f,"P",{"data-svelte-h":!0}),m(U)!=="svelte-1an3odd"&&(U.innerHTML=K)},m(f,j){d(f,e,j),d(f,n,j),d(f,s,j),d(f,t,j),d(f,k,j),d(f,Z,j),d(f,z,j),d(f,D,j),d(f,U,j)},p:I,d(f){f&&(i(e),i(n),i(s),i(t),i(k),i(Z),i(z),i(D),i(U))}}}function mo(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function uo(B){let e,u="Example:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkRpc3RpbEJlcnRGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBaW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMFRGRGlzdGlsQmVydEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEElMEFsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX2NsYXNzX2lkJTIwJTNEJTIwaW50KHRmLm1hdGguYXJnbWF4KGxvZ2l0cyUyQyUyMGF4aXMlM0QtMSklNUIwJTVEKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFDistilBertForSequenceClassification | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = TFDistilBertForSequenceClassification.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"tf"</span>) | |
| <span class="hljs-meta">>>> </span>logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span>predicted_class_id = <span class="hljs-built_in">int</span>(tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>])`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-11lpom8"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function ho(B){let e,u;return e=new Be({props:{code:"JTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwVEZEaXN0aWxCZXJ0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIlMkMlMjBudW1fbGFiZWxzJTNEbnVtX2xhYmVscyklMEElMEFsYWJlbHMlMjAlM0QlMjB0Zi5jb25zdGFudCgxKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",highlighted:'<span class="hljs-meta">>>> </span><span class="hljs-comment"># To train a model on `num_labels` classes, you can pass `num_labels=num_labels` to `.from_pretrained(...)`</span>\n<span class="hljs-meta">>>> </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)\n<span class="hljs-meta">>>> </span>model = TFDistilBertForSequenceClassification.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>, num_labels=num_labels)\n\n<span class="hljs-meta">>>> </span>labels = tf.constant(<span class="hljs-number">1</span>)\n<span class="hljs-meta">>>> </span>loss = model(**inputs, labels=labels).loss',wrap:!1}}),{c(){g(e.$$.fragment)},l(n){_(e.$$.fragment,n)},m(n,s){b(e,n,s),u=!0},p:I,i(n){u||(T(e.$$.fragment,n),u=!0)},o(n){M(e.$$.fragment,n),u=!1},d(n){y(e,n)}}}function fo(B){let e,u="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,s,w="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,k,ae=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models | |
| and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just | |
| pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second | |
| format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with | |
| the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first | |
| positional argument:`,Z,z,O=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: | |
| <code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring: | |
| <code>model({"input_ids": input_ids, "token_type_ids": token_type_ids})</code></li>`,D,U,K=`Note that when creating models and layers with | |
| <a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry | |
| about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=u,n=a(),s=c("ul"),s.innerHTML=w,t=a(),k=c("p"),k.innerHTML=ae,Z=a(),z=c("ul"),z.innerHTML=O,D=a(),U=c("p"),U.innerHTML=K},l(f){e=p(f,"P",{"data-svelte-h":!0}),m(e)!=="svelte-1ajbfxg"&&(e.innerHTML=u),n=r(f),s=p(f,"UL",{"data-svelte-h":!0}),m(s)!=="svelte-qm1t26"&&(s.innerHTML=w),t=r(f),k=p(f,"P",{"data-svelte-h":!0}),m(k)!=="svelte-1v9qsc5"&&(k.innerHTML=ae),Z=r(f),z=p(f,"UL",{"data-svelte-h":!0}),m(z)!=="svelte-15scerc"&&(z.innerHTML=O),D=r(f),U=p(f,"P",{"data-svelte-h":!0}),m(U)!=="svelte-1an3odd"&&(U.innerHTML=K)},m(f,j){d(f,e,j),d(f,n,j),d(f,s,j),d(f,t,j),d(f,k,j),d(f,Z,j),d(f,z,j),d(f,D,j),d(f,U,j)},p:I,d(f){f&&(i(e),i(n),i(s),i(t),i(k),i(Z),i(z),i(D),i(U))}}}function go(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function _o(B){let e,u="Example:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkRpc3RpbEJlcnRGb3JNdWx0aXBsZUNob2ljZSUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBURkRpc3RpbEJlcnRGb3JNdWx0aXBsZUNob2ljZS5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIySW4lMjBJdGFseSUyQyUyMHBpenphJTIwc2VydmVkJTIwaW4lMjBmb3JtYWwlMjBzZXR0aW5ncyUyQyUyMHN1Y2glMjBhcyUyMGF0JTIwYSUyMHJlc3RhdXJhbnQlMkMlMjBpcyUyMHByZXNlbnRlZCUyMHVuc2xpY2VkLiUyMiUwQWNob2ljZTAlMjAlM0QlMjAlMjJJdCUyMGlzJTIwZWF0ZW4lMjB3aXRoJTIwYSUyMGZvcmslMjBhbmQlMjBhJTIwa25pZmUuJTIyJTBBY2hvaWNlMSUyMCUzRCUyMCUyMkl0JTIwaXMlMjBlYXRlbiUyMHdoaWxlJTIwaGVsZCUyMGluJTIwdGhlJTIwaGFuZC4lMjIlMEElMEFlbmNvZGluZyUyMCUzRCUyMHRva2VuaXplciglNUJwcm9tcHQlMkMlMjBwcm9tcHQlNUQlMkMlMjAlNUJjaG9pY2UwJTJDJTIwY2hvaWNlMSU1RCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIlMkMlMjBwYWRkaW5nJTNEVHJ1ZSklMEFpbnB1dHMlMjAlM0QlMjAlN0JrJTNBJTIwdGYuZXhwYW5kX2RpbXModiUyQyUyMDApJTIwZm9yJTIwayUyQyUyMHYlMjBpbiUyMGVuY29kaW5nLml0ZW1zKCklN0QlMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoaW5wdXRzKSUyMCUyMCUyMyUyMGJhdGNoJTIwc2l6ZSUyMGlzJTIwMSUwQSUwQSUyMyUyMHRoZSUyMGxpbmVhciUyMGNsYXNzaWZpZXIlMjBzdGlsbCUyMG5lZWRzJTIwdG8lMjBiZSUyMHRyYWluZWQlMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFDistilBertForMultipleChoice | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = TFDistilBertForMultipleChoice.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>prompt = <span class="hljs-string">"In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced."</span> | |
| <span class="hljs-meta">>>> </span>choice0 = <span class="hljs-string">"It is eaten with a fork and a knife."</span> | |
| <span class="hljs-meta">>>> </span>choice1 = <span class="hljs-string">"It is eaten while held in the hand."</span> | |
| <span class="hljs-meta">>>> </span>encoding = tokenizer([prompt, prompt], [choice0, choice1], return_tensors=<span class="hljs-string">"tf"</span>, padding=<span class="hljs-literal">True</span>) | |
| <span class="hljs-meta">>>> </span>inputs = {k: tf.expand_dims(v, <span class="hljs-number">0</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> encoding.items()} | |
| <span class="hljs-meta">>>> </span>outputs = model(inputs) <span class="hljs-comment"># batch size is 1</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># the linear classifier still needs to be trained</span> | |
| <span class="hljs-meta">>>> </span>logits = outputs.logits`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-11lpom8"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function bo(B){let e,u="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,s,w="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,k,ae=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models | |
| and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just | |
| pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second | |
| format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with | |
| the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first | |
| positional argument:`,Z,z,O=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: | |
| <code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring: | |
| <code>model({"input_ids": input_ids, "token_type_ids": token_type_ids})</code></li>`,D,U,K=`Note that when creating models and layers with | |
| <a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry | |
| about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=u,n=a(),s=c("ul"),s.innerHTML=w,t=a(),k=c("p"),k.innerHTML=ae,Z=a(),z=c("ul"),z.innerHTML=O,D=a(),U=c("p"),U.innerHTML=K},l(f){e=p(f,"P",{"data-svelte-h":!0}),m(e)!=="svelte-1ajbfxg"&&(e.innerHTML=u),n=r(f),s=p(f,"UL",{"data-svelte-h":!0}),m(s)!=="svelte-qm1t26"&&(s.innerHTML=w),t=r(f),k=p(f,"P",{"data-svelte-h":!0}),m(k)!=="svelte-1v9qsc5"&&(k.innerHTML=ae),Z=r(f),z=p(f,"UL",{"data-svelte-h":!0}),m(z)!=="svelte-15scerc"&&(z.innerHTML=O),D=r(f),U=p(f,"P",{"data-svelte-h":!0}),m(U)!=="svelte-1an3odd"&&(U.innerHTML=K)},m(f,j){d(f,e,j),d(f,n,j),d(f,s,j),d(f,t,j),d(f,k,j),d(f,Z,j),d(f,z,j),d(f,D,j),d(f,U,j)},p:I,d(f){f&&(i(e),i(n),i(s),i(t),i(k),i(Z),i(z),i(D),i(U))}}}function To(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function Mo(B){let e,u="Example:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkRpc3RpbEJlcnRGb3JUb2tlbkNsYXNzaWZpY2F0aW9uJTBBaW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMFRGRGlzdGlsQmVydEZvclRva2VuQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMEElMjAlMjAlMjAlMjAlMjJIdWdnaW5nRmFjZSUyMGlzJTIwYSUyMGNvbXBhbnklMjBiYXNlZCUyMGluJTIwUGFyaXMlMjBhbmQlMjBOZXclMjBZb3JrJTIyJTJDJTIwYWRkX3NwZWNpYWxfdG9rZW5zJTNERmFsc2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyJTBBKSUwQSUwQWxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEFwcmVkaWN0ZWRfdG9rZW5fY2xhc3NfaWRzJTIwJTNEJTIwdGYubWF0aC5hcmdtYXgobG9naXRzJTJDJTIwYXhpcyUzRC0xKSUwQSUwQSUyMyUyME5vdGUlMjB0aGF0JTIwdG9rZW5zJTIwYXJlJTIwY2xhc3NpZmllZCUyMHJhdGhlciUyMHRoZW4lMjBpbnB1dCUyMHdvcmRzJTIwd2hpY2glMjBtZWFucyUyMHRoYXQlMEElMjMlMjB0aGVyZSUyMG1pZ2h0JTIwYmUlMjBtb3JlJTIwcHJlZGljdGVkJTIwdG9rZW4lMjBjbGFzc2VzJTIwdGhhbiUyMHdvcmRzLiUwQSUyMyUyME11bHRpcGxlJTIwdG9rZW4lMjBjbGFzc2VzJTIwbWlnaHQlMjBhY2NvdW50JTIwZm9yJTIwdGhlJTIwc2FtZSUyMHdvcmQlMEFwcmVkaWN0ZWRfdG9rZW5zX2NsYXNzZXMlMjAlM0QlMjAlNUJtb2RlbC5jb25maWcuaWQybGFiZWwlNUJ0JTVEJTIwZm9yJTIwdCUyMGluJTIwcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyU1QjAlNUQubnVtcHkoKS50b2xpc3QoKSU1RA==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFDistilBertForTokenClassification | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = TFDistilBertForTokenClassification.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"HuggingFace is a company based in Paris and New York"</span>, add_special_tokens=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">"tf"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span>predicted_token_class_ids = tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Note that tokens are classified rather then input words which means that</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># there might be more predicted token classes than words.</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Multiple token classes might account for the same word</span> | |
| <span class="hljs-meta">>>> </span>predicted_tokens_classes = [model.config.id2label[t] <span class="hljs-keyword">for</span> t <span class="hljs-keyword">in</span> predicted_token_class_ids[<span class="hljs-number">0</span>].numpy().tolist()]`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-11lpom8"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function yo(B){let e,u;return e=new Be({props:{code:"bGFiZWxzJTIwJTNEJTIwcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyUwQWxvc3MlMjAlM0QlMjB0Zi5tYXRoLnJlZHVjZV9tZWFuKG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKS5sb3NzKQ==",highlighted:`<span class="hljs-meta">>>> </span>labels = predicted_token_class_ids | |
| <span class="hljs-meta">>>> </span>loss = tf.math.reduce_mean(model(**inputs, labels=labels).loss)`,wrap:!1}}),{c(){g(e.$$.fragment)},l(n){_(e.$$.fragment,n)},m(n,s){b(e,n,s),u=!0},p:I,i(n){u||(T(e.$$.fragment,n),u=!0)},o(n){M(e.$$.fragment,n),u=!1},d(n){y(e,n)}}}function wo(B){let e,u="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,s,w="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,k,ae=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models | |
| and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just | |
| pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second | |
| format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with | |
| the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first | |
| positional argument:`,Z,z,O=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: | |
| <code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring: | |
| <code>model({"input_ids": input_ids, "token_type_ids": token_type_ids})</code></li>`,D,U,K=`Note that when creating models and layers with | |
| <a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry | |
| about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=u,n=a(),s=c("ul"),s.innerHTML=w,t=a(),k=c("p"),k.innerHTML=ae,Z=a(),z=c("ul"),z.innerHTML=O,D=a(),U=c("p"),U.innerHTML=K},l(f){e=p(f,"P",{"data-svelte-h":!0}),m(e)!=="svelte-1ajbfxg"&&(e.innerHTML=u),n=r(f),s=p(f,"UL",{"data-svelte-h":!0}),m(s)!=="svelte-qm1t26"&&(s.innerHTML=w),t=r(f),k=p(f,"P",{"data-svelte-h":!0}),m(k)!=="svelte-1v9qsc5"&&(k.innerHTML=ae),Z=r(f),z=p(f,"UL",{"data-svelte-h":!0}),m(z)!=="svelte-15scerc"&&(z.innerHTML=O),D=r(f),U=p(f,"P",{"data-svelte-h":!0}),m(U)!=="svelte-1an3odd"&&(U.innerHTML=K)},m(f,j){d(f,e,j),d(f,n,j),d(f,s,j),d(f,t,j),d(f,k,j),d(f,Z,j),d(f,z,j),d(f,D,j),d(f,U,j)},p:I,d(f){f&&(i(e),i(n),i(s),i(t),i(k),i(Z),i(z),i(D),i(U))}}}function ko(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function $o(B){let e,u="Example:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkRpc3RpbEJlcnRGb3JRdWVzdGlvbkFuc3dlcmluZyUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBURkRpc3RpbEJlcnRGb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBJTBBcXVlc3Rpb24lMkMlMjB0ZXh0JTIwJTNEJTIwJTIyV2hvJTIwd2FzJTIwSmltJTIwSGVuc29uJTNGJTIyJTJDJTIwJTIySmltJTIwSGVuc29uJTIwd2FzJTIwYSUyMG5pY2UlMjBwdXBwZXQlMjIlMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIocXVlc3Rpb24lMkMlMjB0ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBYW5zd2VyX3N0YXJ0X2luZGV4JTIwJTNEJTIwaW50KHRmLm1hdGguYXJnbWF4KG91dHB1dHMuc3RhcnRfbG9naXRzJTJDJTIwYXhpcyUzRC0xKSU1QjAlNUQpJTBBYW5zd2VyX2VuZF9pbmRleCUyMCUzRCUyMGludCh0Zi5tYXRoLmFyZ21heChvdXRwdXRzLmVuZF9sb2dpdHMlMkMlMjBheGlzJTNELTEpJTVCMCU1RCklMEElMEFwcmVkaWN0X2Fuc3dlcl90b2tlbnMlMjAlM0QlMjBpbnB1dHMuaW5wdXRfaWRzJTVCMCUyQyUyMGFuc3dlcl9zdGFydF9pbmRleCUyMCUzQSUyMGFuc3dlcl9lbmRfaW5kZXglMjAlMkIlMjAxJTVE",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFDistilBertForQuestionAnswering | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = TFDistilBertForQuestionAnswering.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>question, text = <span class="hljs-string">"Who was Jim Henson?"</span>, <span class="hljs-string">"Jim Henson was a nice puppet"</span> | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(question, text, return_tensors=<span class="hljs-string">"tf"</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>answer_start_index = <span class="hljs-built_in">int</span>(tf.math.argmax(outputs.start_logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>]) | |
| <span class="hljs-meta">>>> </span>answer_end_index = <span class="hljs-built_in">int</span>(tf.math.argmax(outputs.end_logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>]) | |
| <span class="hljs-meta">>>> </span>predict_answer_tokens = inputs.input_ids[<span class="hljs-number">0</span>, answer_start_index : answer_end_index + <span class="hljs-number">1</span>]`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-11lpom8"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function vo(B){let e,u;return e=new Be({props:{code:"JTIzJTIwdGFyZ2V0JTIwaXMlMjAlMjJuaWNlJTIwcHVwcGV0JTIyJTBBdGFyZ2V0X3N0YXJ0X2luZGV4JTIwJTNEJTIwdGYuY29uc3RhbnQoJTVCMTQlNUQpJTBBdGFyZ2V0X2VuZF9pbmRleCUyMCUzRCUyMHRmLmNvbnN0YW50KCU1QjE1JTVEKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMHN0YXJ0X3Bvc2l0aW9ucyUzRHRhcmdldF9zdGFydF9pbmRleCUyQyUyMGVuZF9wb3NpdGlvbnMlM0R0YXJnZXRfZW5kX2luZGV4KSUwQWxvc3MlMjAlM0QlMjB0Zi5tYXRoLnJlZHVjZV9tZWFuKG91dHB1dHMubG9zcyk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-comment"># target is "nice puppet"</span> | |
| <span class="hljs-meta">>>> </span>target_start_index = tf.constant([<span class="hljs-number">14</span>]) | |
| <span class="hljs-meta">>>> </span>target_end_index = tf.constant([<span class="hljs-number">15</span>]) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index) | |
| <span class="hljs-meta">>>> </span>loss = tf.math.reduce_mean(outputs.loss)`,wrap:!1}}),{c(){g(e.$$.fragment)},l(n){_(e.$$.fragment,n)},m(n,s){b(e,n,s),u=!0},p:I,i(n){u||(T(e.$$.fragment,n),u=!0)},o(n){M(e.$$.fragment,n),u=!1},d(n){y(e,n)}}}function xo(B){let e,u,n,s,w,t,k="The bare DistilBERT encoder/transformer outputting raw hidden-states without any specific head on top.",ae,Z,z=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,O,D,U=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it | |
| as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and | |
| behavior.`,K,f,j,Ee,Me,ns,ln,re='The <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.TFDistilBertModel">TFDistilBertModel</a> forward method, overrides the <code>__call__</code> special method.',_n,De,pt,tt,It,P,Gt,E,nt,wt,bn,ee="DistilBert Model with a <code>masked language modeling</code> head on top.",kt,Jn,Rt=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,zn,dn,he=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it | |
| as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and | |
| behavior.`,Un,qt,Qe,mt,At,je,Tn,ut='The <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.TFDistilBertForMaskedLM">TFDistilBertForMaskedLM</a> forward method, overrides the <code>__call__</code> special method.',Mn,st,Pt,H,Ce,cn,ht,Nt,Dn,L,Wn,Ht,We,yn=`DistilBert Model transformer with a sequence classification/regression head on top (a linear layer on top of the | |
| pooled output) e.g. for GLUE tasks.`,Yt,N,ft=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,pn,Se,Nn=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it | |
| as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and | |
| behavior.`,An,ye,wn,ie,Ze,kn,Ot,Ae='The <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.TFDistilBertForSequenceClassification">TFDistilBertForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',Hn,A,Lt,Kt,$t,Je,Xt,Ie,Zn,we,Ge,$n,mn,le=`DistilBert Model with a multiple choice classification head on top (a linear layer on top of the pooled output and | |
| a softmax) e.g. for RocStories/SWAG tasks.`,un,gt,vt=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,ke,_t,bt=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it | |
| as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and | |
| behavior.`,In,Pe,en,fe,tn,ce,ot,Pn='The <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.TFDistilBertForMultipleChoice">TFDistilBertForMultipleChoice</a> forward method, overrides the <code>__call__</code> special method.',xt,Tt,vn,Bt,hn,Ft,nn,X,jt,Ye,$e,ss=`DistilBert Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. | |
| for Named-Entity-Recognition (NER) tasks.`,fn,Re,Xn=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,ve,sn,se=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it | |
| as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and | |
| behavior.`,Vt,V,Mt,S,qe,Gn,on,Ln='The <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.TFDistilBertForTokenClassification">TFDistilBertForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',gn,at,Et,an,te,Ne,Vn,pe,Ct,Fe,Oe,Jt,zt,He=`DistilBert Model with a span classification head on top for extractive question-answering tasks like SQuAD (a | |
| linear layer on top of the hidden-states output to compute <code>span start logits</code> and <code>span end logits</code>).`,Ut,Dt,xn=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,$,C,ge=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it | |
| as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and | |
| behavior.`,Ke,de,me,W,oe,Le,_e,Qt='The <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.TFDistilBertForQuestionAnswering">TFDistilBertForQuestionAnswering</a> forward method, overrides the <code>__call__</code> special method.',ne,Y,es,Wt,ts,En,Rn;return e=new xe({props:{title:"TFDistilBertModel",local:"transformers.TFDistilBertModel",headingTag:"h2"}}),s=new q({props:{name:"class transformers.TFDistilBertModel",anchor:"transformers.TFDistilBertModel",parameters:[{name:"config",val:""},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFDistilBertModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_tf_distilbert.py#L575"}}),f=new ct({props:{$$slots:{default:[so]},$$scope:{ctx:B}}}),Me=new q({props:{name:"call",anchor:"transformers.TFDistilBertModel.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFDistilBertModel.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFDistilBertModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFDistilBertModel.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 indicates the head is <strong>not masked</strong>,</li> | |
| <li>0 indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.TFDistilBertModel.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFDistilBertModel.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the | |
| config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFDistilBertModel.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail. This argument can be used only in eager mode, in graph mode the value in the config will be | |
| used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFDistilBertModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in | |
| eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFDistilBertModel.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to use the model in training mode (some modules like dropout modules have different | |
| behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_tf_distilbert.py#L584",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutput" | |
| >transformers.modeling_tf_outputs.TFBaseModelOutput</a> or a tuple of <code>tf.Tensor</code> (if | |
| <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the | |
| configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(tf.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape | |
| <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutput" | |
| >transformers.modeling_tf_outputs.TFBaseModelOutput</a> or <code>tuple(tf.Tensor)</code></p> | |
| `}}),De=new ct({props:{$$slots:{default:[oo]},$$scope:{ctx:B}}}),tt=new Ve({props:{anchor:"transformers.TFDistilBertModel.call.example",$$slots:{default:[ao]},$$scope:{ctx:B}}}),P=new xe({props:{title:"TFDistilBertForMaskedLM",local:"transformers.TFDistilBertForMaskedLM",headingTag:"h2"}}),nt=new q({props:{name:"class transformers.TFDistilBertForMaskedLM",anchor:"transformers.TFDistilBertForMaskedLM",parameters:[{name:"config",val:""},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFDistilBertForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_tf_distilbert.py#L663"}}),qt=new ct({props:{$$slots:{default:[ro]},$$scope:{ctx:B}}}),At=new q({props:{name:"call",anchor:"transformers.TFDistilBertForMaskedLM.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFDistilBertForMaskedLM.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFDistilBertForMaskedLM.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFDistilBertForMaskedLM.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 indicates the head is <strong>not masked</strong>,</li> | |
| <li>0 indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.TFDistilBertForMaskedLM.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFDistilBertForMaskedLM.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the | |
| config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFDistilBertForMaskedLM.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail. This argument can be used only in eager mode, in graph mode the value in the config will be | |
| used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFDistilBertForMaskedLM.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in | |
| eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFDistilBertForMaskedLM.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to use the model in training mode (some modules like dropout modules have different | |
| behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFDistilBertForMaskedLM.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Labels for computing the masked language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are ignored (masked), the | |
| loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_tf_distilbert.py#L687",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_tf_outputs.TFMaskedLMOutput" | |
| >transformers.modeling_tf_outputs.TFMaskedLMOutput</a> or a tuple of <code>tf.Tensor</code> (if | |
| <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the | |
| configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(n,)</code>, <em>optional</em>, where n is the number of non-masked labels, returned when <code>labels</code> is provided) — Masked language modeling (MLM) loss.</p> | |
| </li> | |
| <li> | |
| <p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape | |
| <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_tf_outputs.TFMaskedLMOutput" | |
| >transformers.modeling_tf_outputs.TFMaskedLMOutput</a> or <code>tuple(tf.Tensor)</code></p> | |
| `}}),st=new ct({props:{$$slots:{default:[io]},$$scope:{ctx:B}}}),H=new Ve({props:{anchor:"transformers.TFDistilBertForMaskedLM.call.example",$$slots:{default:[lo]},$$scope:{ctx:B}}}),cn=new Ve({props:{anchor:"transformers.TFDistilBertForMaskedLM.call.example-2",$$slots:{default:[co]},$$scope:{ctx:B}}}),Nt=new xe({props:{title:"TFDistilBertForSequenceClassification",local:"transformers.TFDistilBertForSequenceClassification",headingTag:"h2"}}),Wn=new q({props:{name:"class transformers.TFDistilBertForSequenceClassification",anchor:"transformers.TFDistilBertForSequenceClassification",parameters:[{name:"config",val:""},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFDistilBertForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_tf_distilbert.py#L759"}}),ye=new ct({props:{$$slots:{default:[po]},$$scope:{ctx:B}}}),Ze=new q({props:{name:"call",anchor:"transformers.TFDistilBertForSequenceClassification.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFDistilBertForSequenceClassification.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFDistilBertForSequenceClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFDistilBertForSequenceClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 indicates the head is <strong>not masked</strong>,</li> | |
| <li>0 indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.TFDistilBertForSequenceClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFDistilBertForSequenceClassification.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the | |
| config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFDistilBertForSequenceClassification.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail. This argument can be used only in eager mode, in graph mode the value in the config will be | |
| used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFDistilBertForSequenceClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in | |
| eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFDistilBertForSequenceClassification.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to use the model in training mode (some modules like dropout modules have different | |
| behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFDistilBertForSequenceClassification.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If | |
| <code>config.num_labels > 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_tf_distilbert.py#L784",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput" | |
| >transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or a tuple of <code>tf.Tensor</code> (if | |
| <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the | |
| configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, )</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Classification (or regression if config.num_labels==1) loss.</p> | |
| </li> | |
| <li> | |
| <p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, config.num_labels)</code>) — Classification (or regression if config.num_labels==1) scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape | |
| <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput" | |
| >transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p> | |
| `}}),A=new ct({props:{$$slots:{default:[mo]},$$scope:{ctx:B}}}),Kt=new Ve({props:{anchor:"transformers.TFDistilBertForSequenceClassification.call.example",$$slots:{default:[uo]},$$scope:{ctx:B}}}),Je=new Ve({props:{anchor:"transformers.TFDistilBertForSequenceClassification.call.example-2",$$slots:{default:[ho]},$$scope:{ctx:B}}}),Ie=new xe({props:{title:"TFDistilBertForMultipleChoice",local:"transformers.TFDistilBertForMultipleChoice",headingTag:"h2"}}),Ge=new q({props:{name:"class transformers.TFDistilBertForMultipleChoice",anchor:"transformers.TFDistilBertForMultipleChoice",parameters:[{name:"config",val:""},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFDistilBertForMultipleChoice.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_tf_distilbert.py#L933"}}),Pe=new ct({props:{$$slots:{default:[fo]},$$scope:{ctx:B}}}),tn=new q({props:{name:"call",anchor:"transformers.TFDistilBertForMultipleChoice.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFDistilBertForMultipleChoice.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFDistilBertForMultipleChoice.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFDistilBertForMultipleChoice.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 indicates the head is <strong>not masked</strong>,</li> | |
| <li>0 indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.TFDistilBertForMultipleChoice.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFDistilBertForMultipleChoice.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the | |
| config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFDistilBertForMultipleChoice.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail. This argument can be used only in eager mode, in graph mode the value in the config will be | |
| used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFDistilBertForMultipleChoice.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in | |
| eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFDistilBertForMultipleChoice.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to use the model in training mode (some modules like dropout modules have different | |
| behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFDistilBertForMultipleChoice.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Labels for computing the multiple choice classification loss. Indices should be in <code>[0, ..., num_choices]</code> | |
| where <code>num_choices</code> is the size of the second dimension of the input tensors. (See <code>input_ids</code> above)`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_tf_distilbert.py#L957",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_tf_outputs.TFMultipleChoiceModelOutput" | |
| >transformers.modeling_tf_outputs.TFMultipleChoiceModelOutput</a> or a tuple of <code>tf.Tensor</code> (if | |
| <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the | |
| configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>loss</strong> (<code>tf.Tensor</code> of shape <em>(batch_size, )</em>, <em>optional</em>, returned when <code>labels</code> is provided) — Classification loss.</p> | |
| </li> | |
| <li> | |
| <p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_choices)</code>) — <em>num_choices</em> is the second dimension of the input tensors. (see <em>input_ids</em> above).</p> | |
| <p>Classification scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape | |
| <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_tf_outputs.TFMultipleChoiceModelOutput" | |
| >transformers.modeling_tf_outputs.TFMultipleChoiceModelOutput</a> or <code>tuple(tf.Tensor)</code></p> | |
| `}}),Tt=new ct({props:{$$slots:{default:[go]},$$scope:{ctx:B}}}),Bt=new Ve({props:{anchor:"transformers.TFDistilBertForMultipleChoice.call.example",$$slots:{default:[_o]},$$scope:{ctx:B}}}),Ft=new xe({props:{title:"TFDistilBertForTokenClassification",local:"transformers.TFDistilBertForTokenClassification",headingTag:"h2"}}),jt=new q({props:{name:"class transformers.TFDistilBertForTokenClassification",anchor:"transformers.TFDistilBertForTokenClassification",parameters:[{name:"config",val:""},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFDistilBertForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_tf_distilbert.py#L853"}}),V=new ct({props:{$$slots:{default:[bo]},$$scope:{ctx:B}}}),qe=new q({props:{name:"call",anchor:"transformers.TFDistilBertForTokenClassification.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFDistilBertForTokenClassification.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFDistilBertForTokenClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFDistilBertForTokenClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 indicates the head is <strong>not masked</strong>,</li> | |
| <li>0 indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.TFDistilBertForTokenClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFDistilBertForTokenClassification.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the | |
| config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFDistilBertForTokenClassification.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail. This argument can be used only in eager mode, in graph mode the value in the config will be | |
| used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFDistilBertForTokenClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in | |
| eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFDistilBertForTokenClassification.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to use the model in training mode (some modules like dropout modules have different | |
| behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFDistilBertForTokenClassification.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Labels for computing the token classification loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_tf_distilbert.py#L872",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_tf_outputs.TFTokenClassifierOutput" | |
| >transformers.modeling_tf_outputs.TFTokenClassifierOutput</a> or a tuple of <code>tf.Tensor</code> (if | |
| <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the | |
| configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(n,)</code>, <em>optional</em>, where n is the number of unmasked labels, returned when <code>labels</code> is provided) — Classification loss.</p> | |
| </li> | |
| <li> | |
| <p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) — Classification scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape | |
| <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_tf_outputs.TFTokenClassifierOutput" | |
| >transformers.modeling_tf_outputs.TFTokenClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p> | |
| `}}),at=new ct({props:{$$slots:{default:[To]},$$scope:{ctx:B}}}),an=new Ve({props:{anchor:"transformers.TFDistilBertForTokenClassification.call.example",$$slots:{default:[Mo]},$$scope:{ctx:B}}}),Ne=new Ve({props:{anchor:"transformers.TFDistilBertForTokenClassification.call.example-2",$$slots:{default:[yo]},$$scope:{ctx:B}}}),pe=new xe({props:{title:"TFDistilBertForQuestionAnswering",local:"transformers.TFDistilBertForQuestionAnswering",headingTag:"h2"}}),Oe=new q({props:{name:"class transformers.TFDistilBertForQuestionAnswering",anchor:"transformers.TFDistilBertForQuestionAnswering",parameters:[{name:"config",val:""},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFDistilBertForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_tf_distilbert.py#L1042"}}),de=new ct({props:{$$slots:{default:[wo]},$$scope:{ctx:B}}}),oe=new q({props:{name:"call",anchor:"transformers.TFDistilBertForQuestionAnswering.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"start_positions",val:": np.ndarray | tf.Tensor | None = None"},{name:"end_positions",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFDistilBertForQuestionAnswering.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFDistilBertForQuestionAnswering.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFDistilBertForQuestionAnswering.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 indicates the head is <strong>not masked</strong>,</li> | |
| <li>0 indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.TFDistilBertForQuestionAnswering.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFDistilBertForQuestionAnswering.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the | |
| config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFDistilBertForQuestionAnswering.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail. This argument can be used only in eager mode, in graph mode the value in the config will be | |
| used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFDistilBertForQuestionAnswering.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in | |
| eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFDistilBertForQuestionAnswering.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to use the model in training mode (some modules like dropout modules have different | |
| behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFDistilBertForQuestionAnswering.call.start_positions",description:`<strong>start_positions</strong> (<code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Labels for position (index) of the start of the labelled span for computing the token classification loss. | |
| Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence | |
| are not taken into account for computing the loss.`,name:"start_positions"},{anchor:"transformers.TFDistilBertForQuestionAnswering.call.end_positions",description:`<strong>end_positions</strong> (<code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Labels for position (index) of the end of the labelled span for computing the token classification loss. | |
| Positions are clamped to the length of the sequence (<code>sequence_length</code>). Position outside of the sequence | |
| are not taken into account for computing the loss.`,name:"end_positions"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_tf_distilbert.py#L1061",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput" | |
| >transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput</a> or a tuple of <code>tf.Tensor</code> (if | |
| <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various elements depending on the | |
| configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, )</code>, <em>optional</em>, returned when <code>start_positions</code> and <code>end_positions</code> are provided) — Total span extraction loss is the sum of a Cross-Entropy for the start and end positions.</p> | |
| </li> | |
| <li> | |
| <p><strong>start_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — Span-start scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>end_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — Span-end scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + one for the output of each layer) of shape | |
| <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput" | |
| >transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput</a> or <code>tuple(tf.Tensor)</code></p> | |
| `}}),Y=new ct({props:{$$slots:{default:[ko]},$$scope:{ctx:B}}}),Wt=new Ve({props:{anchor:"transformers.TFDistilBertForQuestionAnswering.call.example",$$slots:{default:[$o]},$$scope:{ctx:B}}}),En=new Ve({props:{anchor:"transformers.TFDistilBertForQuestionAnswering.call.example-2",$$slots:{default:[vo]},$$scope:{ctx:B}}}),{c(){g(e.$$.fragment),u=a(),n=c("div"),g(s.$$.fragment),w=a(),t=c("p"),t.textContent=k,ae=a(),Z=c("p"),Z.innerHTML=z,O=a(),D=c("p"),D.innerHTML=U,K=a(),g(f.$$.fragment),j=a(),Ee=c("div"),g(Me.$$.fragment),ns=a(),ln=c("p"),ln.innerHTML=re,_n=a(),g(De.$$.fragment),pt=a(),g(tt.$$.fragment),It=a(),g(P.$$.fragment),Gt=a(),E=c("div"),g(nt.$$.fragment),wt=a(),bn=c("p"),bn.innerHTML=ee,kt=a(),Jn=c("p"),Jn.innerHTML=Rt,zn=a(),dn=c("p"),dn.innerHTML=he,Un=a(),g(qt.$$.fragment),Qe=a(),mt=c("div"),g(At.$$.fragment),je=a(),Tn=c("p"),Tn.innerHTML=ut,Mn=a(),g(st.$$.fragment),Pt=a(),g(H.$$.fragment),Ce=a(),g(cn.$$.fragment),ht=a(),g(Nt.$$.fragment),Dn=a(),L=c("div"),g(Wn.$$.fragment),Ht=a(),We=c("p"),We.textContent=yn,Yt=a(),N=c("p"),N.innerHTML=ft,pn=a(),Se=c("p"),Se.innerHTML=Nn,An=a(),g(ye.$$.fragment),wn=a(),ie=c("div"),g(Ze.$$.fragment),kn=a(),Ot=c("p"),Ot.innerHTML=Ae,Hn=a(),g(A.$$.fragment),Lt=a(),g(Kt.$$.fragment),$t=a(),g(Je.$$.fragment),Xt=a(),g(Ie.$$.fragment),Zn=a(),we=c("div"),g(Ge.$$.fragment),$n=a(),mn=c("p"),mn.textContent=le,un=a(),gt=c("p"),gt.innerHTML=vt,ke=a(),_t=c("p"),_t.innerHTML=bt,In=a(),g(Pe.$$.fragment),en=a(),fe=c("div"),g(tn.$$.fragment),ce=a(),ot=c("p"),ot.innerHTML=Pn,xt=a(),g(Tt.$$.fragment),vn=a(),g(Bt.$$.fragment),hn=a(),g(Ft.$$.fragment),nn=a(),X=c("div"),g(jt.$$.fragment),Ye=a(),$e=c("p"),$e.textContent=ss,fn=a(),Re=c("p"),Re.innerHTML=Xn,ve=a(),sn=c("p"),sn.innerHTML=se,Vt=a(),g(V.$$.fragment),Mt=a(),S=c("div"),g(qe.$$.fragment),Gn=a(),on=c("p"),on.innerHTML=Ln,gn=a(),g(at.$$.fragment),Et=a(),g(an.$$.fragment),te=a(),g(Ne.$$.fragment),Vn=a(),g(pe.$$.fragment),Ct=a(),Fe=c("div"),g(Oe.$$.fragment),Jt=a(),zt=c("p"),zt.innerHTML=He,Ut=a(),Dt=c("p"),Dt.innerHTML=xn,$=a(),C=c("p"),C.innerHTML=ge,Ke=a(),g(de.$$.fragment),me=a(),W=c("div"),g(oe.$$.fragment),Le=a(),_e=c("p"),_e.innerHTML=Qt,ne=a(),g(Y.$$.fragment),es=a(),g(Wt.$$.fragment),ts=a(),g(En.$$.fragment),this.h()},l(h){_(e.$$.fragment,h),u=r(h),n=p(h,"DIV",{class:!0});var F=R(n);_(s.$$.fragment,F),w=r(F),t=p(F,"P",{"data-svelte-h":!0}),m(t)!=="svelte-1ololo3"&&(t.textContent=k),ae=r(F),Z=p(F,"P",{"data-svelte-h":!0}),m(Z)!=="svelte-2bgrwg"&&(Z.innerHTML=z),O=r(F),D=p(F,"P",{"data-svelte-h":!0}),m(D)!=="svelte-1be7e3c"&&(D.innerHTML=U),K=r(F),_(f.$$.fragment,F),j=r(F),Ee=p(F,"DIV",{class:!0});var Bn=R(Ee);_(Me.$$.fragment,Bn),ns=r(Bn),ln=p(Bn,"P",{"data-svelte-h":!0}),m(ln)!=="svelte-1o6crkh"&&(ln.innerHTML=re),_n=r(Bn),_(De.$$.fragment,Bn),pt=r(Bn),_(tt.$$.fragment,Bn),Bn.forEach(i),F.forEach(i),It=r(h),_(P.$$.fragment,h),Gt=r(h),E=p(h,"DIV",{class:!0});var Xe=R(E);_(nt.$$.fragment,Xe),wt=r(Xe),bn=p(Xe,"P",{"data-svelte-h":!0}),m(bn)!=="svelte-23pii1"&&(bn.innerHTML=ee),kt=r(Xe),Jn=p(Xe,"P",{"data-svelte-h":!0}),m(Jn)!=="svelte-2bgrwg"&&(Jn.innerHTML=Rt),zn=r(Xe),dn=p(Xe,"P",{"data-svelte-h":!0}),m(dn)!=="svelte-1be7e3c"&&(dn.innerHTML=he),Un=r(Xe),_(qt.$$.fragment,Xe),Qe=r(Xe),mt=p(Xe,"DIV",{class:!0});var et=R(mt);_(At.$$.fragment,et),je=r(et),Tn=p(et,"P",{"data-svelte-h":!0}),m(Tn)!=="svelte-1r40hyt"&&(Tn.innerHTML=ut),Mn=r(et),_(st.$$.fragment,et),Pt=r(et),_(H.$$.fragment,et),Ce=r(et),_(cn.$$.fragment,et),et.forEach(i),Xe.forEach(i),ht=r(h),_(Nt.$$.fragment,h),Dn=r(h),L=p(h,"DIV",{class:!0});var ze=R(L);_(Wn.$$.fragment,ze),Ht=r(ze),We=p(ze,"P",{"data-svelte-h":!0}),m(We)!=="svelte-1kr5cyc"&&(We.textContent=yn),Yt=r(ze),N=p(ze,"P",{"data-svelte-h":!0}),m(N)!=="svelte-2bgrwg"&&(N.innerHTML=ft),pn=r(ze),Se=p(ze,"P",{"data-svelte-h":!0}),m(Se)!=="svelte-1be7e3c"&&(Se.innerHTML=Nn),An=r(ze),_(ye.$$.fragment,ze),wn=r(ze),ie=p(ze,"DIV",{class:!0});var be=R(ie);_(Ze.$$.fragment,be),kn=r(be),Ot=p(be,"P",{"data-svelte-h":!0}),m(Ot)!=="svelte-12xsolt"&&(Ot.innerHTML=Ae),Hn=r(be),_(A.$$.fragment,be),Lt=r(be),_(Kt.$$.fragment,be),$t=r(be),_(Je.$$.fragment,be),be.forEach(i),ze.forEach(i),Xt=r(h),_(Ie.$$.fragment,h),Zn=r(h),we=p(h,"DIV",{class:!0});var Te=R(we);_(Ge.$$.fragment,Te),$n=r(Te),mn=p(Te,"P",{"data-svelte-h":!0}),m(mn)!=="svelte-i84iso"&&(mn.textContent=le),un=r(Te),gt=p(Te,"P",{"data-svelte-h":!0}),m(gt)!=="svelte-2bgrwg"&&(gt.innerHTML=vt),ke=r(Te),_t=p(Te,"P",{"data-svelte-h":!0}),m(_t)!=="svelte-1be7e3c"&&(_t.innerHTML=bt),In=r(Te),_(Pe.$$.fragment,Te),en=r(Te),fe=p(Te,"DIV",{class:!0});var Fn=R(fe);_(tn.$$.fragment,Fn),ce=r(Fn),ot=p(Fn,"P",{"data-svelte-h":!0}),m(ot)!=="svelte-cmjay1"&&(ot.innerHTML=Pn),xt=r(Fn),_(Tt.$$.fragment,Fn),vn=r(Fn),_(Bt.$$.fragment,Fn),Fn.forEach(i),Te.forEach(i),hn=r(h),_(Ft.$$.fragment,h),nn=r(h),X=p(h,"DIV",{class:!0});var Ue=R(X);_(jt.$$.fragment,Ue),Ye=r(Ue),$e=p(Ue,"P",{"data-svelte-h":!0}),m($e)!=="svelte-14y5xfr"&&($e.textContent=ss),fn=r(Ue),Re=p(Ue,"P",{"data-svelte-h":!0}),m(Re)!=="svelte-2bgrwg"&&(Re.innerHTML=Xn),ve=r(Ue),sn=p(Ue,"P",{"data-svelte-h":!0}),m(sn)!=="svelte-1be7e3c"&&(sn.innerHTML=se),Vt=r(Ue),_(V.$$.fragment,Ue),Mt=r(Ue),S=p(Ue,"DIV",{class:!0});var rt=R(S);_(qe.$$.fragment,rt),Gn=r(rt),on=p(rt,"P",{"data-svelte-h":!0}),m(on)!=="svelte-61rxnt"&&(on.innerHTML=Ln),gn=r(rt),_(at.$$.fragment,rt),Et=r(rt),_(an.$$.fragment,rt),te=r(rt),_(Ne.$$.fragment,rt),rt.forEach(i),Ue.forEach(i),Vn=r(h),_(pe.$$.fragment,h),Ct=r(h),Fe=p(h,"DIV",{class:!0});var it=R(Fe);_(Oe.$$.fragment,it),Jt=r(it),zt=p(it,"P",{"data-svelte-h":!0}),m(zt)!=="svelte-zfb4ky"&&(zt.innerHTML=He),Ut=r(it),Dt=p(it,"P",{"data-svelte-h":!0}),m(Dt)!=="svelte-2bgrwg"&&(Dt.innerHTML=xn),$=r(it),C=p(it,"P",{"data-svelte-h":!0}),m(C)!=="svelte-1be7e3c"&&(C.innerHTML=ge),Ke=r(it),_(de.$$.fragment,it),me=r(it),W=p(it,"DIV",{class:!0});var Q=R(W);_(oe.$$.fragment,Q),Le=r(Q),_e=p(Q,"P",{"data-svelte-h":!0}),m(_e)!=="svelte-1cvwhp3"&&(_e.innerHTML=Qt),ne=r(Q),_(Y.$$.fragment,Q),es=r(Q),_(Wt.$$.fragment,Q),ts=r(Q),_(En.$$.fragment,Q),Q.forEach(i),it.forEach(i),this.h()},h(){G(Ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(n,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(h,F){b(e,h,F),d(h,u,F),d(h,n,F),b(s,n,null),l(n,w),l(n,t),l(n,ae),l(n,Z),l(n,O),l(n,D),l(n,K),b(f,n,null),l(n,j),l(n,Ee),b(Me,Ee,null),l(Ee,ns),l(Ee,ln),l(Ee,_n),b(De,Ee,null),l(Ee,pt),b(tt,Ee,null),d(h,It,F),b(P,h,F),d(h,Gt,F),d(h,E,F),b(nt,E,null),l(E,wt),l(E,bn),l(E,kt),l(E,Jn),l(E,zn),l(E,dn),l(E,Un),b(qt,E,null),l(E,Qe),l(E,mt),b(At,mt,null),l(mt,je),l(mt,Tn),l(mt,Mn),b(st,mt,null),l(mt,Pt),b(H,mt,null),l(mt,Ce),b(cn,mt,null),d(h,ht,F),b(Nt,h,F),d(h,Dn,F),d(h,L,F),b(Wn,L,null),l(L,Ht),l(L,We),l(L,Yt),l(L,N),l(L,pn),l(L,Se),l(L,An),b(ye,L,null),l(L,wn),l(L,ie),b(Ze,ie,null),l(ie,kn),l(ie,Ot),l(ie,Hn),b(A,ie,null),l(ie,Lt),b(Kt,ie,null),l(ie,$t),b(Je,ie,null),d(h,Xt,F),b(Ie,h,F),d(h,Zn,F),d(h,we,F),b(Ge,we,null),l(we,$n),l(we,mn),l(we,un),l(we,gt),l(we,ke),l(we,_t),l(we,In),b(Pe,we,null),l(we,en),l(we,fe),b(tn,fe,null),l(fe,ce),l(fe,ot),l(fe,xt),b(Tt,fe,null),l(fe,vn),b(Bt,fe,null),d(h,hn,F),b(Ft,h,F),d(h,nn,F),d(h,X,F),b(jt,X,null),l(X,Ye),l(X,$e),l(X,fn),l(X,Re),l(X,ve),l(X,sn),l(X,Vt),b(V,X,null),l(X,Mt),l(X,S),b(qe,S,null),l(S,Gn),l(S,on),l(S,gn),b(at,S,null),l(S,Et),b(an,S,null),l(S,te),b(Ne,S,null),d(h,Vn,F),b(pe,h,F),d(h,Ct,F),d(h,Fe,F),b(Oe,Fe,null),l(Fe,Jt),l(Fe,zt),l(Fe,Ut),l(Fe,Dt),l(Fe,$),l(Fe,C),l(Fe,Ke),b(de,Fe,null),l(Fe,me),l(Fe,W),b(oe,W,null),l(W,Le),l(W,_e),l(W,ne),b(Y,W,null),l(W,es),b(Wt,W,null),l(W,ts),b(En,W,null),Rn=!0},p(h,F){const Bn={};F&2&&(Bn.$$scope={dirty:F,ctx:h}),f.$set(Bn);const Xe={};F&2&&(Xe.$$scope={dirty:F,ctx:h}),De.$set(Xe);const et={};F&2&&(et.$$scope={dirty:F,ctx:h}),tt.$set(et);const ze={};F&2&&(ze.$$scope={dirty:F,ctx:h}),qt.$set(ze);const be={};F&2&&(be.$$scope={dirty:F,ctx:h}),st.$set(be);const Te={};F&2&&(Te.$$scope={dirty:F,ctx:h}),H.$set(Te);const Fn={};F&2&&(Fn.$$scope={dirty:F,ctx:h}),cn.$set(Fn);const Ue={};F&2&&(Ue.$$scope={dirty:F,ctx:h}),ye.$set(Ue);const rt={};F&2&&(rt.$$scope={dirty:F,ctx:h}),A.$set(rt);const it={};F&2&&(it.$$scope={dirty:F,ctx:h}),Kt.$set(it);const Q={};F&2&&(Q.$$scope={dirty:F,ctx:h}),Je.$set(Q);const Yn={};F&2&&(Yn.$$scope={dirty:F,ctx:h}),Pe.$set(Yn);const Qn={};F&2&&(Qn.$$scope={dirty:F,ctx:h}),Tt.$set(Qn);const On={};F&2&&(On.$$scope={dirty:F,ctx:h}),Bt.$set(On);const v={};F&2&&(v.$$scope={dirty:F,ctx:h}),V.$set(v);const J={};F&2&&(J.$$scope={dirty:F,ctx:h}),at.$set(J);const St={};F&2&&(St.$$scope={dirty:F,ctx:h}),an.$set(St);const yt={};F&2&&(yt.$$scope={dirty:F,ctx:h}),Ne.$set(yt);const jn={};F&2&&(jn.$$scope={dirty:F,ctx:h}),de.$set(jn);const ue={};F&2&&(ue.$$scope={dirty:F,ctx:h}),Y.$set(ue);const Zt={};F&2&&(Zt.$$scope={dirty:F,ctx:h}),Wt.$set(Zt);const lt={};F&2&&(lt.$$scope={dirty:F,ctx:h}),En.$set(lt)},i(h){Rn||(T(e.$$.fragment,h),T(s.$$.fragment,h),T(f.$$.fragment,h),T(Me.$$.fragment,h),T(De.$$.fragment,h),T(tt.$$.fragment,h),T(P.$$.fragment,h),T(nt.$$.fragment,h),T(qt.$$.fragment,h),T(At.$$.fragment,h),T(st.$$.fragment,h),T(H.$$.fragment,h),T(cn.$$.fragment,h),T(Nt.$$.fragment,h),T(Wn.$$.fragment,h),T(ye.$$.fragment,h),T(Ze.$$.fragment,h),T(A.$$.fragment,h),T(Kt.$$.fragment,h),T(Je.$$.fragment,h),T(Ie.$$.fragment,h),T(Ge.$$.fragment,h),T(Pe.$$.fragment,h),T(tn.$$.fragment,h),T(Tt.$$.fragment,h),T(Bt.$$.fragment,h),T(Ft.$$.fragment,h),T(jt.$$.fragment,h),T(V.$$.fragment,h),T(qe.$$.fragment,h),T(at.$$.fragment,h),T(an.$$.fragment,h),T(Ne.$$.fragment,h),T(pe.$$.fragment,h),T(Oe.$$.fragment,h),T(de.$$.fragment,h),T(oe.$$.fragment,h),T(Y.$$.fragment,h),T(Wt.$$.fragment,h),T(En.$$.fragment,h),Rn=!0)},o(h){M(e.$$.fragment,h),M(s.$$.fragment,h),M(f.$$.fragment,h),M(Me.$$.fragment,h),M(De.$$.fragment,h),M(tt.$$.fragment,h),M(P.$$.fragment,h),M(nt.$$.fragment,h),M(qt.$$.fragment,h),M(At.$$.fragment,h),M(st.$$.fragment,h),M(H.$$.fragment,h),M(cn.$$.fragment,h),M(Nt.$$.fragment,h),M(Wn.$$.fragment,h),M(ye.$$.fragment,h),M(Ze.$$.fragment,h),M(A.$$.fragment,h),M(Kt.$$.fragment,h),M(Je.$$.fragment,h),M(Ie.$$.fragment,h),M(Ge.$$.fragment,h),M(Pe.$$.fragment,h),M(tn.$$.fragment,h),M(Tt.$$.fragment,h),M(Bt.$$.fragment,h),M(Ft.$$.fragment,h),M(jt.$$.fragment,h),M(V.$$.fragment,h),M(qe.$$.fragment,h),M(at.$$.fragment,h),M(an.$$.fragment,h),M(Ne.$$.fragment,h),M(pe.$$.fragment,h),M(Oe.$$.fragment,h),M(de.$$.fragment,h),M(oe.$$.fragment,h),M(Y.$$.fragment,h),M(Wt.$$.fragment,h),M(En.$$.fragment,h),Rn=!1},d(h){h&&(i(u),i(n),i(It),i(Gt),i(E),i(ht),i(Dn),i(L),i(Xt),i(Zn),i(we),i(hn),i(nn),i(X),i(Vn),i(Ct),i(Fe)),y(e,h),y(s),y(f),y(Me),y(De),y(tt),y(P,h),y(nt),y(qt),y(At),y(st),y(H),y(cn),y(Nt,h),y(Wn),y(ye),y(Ze),y(A),y(Kt),y(Je),y(Ie,h),y(Ge),y(Pe),y(tn),y(Tt),y(Bt),y(Ft,h),y(jt),y(V),y(qe),y(at),y(an),y(Ne),y(pe,h),y(Oe),y(de),y(oe),y(Y),y(Wt),y(En)}}}function Bo(B){let e,u;return e=new js({props:{$$slots:{default:[xo]},$$scope:{ctx:B}}}),{c(){g(e.$$.fragment)},l(n){_(e.$$.fragment,n)},m(n,s){b(e,n,s),u=!0},p(n,s){const w={};s&2&&(w.$$scope={dirty:s,ctx:n}),e.$set(w)},i(n){u||(T(e.$$.fragment,n),u=!0)},o(n){M(e.$$.fragment,n),u=!1},d(n){y(e,n)}}}function Fo(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function jo(B){let e,u="Example:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF4RGlzdGlsQmVydE1vZGVsJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBGbGF4RGlzdGlsQmVydE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIyamF4JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaxDistilBertModel | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = FlaxDistilBertModel.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"jax"</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>last_hidden_states = outputs.last_hidden_state`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-11lpom8"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function Co(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function Jo(B){let e,u="Example:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF4RGlzdGlsQmVydEZvck1hc2tlZExNJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBGbGF4RGlzdGlsQmVydEZvck1hc2tlZExNLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIyVGhlJTIwY2FwaXRhbCUyMG9mJTIwRnJhbmNlJTIwaXMlMjAlNUJNQVNLJTVELiUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIyamF4JTIyKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaxDistilBertForMaskedLM | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = FlaxDistilBertForMaskedLM.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"The capital of France is [MASK]."</span>, return_tensors=<span class="hljs-string">"jax"</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>logits = outputs.logits`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-11lpom8"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function zo(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function Uo(B){let e,u="Example:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF4RGlzdGlsQmVydEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMEZsYXhEaXN0aWxCZXJ0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMmpheCUyMiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHM=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaxDistilBertForSequenceClassification | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = FlaxDistilBertForSequenceClassification.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"jax"</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>logits = outputs.logits`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-11lpom8"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function Do(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function Wo(B){let e,u="Example:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF4RGlzdGlsQmVydEZvck11bHRpcGxlQ2hvaWNlJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBGbGF4RGlzdGlsQmVydEZvck11bHRpcGxlQ2hvaWNlLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJJbiUyMEl0YWx5JTJDJTIwcGl6emElMjBzZXJ2ZWQlMjBpbiUyMGZvcm1hbCUyMHNldHRpbmdzJTJDJTIwc3VjaCUyMGFzJTIwYXQlMjBhJTIwcmVzdGF1cmFudCUyQyUyMGlzJTIwcHJlc2VudGVkJTIwdW5zbGljZWQuJTIyJTBBY2hvaWNlMCUyMCUzRCUyMCUyMkl0JTIwaXMlMjBlYXRlbiUyMHdpdGglMjBhJTIwZm9yayUyMGFuZCUyMGElMjBrbmlmZS4lMjIlMEFjaG9pY2UxJTIwJTNEJTIwJTIySXQlMjBpcyUyMGVhdGVuJTIwd2hpbGUlMjBoZWxkJTIwaW4lMjB0aGUlMjBoYW5kLiUyMiUwQSUwQWVuY29kaW5nJTIwJTNEJTIwdG9rZW5pemVyKCU1QnByb21wdCUyQyUyMHByb21wdCU1RCUyQyUyMCU1QmNob2ljZTAlMkMlMjBjaG9pY2UxJTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJqYXglMjIlMkMlMjBwYWRkaW5nJTNEVHJ1ZSklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKiolN0JrJTNBJTIwdiU1Qk5vbmUlMkMlMjAlM0ElNUQlMjBmb3IlMjBrJTJDJTIwdiUyMGluJTIwZW5jb2RpbmcuaXRlbXMoKSU3RCklMEElMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaxDistilBertForMultipleChoice | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = FlaxDistilBertForMultipleChoice.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>prompt = <span class="hljs-string">"In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced."</span> | |
| <span class="hljs-meta">>>> </span>choice0 = <span class="hljs-string">"It is eaten with a fork and a knife."</span> | |
| <span class="hljs-meta">>>> </span>choice1 = <span class="hljs-string">"It is eaten while held in the hand."</span> | |
| <span class="hljs-meta">>>> </span>encoding = tokenizer([prompt, prompt], [choice0, choice1], return_tensors=<span class="hljs-string">"jax"</span>, padding=<span class="hljs-literal">True</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**{k: v[<span class="hljs-literal">None</span>, :] <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> encoding.items()}) | |
| <span class="hljs-meta">>>> </span>logits = outputs.logits`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-11lpom8"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function Zo(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function Io(B){let e,u="Example:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF4RGlzdGlsQmVydEZvclRva2VuQ2xhc3NpZmljYXRpb24lMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMEZsYXhEaXN0aWxCZXJ0Rm9yVG9rZW5DbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMmpheCUyMiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHM=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaxDistilBertForTokenClassification | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = FlaxDistilBertForTokenClassification.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"jax"</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>logits = outputs.logits`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-11lpom8"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function Go(B){let e,u=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=u},l(n){e=p(n,"P",{"data-svelte-h":!0}),m(e)!=="svelte-fincs2"&&(e.innerHTML=u)},m(n,s){d(n,e,s)},p:I,d(n){n&&i(e)}}}function Ro(B){let e,u="Example:",n,s,w;return s=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF4RGlzdGlsQmVydEZvclF1ZXN0aW9uQW5zd2VyaW5nJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBGbGF4RGlzdGlsQmVydEZvclF1ZXN0aW9uQW5zd2VyaW5nLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEElMEFxdWVzdGlvbiUyQyUyMHRleHQlMjAlM0QlMjAlMjJXaG8lMjB3YXMlMjBKaW0lMjBIZW5zb24lM0YlMjIlMkMlMjAlMjJKaW0lMjBIZW5zb24lMjB3YXMlMjBhJTIwbmljZSUyMHB1cHBldCUyMiUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihxdWVzdGlvbiUyQyUyMHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMmpheCUyMiklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBc3RhcnRfc2NvcmVzJTIwJTNEJTIwb3V0cHV0cy5zdGFydF9sb2dpdHMlMEFlbmRfc2NvcmVzJTIwJTNEJTIwb3V0cHV0cy5lbmRfbG9naXRz",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaxDistilBertForQuestionAnswering | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>model = FlaxDistilBertForQuestionAnswering.from_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>) | |
| <span class="hljs-meta">>>> </span>question, text = <span class="hljs-string">"Who was Jim Henson?"</span>, <span class="hljs-string">"Jim Henson was a nice puppet"</span> | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(question, text, return_tensors=<span class="hljs-string">"jax"</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>start_scores = outputs.start_logits | |
| <span class="hljs-meta">>>> </span>end_scores = outputs.end_logits`,wrap:!1}}),{c(){e=c("p"),e.textContent=u,n=a(),g(s.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),m(e)!=="svelte-11lpom8"&&(e.textContent=u),n=r(t),_(s.$$.fragment,t)},m(t,k){d(t,e,k),d(t,n,k),b(s,t,k),w=!0},p:I,i(t){w||(T(s.$$.fragment,t),w=!0)},o(t){M(s.$$.fragment,t),w=!1},d(t){t&&(i(e),i(n)),y(s,t)}}}function qo(B){let e,u,n,s,w,t,k="The bare DistilBert Model transformer outputting raw hidden-states without any specific head on top.",ae,Z,z=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.FlaxPreTrainedModel">FlaxPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading, saving and converting weights from PyTorch models)`,O,D,U=`This model is also a | |
| <a href="https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html" rel="nofollow">flax.linen.Module</a> subclass. Use it as | |
| a regular Flax linen Module and refer to the Flax documentation for all matter related to general usage and | |
| behavior.`,K,f,j="Finally, this model supports inherent JAX features such as:",Ee,Me,ns='<li><a href="https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit" rel="nofollow">Just-In-Time (JIT) compilation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation" rel="nofollow">Automatic Differentiation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap" rel="nofollow">Vectorization</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap" rel="nofollow">Parallelization</a></li>',ln,re,_n,De,pt,tt="The <code>FlaxDistilBertPreTrainedModel</code> forward method, overrides the <code>__call__</code> special method.",It,P,Gt,E,nt,wt,bn,ee,kt,Jn,Rt,zn="DistilBert Model with a <code>language modeling</code> head on top.",dn,he,Un=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.FlaxPreTrainedModel">FlaxPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading, saving and converting weights from PyTorch models)`,qt,Qe,mt=`This model is also a | |
| <a href="https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html" rel="nofollow">flax.linen.Module</a> subclass. Use it as | |
| a regular Flax linen Module and refer to the Flax documentation for all matter related to general usage and | |
| behavior.`,At,je,Tn="Finally, this model supports inherent JAX features such as:",ut,Mn,st='<li><a href="https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit" rel="nofollow">Just-In-Time (JIT) compilation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation" rel="nofollow">Automatic Differentiation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap" rel="nofollow">Vectorization</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap" rel="nofollow">Parallelization</a></li>',Pt,H,Ce,cn,ht,Nt="The <code>FlaxDistilBertPreTrainedModel</code> forward method, overrides the <code>__call__</code> special method.",Dn,L,Wn,Ht,We,yn,Yt,N,ft,pn,Se,Nn=`DistilBert Model transformer with a sequence classification/regression head on top (a linear layer on top of the | |
| pooled output) e.g. for GLUE tasks.`,An,ye,wn=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.FlaxPreTrainedModel">FlaxPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading, saving and converting weights from PyTorch models)`,ie,Ze,kn=`This model is also a | |
| <a href="https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html" rel="nofollow">flax.linen.Module</a> subclass. Use it as | |
| a regular Flax linen Module and refer to the Flax documentation for all matter related to general usage and | |
| behavior.`,Ot,Ae,Hn="Finally, this model supports inherent JAX features such as:",A,Lt,Kt='<li><a href="https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit" rel="nofollow">Just-In-Time (JIT) compilation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation" rel="nofollow">Automatic Differentiation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap" rel="nofollow">Vectorization</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap" rel="nofollow">Parallelization</a></li>',$t,Je,Xt,Ie,Zn,we="The <code>FlaxDistilBertPreTrainedModel</code> forward method, overrides the <code>__call__</code> special method.",Ge,$n,mn,le,un,gt,vt,ke,_t,bt,In,Pe=`DistilBert Model with a multiple choice classification head on top (a linear layer on top of the pooled output and | |
| a softmax) e.g. for RocStories/SWAG tasks.`,en,fe,tn=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.FlaxPreTrainedModel">FlaxPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading, saving and converting weights from PyTorch models)`,ce,ot,Pn=`This model is also a | |
| <a href="https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html" rel="nofollow">flax.linen.Module</a> subclass. Use it as | |
| a regular Flax linen Module and refer to the Flax documentation for all matter related to general usage and | |
| behavior.`,xt,Tt,vn="Finally, this model supports inherent JAX features such as:",Bt,hn,Ft='<li><a href="https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit" rel="nofollow">Just-In-Time (JIT) compilation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation" rel="nofollow">Automatic Differentiation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap" rel="nofollow">Vectorization</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap" rel="nofollow">Parallelization</a></li>',nn,X,jt,Ye,$e,ss="The <code>FlaxDistilBertPreTrainedModel</code> forward method, overrides the <code>__call__</code> special method.",fn,Re,Xn,ve,sn,se,Vt,V,Mt,S,qe,Gn=`DistilBert Model with a token classification head on top (a linear layer on top of the hidden-states output) e.g. | |
| for Named-Entity-Recognition (NER) tasks.`,on,Ln,gn=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.FlaxPreTrainedModel">FlaxPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading, saving and converting weights from PyTorch models)`,at,Et,an=`This model is also a | |
| <a href="https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html" rel="nofollow">flax.linen.Module</a> subclass. Use it as | |
| a regular Flax linen Module and refer to the Flax documentation for all matter related to general usage and | |
| behavior.`,te,Ne,Vn="Finally, this model supports inherent JAX features such as:",pe,Ct,Fe='<li><a href="https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit" rel="nofollow">Just-In-Time (JIT) compilation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation" rel="nofollow">Automatic Differentiation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap" rel="nofollow">Vectorization</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap" rel="nofollow">Parallelization</a></li>',Oe,Jt,zt,He,Ut,Dt="The <code>FlaxDistilBertPreTrainedModel</code> forward method, overrides the <code>__call__</code> special method.",xn,$,C,ge,Ke,de,me,W,oe,Le,_e,Qt=`DistilBert Model with a span classification head on top for extractive question-answering tasks like SQuAD (a | |
| linear layers on top of the hidden-states output to compute <code>span start logits</code> and <code>span end logits</code>).`,ne,Y,es=`This model inherits from <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.FlaxPreTrainedModel">FlaxPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading, saving and converting weights from PyTorch models)`,Wt,ts,En=`This model is also a | |
| <a href="https://flax.readthedocs.io/en/latest/api_reference/flax.linen/module.html" rel="nofollow">flax.linen.Module</a> subclass. Use it as | |
| a regular Flax linen Module and refer to the Flax documentation for all matter related to general usage and | |
| behavior.`,Rn,h,F="Finally, this model supports inherent JAX features such as:",Bn,Xe,et='<li><a href="https://jax.readthedocs.io/en/latest/jax.html#just-in-time-compilation-jit" rel="nofollow">Just-In-Time (JIT) compilation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#automatic-differentiation" rel="nofollow">Automatic Differentiation</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#vectorization-vmap" rel="nofollow">Vectorization</a></li> <li><a href="https://jax.readthedocs.io/en/latest/jax.html#parallelization-pmap" rel="nofollow">Parallelization</a></li>',ze,be,Te,Fn,Ue,rt="The <code>FlaxDistilBertPreTrainedModel</code> forward method, overrides the <code>__call__</code> special method.",it,Q,Yn,Qn,On;return e=new xe({props:{title:"FlaxDistilBertModel",local:"transformers.FlaxDistilBertModel",headingTag:"h2"}}),s=new q({props:{name:"class transformers.FlaxDistilBertModel",anchor:"transformers.FlaxDistilBertModel",parameters:[{name:"config",val:": DistilBertConfig"},{name:"input_shape",val:": typing.Tuple = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxDistilBertModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_flax_distilbert.py#L529"}}),_n=new q({props:{name:"__call__",anchor:"transformers.FlaxDistilBertModel.__call__",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"head_mask",val:" = None"},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": <function PRNGKey at 0x7f9821cca5f0> = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.FlaxDistilBertModel.__call__.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FlaxDistilBertModel.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.FlaxDistilBertModel.__call__.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.FlaxDistilBertModel.__call__.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail.`,name:"output_hidden_states"},{anchor:"transformers.FlaxDistilBertModel.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_flax_distilbert.py#L456"}}),P=new ct({props:{$$slots:{default:[Fo]},$$scope:{ctx:B}}}),E=new Ve({props:{anchor:"transformers.FlaxDistilBertModel.__call__.example",$$slots:{default:[jo]},$$scope:{ctx:B}}}),wt=new xe({props:{title:"FlaxDistilBertForMaskedLM",local:"transformers.FlaxDistilBertForMaskedLM",headingTag:"h2"}}),kt=new q({props:{name:"class transformers.FlaxDistilBertForMaskedLM",anchor:"transformers.FlaxDistilBertForMaskedLM",parameters:[{name:"config",val:": DistilBertConfig"},{name:"input_shape",val:": typing.Tuple = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxDistilBertForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_flax_distilbert.py#L605"}}),Ce=new q({props:{name:"__call__",anchor:"transformers.FlaxDistilBertForMaskedLM.__call__",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"head_mask",val:" = None"},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": <function PRNGKey at 0x7f9821cca5f0> = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.FlaxDistilBertForMaskedLM.__call__.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FlaxDistilBertForMaskedLM.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.FlaxDistilBertForMaskedLM.__call__.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.FlaxDistilBertForMaskedLM.__call__.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail.`,name:"output_hidden_states"},{anchor:"transformers.FlaxDistilBertForMaskedLM.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_flax_distilbert.py#L456",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_flax_outputs.FlaxMaskedLMOutput" | |
| >transformers.modeling_flax_outputs.FlaxMaskedLMOutput</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>logits</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>jnp.ndarray</code> (one for the output of the embeddings + one for the output of each layer) of shape | |
| <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>jnp.ndarray</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_flax_outputs.FlaxMaskedLMOutput" | |
| >transformers.modeling_flax_outputs.FlaxMaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),L=new ct({props:{$$slots:{default:[Co]},$$scope:{ctx:B}}}),Ht=new Ve({props:{anchor:"transformers.FlaxDistilBertForMaskedLM.__call__.example",$$slots:{default:[Jo]},$$scope:{ctx:B}}}),yn=new xe({props:{title:"FlaxDistilBertForSequenceClassification",local:"transformers.FlaxDistilBertForSequenceClassification",headingTag:"h2"}}),ft=new q({props:{name:"class transformers.FlaxDistilBertForSequenceClassification",anchor:"transformers.FlaxDistilBertForSequenceClassification",parameters:[{name:"config",val:": DistilBertConfig"},{name:"input_shape",val:": typing.Tuple = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxDistilBertForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_flax_distilbert.py#L666"}}),Xt=new q({props:{name:"__call__",anchor:"transformers.FlaxDistilBertForSequenceClassification.__call__",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"head_mask",val:" = None"},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": <function PRNGKey at 0x7f9821cca5f0> = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.FlaxDistilBertForSequenceClassification.__call__.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FlaxDistilBertForSequenceClassification.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.FlaxDistilBertForSequenceClassification.__call__.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.FlaxDistilBertForSequenceClassification.__call__.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail.`,name:"output_hidden_states"},{anchor:"transformers.FlaxDistilBertForSequenceClassification.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_flax_distilbert.py#L456",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput" | |
| >transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>logits</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, config.num_labels)</code>) — Classification (or regression if config.num_labels==1) scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>jnp.ndarray</code> (one for the output of the embeddings + one for the output of each layer) of shape | |
| <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>jnp.ndarray</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput" | |
| >transformers.modeling_flax_outputs.FlaxSequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),$n=new ct({props:{$$slots:{default:[zo]},$$scope:{ctx:B}}}),le=new Ve({props:{anchor:"transformers.FlaxDistilBertForSequenceClassification.__call__.example",$$slots:{default:[Uo]},$$scope:{ctx:B}}}),gt=new xe({props:{title:"FlaxDistilBertForMultipleChoice",local:"transformers.FlaxDistilBertForMultipleChoice",headingTag:"h2"}}),_t=new q({props:{name:"class transformers.FlaxDistilBertForMultipleChoice",anchor:"transformers.FlaxDistilBertForMultipleChoice",parameters:[{name:"config",val:": DistilBertConfig"},{name:"input_shape",val:": typing.Tuple = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxDistilBertForMultipleChoice.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_flax_distilbert.py#L745"}}),jt=new q({props:{name:"__call__",anchor:"transformers.FlaxDistilBertForMultipleChoice.__call__",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"head_mask",val:" = None"},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": <function PRNGKey at 0x7f9821cca5f0> = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.FlaxDistilBertForMultipleChoice.__call__.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, num_choices, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FlaxDistilBertForMultipleChoice.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.FlaxDistilBertForMultipleChoice.__call__.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.FlaxDistilBertForMultipleChoice.__call__.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail.`,name:"output_hidden_states"},{anchor:"transformers.FlaxDistilBertForMultipleChoice.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_flax_distilbert.py#L456",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_flax_outputs.FlaxMultipleChoiceModelOutput" | |
| >transformers.modeling_flax_outputs.FlaxMultipleChoiceModelOutput</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>logits</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, num_choices)</code>) — <em>num_choices</em> is the second dimension of the input tensors. (see <em>input_ids</em> above).</p> | |
| <p>Classification scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>jnp.ndarray</code> (one for the output of the embeddings + one for the output of each layer) of shape | |
| <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>jnp.ndarray</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_flax_outputs.FlaxMultipleChoiceModelOutput" | |
| >transformers.modeling_flax_outputs.FlaxMultipleChoiceModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),Re=new ct({props:{$$slots:{default:[Do]},$$scope:{ctx:B}}}),ve=new Ve({props:{anchor:"transformers.FlaxDistilBertForMultipleChoice.__call__.example",$$slots:{default:[Wo]},$$scope:{ctx:B}}}),se=new xe({props:{title:"FlaxDistilBertForTokenClassification",local:"transformers.FlaxDistilBertForTokenClassification",headingTag:"h2"}}),Mt=new q({props:{name:"class transformers.FlaxDistilBertForTokenClassification",anchor:"transformers.FlaxDistilBertForTokenClassification",parameters:[{name:"config",val:": DistilBertConfig"},{name:"input_shape",val:": typing.Tuple = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxDistilBertForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_flax_distilbert.py#L810"}}),zt=new q({props:{name:"__call__",anchor:"transformers.FlaxDistilBertForTokenClassification.__call__",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"head_mask",val:" = None"},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": <function PRNGKey at 0x7f9821cca5f0> = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.FlaxDistilBertForTokenClassification.__call__.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FlaxDistilBertForTokenClassification.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.FlaxDistilBertForTokenClassification.__call__.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.FlaxDistilBertForTokenClassification.__call__.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail.`,name:"output_hidden_states"},{anchor:"transformers.FlaxDistilBertForTokenClassification.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_flax_distilbert.py#L456",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_flax_outputs.FlaxTokenClassifierOutput" | |
| >transformers.modeling_flax_outputs.FlaxTokenClassifierOutput</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>logits</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) — Classification scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>jnp.ndarray</code> (one for the output of the embeddings + one for the output of each layer) of shape | |
| <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>jnp.ndarray</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_flax_outputs.FlaxTokenClassifierOutput" | |
| >transformers.modeling_flax_outputs.FlaxTokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),$=new ct({props:{$$slots:{default:[Zo]},$$scope:{ctx:B}}}),ge=new Ve({props:{anchor:"transformers.FlaxDistilBertForTokenClassification.__call__.example",$$slots:{default:[Io]},$$scope:{ctx:B}}}),de=new xe({props:{title:"FlaxDistilBertForQuestionAnswering",local:"transformers.FlaxDistilBertForQuestionAnswering",headingTag:"h2"}}),oe=new q({props:{name:"class transformers.FlaxDistilBertForQuestionAnswering",anchor:"transformers.FlaxDistilBertForQuestionAnswering",parameters:[{name:"config",val:": DistilBertConfig"},{name:"input_shape",val:": typing.Tuple = (1, 1)"},{name:"seed",val:": int = 0"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"},{name:"_do_init",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaxDistilBertForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig">DistilBertConfig</a>) — Model configuration class with all the parameters of the model. | |
| Initializing with a config file does not load the weights associated with the model, only the | |
| configuration. Check out the <a href="/docs/transformers/pr_34652/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_flax_distilbert.py#L879"}}),Te=new q({props:{name:"__call__",anchor:"transformers.FlaxDistilBertForQuestionAnswering.__call__",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"head_mask",val:" = None"},{name:"params",val:": dict = None"},{name:"dropout_rng",val:": <function PRNGKey at 0x7f9821cca5f0> = None"},{name:"train",val:": bool = False"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.FlaxDistilBertForQuestionAnswering.__call__.input_ids",description:`<strong>input_ids</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_34652/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_34652/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FlaxDistilBertForQuestionAnswering.__call__.attention_mask",description:`<strong>attention_mask</strong> (<code>numpy.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li>1 for tokens that are <strong>not masked</strong>,</li> | |
| <li>0 for tokens that are <strong>masked</strong>.</li> | |
| </ul> | |
| <p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.FlaxDistilBertForQuestionAnswering.__call__.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.FlaxDistilBertForQuestionAnswering.__call__.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail.`,name:"output_hidden_states"},{anchor:"transformers.FlaxDistilBertForQuestionAnswering.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_34652/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/modeling_flax_distilbert.py#L456",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_flax_outputs.FlaxQuestionAnsweringModelOutput" | |
| >transformers.modeling_flax_outputs.FlaxQuestionAnsweringModelOutput</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertConfig" | |
| >DistilBertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>start_logits</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length)</code>) — Span-start scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>end_logits</strong> (<code>jnp.ndarray</code> of shape <code>(batch_size, sequence_length)</code>) — Span-end scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>jnp.ndarray</code> (one for the output of the embeddings + one for the output of each layer) of shape | |
| <code>(batch_size, sequence_length, hidden_size)</code>.</p> | |
| <p>Hidden-states of the model at the output of each layer plus the initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(jnp.ndarray)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>jnp.ndarray</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p> | |
| <p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention | |
| heads.</p> | |
| </li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_34652/en/main_classes/output#transformers.modeling_flax_outputs.FlaxQuestionAnsweringModelOutput" | |
| >transformers.modeling_flax_outputs.FlaxQuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),Q=new ct({props:{$$slots:{default:[Go]},$$scope:{ctx:B}}}),Qn=new Ve({props:{anchor:"transformers.FlaxDistilBertForQuestionAnswering.__call__.example",$$slots:{default:[Ro]},$$scope:{ctx:B}}}),{c(){g(e.$$.fragment),u=a(),n=c("div"),g(s.$$.fragment),w=a(),t=c("p"),t.textContent=k,ae=a(),Z=c("p"),Z.innerHTML=z,O=a(),D=c("p"),D.innerHTML=U,K=a(),f=c("p"),f.textContent=j,Ee=a(),Me=c("ul"),Me.innerHTML=ns,ln=a(),re=c("div"),g(_n.$$.fragment),De=a(),pt=c("p"),pt.innerHTML=tt,It=a(),g(P.$$.fragment),Gt=a(),g(E.$$.fragment),nt=a(),g(wt.$$.fragment),bn=a(),ee=c("div"),g(kt.$$.fragment),Jn=a(),Rt=c("p"),Rt.innerHTML=zn,dn=a(),he=c("p"),he.innerHTML=Un,qt=a(),Qe=c("p"),Qe.innerHTML=mt,At=a(),je=c("p"),je.textContent=Tn,ut=a(),Mn=c("ul"),Mn.innerHTML=st,Pt=a(),H=c("div"),g(Ce.$$.fragment),cn=a(),ht=c("p"),ht.innerHTML=Nt,Dn=a(),g(L.$$.fragment),Wn=a(),g(Ht.$$.fragment),We=a(),g(yn.$$.fragment),Yt=a(),N=c("div"),g(ft.$$.fragment),pn=a(),Se=c("p"),Se.textContent=Nn,An=a(),ye=c("p"),ye.innerHTML=wn,ie=a(),Ze=c("p"),Ze.innerHTML=kn,Ot=a(),Ae=c("p"),Ae.textContent=Hn,A=a(),Lt=c("ul"),Lt.innerHTML=Kt,$t=a(),Je=c("div"),g(Xt.$$.fragment),Ie=a(),Zn=c("p"),Zn.innerHTML=we,Ge=a(),g($n.$$.fragment),mn=a(),g(le.$$.fragment),un=a(),g(gt.$$.fragment),vt=a(),ke=c("div"),g(_t.$$.fragment),bt=a(),In=c("p"),In.textContent=Pe,en=a(),fe=c("p"),fe.innerHTML=tn,ce=a(),ot=c("p"),ot.innerHTML=Pn,xt=a(),Tt=c("p"),Tt.textContent=vn,Bt=a(),hn=c("ul"),hn.innerHTML=Ft,nn=a(),X=c("div"),g(jt.$$.fragment),Ye=a(),$e=c("p"),$e.innerHTML=ss,fn=a(),g(Re.$$.fragment),Xn=a(),g(ve.$$.fragment),sn=a(),g(se.$$.fragment),Vt=a(),V=c("div"),g(Mt.$$.fragment),S=a(),qe=c("p"),qe.textContent=Gn,on=a(),Ln=c("p"),Ln.innerHTML=gn,at=a(),Et=c("p"),Et.innerHTML=an,te=a(),Ne=c("p"),Ne.textContent=Vn,pe=a(),Ct=c("ul"),Ct.innerHTML=Fe,Oe=a(),Jt=c("div"),g(zt.$$.fragment),He=a(),Ut=c("p"),Ut.innerHTML=Dt,xn=a(),g($.$$.fragment),C=a(),g(ge.$$.fragment),Ke=a(),g(de.$$.fragment),me=a(),W=c("div"),g(oe.$$.fragment),Le=a(),_e=c("p"),_e.innerHTML=Qt,ne=a(),Y=c("p"),Y.innerHTML=es,Wt=a(),ts=c("p"),ts.innerHTML=En,Rn=a(),h=c("p"),h.textContent=F,Bn=a(),Xe=c("ul"),Xe.innerHTML=et,ze=a(),be=c("div"),g(Te.$$.fragment),Fn=a(),Ue=c("p"),Ue.innerHTML=rt,it=a(),g(Q.$$.fragment),Yn=a(),g(Qn.$$.fragment),this.h()},l(v){_(e.$$.fragment,v),u=r(v),n=p(v,"DIV",{class:!0});var J=R(n);_(s.$$.fragment,J),w=r(J),t=p(J,"P",{"data-svelte-h":!0}),m(t)!=="svelte-3lz6al"&&(t.textContent=k),ae=r(J),Z=p(J,"P",{"data-svelte-h":!0}),m(Z)!=="svelte-129oi6l"&&(Z.innerHTML=z),O=r(J),D=p(J,"P",{"data-svelte-h":!0}),m(D)!=="svelte-10nfsf3"&&(D.innerHTML=U),K=r(J),f=p(J,"P",{"data-svelte-h":!0}),m(f)!=="svelte-1pplc4a"&&(f.textContent=j),Ee=r(J),Me=p(J,"UL",{"data-svelte-h":!0}),m(Me)!=="svelte-1w7z84m"&&(Me.innerHTML=ns),ln=r(J),re=p(J,"DIV",{class:!0});var St=R(re);_(_n.$$.fragment,St),De=r(St),pt=p(St,"P",{"data-svelte-h":!0}),m(pt)!=="svelte-16oef0h"&&(pt.innerHTML=tt),It=r(St),_(P.$$.fragment,St),Gt=r(St),_(E.$$.fragment,St),St.forEach(i),J.forEach(i),nt=r(v),_(wt.$$.fragment,v),bn=r(v),ee=p(v,"DIV",{class:!0});var yt=R(ee);_(kt.$$.fragment,yt),Jn=r(yt),Rt=p(yt,"P",{"data-svelte-h":!0}),m(Rt)!=="svelte-5bwii0"&&(Rt.innerHTML=zn),dn=r(yt),he=p(yt,"P",{"data-svelte-h":!0}),m(he)!=="svelte-129oi6l"&&(he.innerHTML=Un),qt=r(yt),Qe=p(yt,"P",{"data-svelte-h":!0}),m(Qe)!=="svelte-10nfsf3"&&(Qe.innerHTML=mt),At=r(yt),je=p(yt,"P",{"data-svelte-h":!0}),m(je)!=="svelte-1pplc4a"&&(je.textContent=Tn),ut=r(yt),Mn=p(yt,"UL",{"data-svelte-h":!0}),m(Mn)!=="svelte-1w7z84m"&&(Mn.innerHTML=st),Pt=r(yt),H=p(yt,"DIV",{class:!0});var jn=R(H);_(Ce.$$.fragment,jn),cn=r(jn),ht=p(jn,"P",{"data-svelte-h":!0}),m(ht)!=="svelte-16oef0h"&&(ht.innerHTML=Nt),Dn=r(jn),_(L.$$.fragment,jn),Wn=r(jn),_(Ht.$$.fragment,jn),jn.forEach(i),yt.forEach(i),We=r(v),_(yn.$$.fragment,v),Yt=r(v),N=p(v,"DIV",{class:!0});var ue=R(N);_(ft.$$.fragment,ue),pn=r(ue),Se=p(ue,"P",{"data-svelte-h":!0}),m(Se)!=="svelte-1kr5cyc"&&(Se.textContent=Nn),An=r(ue),ye=p(ue,"P",{"data-svelte-h":!0}),m(ye)!=="svelte-129oi6l"&&(ye.innerHTML=wn),ie=r(ue),Ze=p(ue,"P",{"data-svelte-h":!0}),m(Ze)!=="svelte-10nfsf3"&&(Ze.innerHTML=kn),Ot=r(ue),Ae=p(ue,"P",{"data-svelte-h":!0}),m(Ae)!=="svelte-1pplc4a"&&(Ae.textContent=Hn),A=r(ue),Lt=p(ue,"UL",{"data-svelte-h":!0}),m(Lt)!=="svelte-1w7z84m"&&(Lt.innerHTML=Kt),$t=r(ue),Je=p(ue,"DIV",{class:!0});var Zt=R(Je);_(Xt.$$.fragment,Zt),Ie=r(Zt),Zn=p(Zt,"P",{"data-svelte-h":!0}),m(Zn)!=="svelte-16oef0h"&&(Zn.innerHTML=we),Ge=r(Zt),_($n.$$.fragment,Zt),mn=r(Zt),_(le.$$.fragment,Zt),Zt.forEach(i),ue.forEach(i),un=r(v),_(gt.$$.fragment,v),vt=r(v),ke=p(v,"DIV",{class:!0});var lt=R(ke);_(_t.$$.fragment,lt),bt=r(lt),In=p(lt,"P",{"data-svelte-h":!0}),m(In)!=="svelte-i84iso"&&(In.textContent=Pe),en=r(lt),fe=p(lt,"P",{"data-svelte-h":!0}),m(fe)!=="svelte-129oi6l"&&(fe.innerHTML=tn),ce=r(lt),ot=p(lt,"P",{"data-svelte-h":!0}),m(ot)!=="svelte-10nfsf3"&&(ot.innerHTML=Pn),xt=r(lt),Tt=p(lt,"P",{"data-svelte-h":!0}),m(Tt)!=="svelte-1pplc4a"&&(Tt.textContent=vn),Bt=r(lt),hn=p(lt,"UL",{"data-svelte-h":!0}),m(hn)!=="svelte-1w7z84m"&&(hn.innerHTML=Ft),nn=r(lt),X=p(lt,"DIV",{class:!0});var Cn=R(X);_(jt.$$.fragment,Cn),Ye=r(Cn),$e=p(Cn,"P",{"data-svelte-h":!0}),m($e)!=="svelte-16oef0h"&&($e.innerHTML=ss),fn=r(Cn),_(Re.$$.fragment,Cn),Xn=r(Cn),_(ve.$$.fragment,Cn),Cn.forEach(i),lt.forEach(i),sn=r(v),_(se.$$.fragment,v),Vt=r(v),V=p(v,"DIV",{class:!0});var rn=R(V);_(Mt.$$.fragment,rn),S=r(rn),qe=p(rn,"P",{"data-svelte-h":!0}),m(qe)!=="svelte-14y5xfr"&&(qe.textContent=Gn),on=r(rn),Ln=p(rn,"P",{"data-svelte-h":!0}),m(Ln)!=="svelte-129oi6l"&&(Ln.innerHTML=gn),at=r(rn),Et=p(rn,"P",{"data-svelte-h":!0}),m(Et)!=="svelte-10nfsf3"&&(Et.innerHTML=an),te=r(rn),Ne=p(rn,"P",{"data-svelte-h":!0}),m(Ne)!=="svelte-1pplc4a"&&(Ne.textContent=Vn),pe=r(rn),Ct=p(rn,"UL",{"data-svelte-h":!0}),m(Ct)!=="svelte-1w7z84m"&&(Ct.innerHTML=Fe),Oe=r(rn),Jt=p(rn,"DIV",{class:!0});var Sn=R(Jt);_(zt.$$.fragment,Sn),He=r(Sn),Ut=p(Sn,"P",{"data-svelte-h":!0}),m(Ut)!=="svelte-16oef0h"&&(Ut.innerHTML=Dt),xn=r(Sn),_($.$$.fragment,Sn),C=r(Sn),_(ge.$$.fragment,Sn),Sn.forEach(i),rn.forEach(i),Ke=r(v),_(de.$$.fragment,v),me=r(v),W=p(v,"DIV",{class:!0});var dt=R(W);_(oe.$$.fragment,dt),Le=r(dt),_e=p(dt,"P",{"data-svelte-h":!0}),m(_e)!=="svelte-18jj0o9"&&(_e.innerHTML=Qt),ne=r(dt),Y=p(dt,"P",{"data-svelte-h":!0}),m(Y)!=="svelte-129oi6l"&&(Y.innerHTML=es),Wt=r(dt),ts=p(dt,"P",{"data-svelte-h":!0}),m(ts)!=="svelte-10nfsf3"&&(ts.innerHTML=En),Rn=r(dt),h=p(dt,"P",{"data-svelte-h":!0}),m(h)!=="svelte-1pplc4a"&&(h.textContent=F),Bn=r(dt),Xe=p(dt,"UL",{"data-svelte-h":!0}),m(Xe)!=="svelte-1w7z84m"&&(Xe.innerHTML=et),ze=r(dt),be=p(dt,"DIV",{class:!0});var Kn=R(be);_(Te.$$.fragment,Kn),Fn=r(Kn),Ue=p(Kn,"P",{"data-svelte-h":!0}),m(Ue)!=="svelte-16oef0h"&&(Ue.innerHTML=rt),it=r(Kn),_(Q.$$.fragment,Kn),Yn=r(Kn),_(Qn.$$.fragment,Kn),Kn.forEach(i),dt.forEach(i),this.h()},h(){G(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(n,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(Je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(Jt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(v,J){b(e,v,J),d(v,u,J),d(v,n,J),b(s,n,null),l(n,w),l(n,t),l(n,ae),l(n,Z),l(n,O),l(n,D),l(n,K),l(n,f),l(n,Ee),l(n,Me),l(n,ln),l(n,re),b(_n,re,null),l(re,De),l(re,pt),l(re,It),b(P,re,null),l(re,Gt),b(E,re,null),d(v,nt,J),b(wt,v,J),d(v,bn,J),d(v,ee,J),b(kt,ee,null),l(ee,Jn),l(ee,Rt),l(ee,dn),l(ee,he),l(ee,qt),l(ee,Qe),l(ee,At),l(ee,je),l(ee,ut),l(ee,Mn),l(ee,Pt),l(ee,H),b(Ce,H,null),l(H,cn),l(H,ht),l(H,Dn),b(L,H,null),l(H,Wn),b(Ht,H,null),d(v,We,J),b(yn,v,J),d(v,Yt,J),d(v,N,J),b(ft,N,null),l(N,pn),l(N,Se),l(N,An),l(N,ye),l(N,ie),l(N,Ze),l(N,Ot),l(N,Ae),l(N,A),l(N,Lt),l(N,$t),l(N,Je),b(Xt,Je,null),l(Je,Ie),l(Je,Zn),l(Je,Ge),b($n,Je,null),l(Je,mn),b(le,Je,null),d(v,un,J),b(gt,v,J),d(v,vt,J),d(v,ke,J),b(_t,ke,null),l(ke,bt),l(ke,In),l(ke,en),l(ke,fe),l(ke,ce),l(ke,ot),l(ke,xt),l(ke,Tt),l(ke,Bt),l(ke,hn),l(ke,nn),l(ke,X),b(jt,X,null),l(X,Ye),l(X,$e),l(X,fn),b(Re,X,null),l(X,Xn),b(ve,X,null),d(v,sn,J),b(se,v,J),d(v,Vt,J),d(v,V,J),b(Mt,V,null),l(V,S),l(V,qe),l(V,on),l(V,Ln),l(V,at),l(V,Et),l(V,te),l(V,Ne),l(V,pe),l(V,Ct),l(V,Oe),l(V,Jt),b(zt,Jt,null),l(Jt,He),l(Jt,Ut),l(Jt,xn),b($,Jt,null),l(Jt,C),b(ge,Jt,null),d(v,Ke,J),b(de,v,J),d(v,me,J),d(v,W,J),b(oe,W,null),l(W,Le),l(W,_e),l(W,ne),l(W,Y),l(W,Wt),l(W,ts),l(W,Rn),l(W,h),l(W,Bn),l(W,Xe),l(W,ze),l(W,be),b(Te,be,null),l(be,Fn),l(be,Ue),l(be,it),b(Q,be,null),l(be,Yn),b(Qn,be,null),On=!0},p(v,J){const St={};J&2&&(St.$$scope={dirty:J,ctx:v}),P.$set(St);const yt={};J&2&&(yt.$$scope={dirty:J,ctx:v}),E.$set(yt);const jn={};J&2&&(jn.$$scope={dirty:J,ctx:v}),L.$set(jn);const ue={};J&2&&(ue.$$scope={dirty:J,ctx:v}),Ht.$set(ue);const Zt={};J&2&&(Zt.$$scope={dirty:J,ctx:v}),$n.$set(Zt);const lt={};J&2&&(lt.$$scope={dirty:J,ctx:v}),le.$set(lt);const Cn={};J&2&&(Cn.$$scope={dirty:J,ctx:v}),Re.$set(Cn);const rn={};J&2&&(rn.$$scope={dirty:J,ctx:v}),ve.$set(rn);const Sn={};J&2&&(Sn.$$scope={dirty:J,ctx:v}),$.$set(Sn);const dt={};J&2&&(dt.$$scope={dirty:J,ctx:v}),ge.$set(dt);const Kn={};J&2&&(Kn.$$scope={dirty:J,ctx:v}),Q.$set(Kn);const fs={};J&2&&(fs.$$scope={dirty:J,ctx:v}),Qn.$set(fs)},i(v){On||(T(e.$$.fragment,v),T(s.$$.fragment,v),T(_n.$$.fragment,v),T(P.$$.fragment,v),T(E.$$.fragment,v),T(wt.$$.fragment,v),T(kt.$$.fragment,v),T(Ce.$$.fragment,v),T(L.$$.fragment,v),T(Ht.$$.fragment,v),T(yn.$$.fragment,v),T(ft.$$.fragment,v),T(Xt.$$.fragment,v),T($n.$$.fragment,v),T(le.$$.fragment,v),T(gt.$$.fragment,v),T(_t.$$.fragment,v),T(jt.$$.fragment,v),T(Re.$$.fragment,v),T(ve.$$.fragment,v),T(se.$$.fragment,v),T(Mt.$$.fragment,v),T(zt.$$.fragment,v),T($.$$.fragment,v),T(ge.$$.fragment,v),T(de.$$.fragment,v),T(oe.$$.fragment,v),T(Te.$$.fragment,v),T(Q.$$.fragment,v),T(Qn.$$.fragment,v),On=!0)},o(v){M(e.$$.fragment,v),M(s.$$.fragment,v),M(_n.$$.fragment,v),M(P.$$.fragment,v),M(E.$$.fragment,v),M(wt.$$.fragment,v),M(kt.$$.fragment,v),M(Ce.$$.fragment,v),M(L.$$.fragment,v),M(Ht.$$.fragment,v),M(yn.$$.fragment,v),M(ft.$$.fragment,v),M(Xt.$$.fragment,v),M($n.$$.fragment,v),M(le.$$.fragment,v),M(gt.$$.fragment,v),M(_t.$$.fragment,v),M(jt.$$.fragment,v),M(Re.$$.fragment,v),M(ve.$$.fragment,v),M(se.$$.fragment,v),M(Mt.$$.fragment,v),M(zt.$$.fragment,v),M($.$$.fragment,v),M(ge.$$.fragment,v),M(de.$$.fragment,v),M(oe.$$.fragment,v),M(Te.$$.fragment,v),M(Q.$$.fragment,v),M(Qn.$$.fragment,v),On=!1},d(v){v&&(i(u),i(n),i(nt),i(bn),i(ee),i(We),i(Yt),i(N),i(un),i(vt),i(ke),i(sn),i(Vt),i(V),i(Ke),i(me),i(W)),y(e,v),y(s),y(_n),y(P),y(E),y(wt,v),y(kt),y(Ce),y(L),y(Ht),y(yn,v),y(ft),y(Xt),y($n),y(le),y(gt,v),y(_t),y(jt),y(Re),y(ve),y(se,v),y(Mt),y(zt),y($),y(ge),y(de,v),y(oe),y(Te),y(Q),y(Qn)}}}function No(B){let e,u;return e=new js({props:{$$slots:{default:[qo]},$$scope:{ctx:B}}}),{c(){g(e.$$.fragment)},l(n){_(e.$$.fragment,n)},m(n,s){b(e,n,s),u=!0},p(n,s){const w={};s&2&&(w.$$scope={dirty:s,ctx:n}),e.$set(w)},i(n){u||(T(e.$$.fragment,n),u=!0)},o(n){M(e.$$.fragment,n),u=!1},d(n){y(e,n)}}}function Ho(B){let e,u,n,s,w,t,k,ae='<a href="https://huggingface.co/models?filter=distilbert"><img alt="Models" src="https://img.shields.io/badge/All_model_pages-distilbert-blueviolet"/></a> <a href="https://huggingface.co/spaces/docs-demos/distilbert-base-uncased"><img alt="Spaces" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue"/></a> <a href="https://huggingface.co/papers/1910.01108"><img alt="Paper page" src="https://img.shields.io/badge/Paper%20page-1910.01108-green"/></a>',Z,z,O,D,U=`The DistilBERT model was proposed in the blog post <a href="https://medium.com/huggingface/distilbert-8cf3380435b5" rel="nofollow">Smaller, faster, cheaper, lighter: Introducing DistilBERT, a | |
| distilled version of BERT</a>, and the paper <a href="https://arxiv.org/abs/1910.01108" rel="nofollow">DistilBERT, a | |
| distilled version of BERT: smaller, faster, cheaper and lighter</a>. DistilBERT is a | |
| small, fast, cheap and light Transformer model trained by distilling BERT base. It has 40% less parameters than | |
| <em>google-bert/bert-base-uncased</em>, runs 60% faster while preserving over 95% of BERT’s performances as measured on the GLUE language | |
| understanding benchmark.`,K,f,j="The abstract from the paper is the following:",Ee,Me,ns=`<em>As Transfer Learning from large-scale pre-trained models becomes more prevalent in Natural Language Processing (NLP), | |
| operating these large models in on-the-edge and/or under constrained computational training or inference budgets | |
| remains challenging. In this work, we propose a method to pre-train a smaller general-purpose language representation | |
| model, called DistilBERT, which can then be fine-tuned with good performances on a wide range of tasks like its larger | |
| counterparts. While most prior work investigated the use of distillation for building task-specific models, we leverage | |
| knowledge distillation during the pretraining phase and show that it is possible to reduce the size of a BERT model by | |
| 40%, while retaining 97% of its language understanding capabilities and being 60% faster. To leverage the inductive | |
| biases learned by larger models during pretraining, we introduce a triple loss combining language modeling, | |
| distillation and cosine-distance losses. Our smaller, faster and lighter model is cheaper to pre-train and we | |
| demonstrate its capabilities for on-device computations in a proof-of-concept experiment and a comparative on-device | |
| study.</em>`,ln,re,_n=`This model was contributed by <a href="https://huggingface.co/victorsanh" rel="nofollow">victorsanh</a>. This model jax version was | |
| contributed by <a href="https://huggingface.co/kamalkraj" rel="nofollow">kamalkraj</a>. The original code can be found <a href="https://github.com/huggingface/transformers/tree/main/examples/research_projects/distillation" rel="nofollow">here</a>.`,De,pt,tt,It,P=`<li><p>DistilBERT doesn’t have <code>token_type_ids</code>, you don’t need to indicate which token belongs to which segment. Just | |
| separate your segments with the separation token <code>tokenizer.sep_token</code> (or <code>[SEP]</code>).</p></li> <li><p>DistilBERT doesn’t have options to select the input positions (<code>position_ids</code> input). This could be added if | |
| necessary though, just let us know if you need this option.</p></li> <li><p>Same as BERT but smaller. Trained by distillation of the pretrained BERT model, meaning it’s been trained to predict the same probabilities as the larger model. The actual objective is a combination of:</p> <ul><li>finding the same probabilities as the teacher model</li> <li>predicting the masked tokens correctly (but no next-sentence objective)</li> <li>a cosine similarity between the hidden states of the student and the teacher model</li></ul></li>`,Gt,E,nt,wt,bn=`PyTorch includes a native scaled dot-product attention (SDPA) operator as part of <code>torch.nn.functional</code>. This function | |
| encompasses several implementations that can be applied depending on the inputs and the hardware in use. See the | |
| <a href="https://pytorch.org/docs/stable/generated/torch.nn.functional.scaled_dot_product_attention.html" rel="nofollow">official documentation</a> | |
| or the <a href="https://huggingface.co/docs/transformers/main/en/perf_infer_gpu_one#pytorch-scaled-dot-product-attention" rel="nofollow">GPU Inference</a> | |
| page for more information.`,ee,kt,Jn=`SDPA is used by default for <code>torch>=2.1.1</code> when an implementation is available, but you may also set | |
| <code>attn_implementation="sdpa"</code> in <code>from_pretrained()</code> to explicitly request SDPA to be used.`,Rt,zn,dn,he,Un="For the best speedups, we recommend loading the model in half-precision (e.g. <code>torch.float16</code> or <code>torch.bfloat16</code>).",qt,Qe,mt=`On a local benchmark (NVIDIA GeForce RTX 2060-8GB, PyTorch 2.3.1, OS Ubuntu 20.04) with <code>float16</code> and the <code>distilbert-base-uncased</code> model with | |
| a MaskedLM head, we saw the following speedups during training and inference.`,At,je,Tn,ut,Mn="<thead><tr><th>num_training_steps</th> <th>batch_size</th> <th>seq_len</th> <th>is cuda</th> <th>Time per batch (eager - s)</th> <th>Time per batch (sdpa - s)</th> <th>Speedup (%)</th> <th>Eager peak mem (MB)</th> <th>sdpa peak mem (MB)</th> <th>Mem saving (%)</th></tr></thead> <tbody><tr><td>100</td> <td>1</td> <td>128</td> <td>False</td> <td>0.010</td> <td>0.008</td> <td>28.870</td> <td>397.038</td> <td>399.629</td> <td>-0.649</td></tr> <tr><td>100</td> <td>1</td> <td>256</td> <td>False</td> <td>0.011</td> <td>0.009</td> <td>20.681</td> <td>412.505</td> <td>412.606</td> <td>-0.025</td></tr> <tr><td>100</td> <td>2</td> <td>128</td> <td>False</td> <td>0.011</td> <td>0.009</td> <td>23.741</td> <td>412.213</td> <td>412.606</td> <td>-0.095</td></tr> <tr><td>100</td> <td>2</td> <td>256</td> <td>False</td> <td>0.015</td> <td>0.013</td> <td>16.502</td> <td>427.491</td> <td>425.787</td> <td>0.400</td></tr> <tr><td>100</td> <td>4</td> <td>128</td> <td>False</td> <td>0.015</td> <td>0.013</td> <td>13.828</td> <td>427.491</td> <td>425.787</td> <td>0.400</td></tr> <tr><td>100</td> <td>4</td> <td>256</td> <td>False</td> <td>0.025</td> <td>0.022</td> <td>12.882</td> <td>594.156</td> <td>502.745</td> <td>18.182</td></tr> <tr><td>100</td> <td>8</td> <td>128</td> <td>False</td> <td>0.023</td> <td>0.022</td> <td>8.010</td> <td>545.922</td> <td>502.745</td> <td>8.588</td></tr> <tr><td>100</td> <td>8</td> <td>256</td> <td>False</td> <td>0.046</td> <td>0.041</td> <td>12.763</td> <td>983.450</td> <td>798.480</td> <td>23.165</td></tr></tbody>",st,Pt,H,Ce,cn="<thead><tr><th>num_batches</th> <th>batch_size</th> <th>seq_len</th> <th>is cuda</th> <th>is half</th> <th>use mask</th> <th>Per token latency eager (ms)</th> <th>Per token latency SDPA (ms)</th> <th>Speedup (%)</th> <th>Mem eager (MB)</th> <th>Mem BT (MB)</th> <th>Mem saved (%)</th></tr></thead> <tbody><tr><td>50</td> <td>2</td> <td>64</td> <td>True</td> <td>True</td> <td>True</td> <td>0.032</td> <td>0.025</td> <td>28.192</td> <td>154.532</td> <td>155.531</td> <td>-0.642</td></tr> <tr><td>50</td> <td>2</td> <td>128</td> <td>True</td> <td>True</td> <td>True</td> <td>0.033</td> <td>0.025</td> <td>32.636</td> <td>157.286</td> <td>157.482</td> <td>-0.125</td></tr> <tr><td>50</td> <td>4</td> <td>64</td> <td>True</td> <td>True</td> <td>True</td> <td>0.032</td> <td>0.026</td> <td>24.783</td> <td>157.023</td> <td>157.449</td> <td>-0.271</td></tr> <tr><td>50</td> <td>4</td> <td>128</td> <td>True</td> <td>True</td> <td>True</td> <td>0.034</td> <td>0.028</td> <td>19.299</td> <td>162.794</td> <td>162.269</td> <td>0.323</td></tr> <tr><td>50</td> <td>8</td> <td>64</td> <td>True</td> <td>True</td> <td>True</td> <td>0.035</td> <td>0.028</td> <td>25.105</td> <td>160.958</td> <td>162.204</td> <td>-0.768</td></tr> <tr><td>50</td> <td>8</td> <td>128</td> <td>True</td> <td>True</td> <td>True</td> <td>0.052</td> <td>0.046</td> <td>12.375</td> <td>173.155</td> <td>171.844</td> <td>0.763</td></tr> <tr><td>50</td> <td>16</td> <td>64</td> <td>True</td> <td>True</td> <td>True</td> <td>0.051</td> <td>0.045</td> <td>12.882</td> <td>172.106</td> <td>171.713</td> <td>0.229</td></tr> <tr><td>50</td> <td>16</td> <td>128</td> <td>True</td> <td>True</td> <td>True</td> <td>0.096</td> <td>0.081</td> <td>18.524</td> <td>191.257</td> <td>191.517</td> <td>-0.136</td></tr></tbody>",ht,Nt,Dn,L,Wn="A list of official Hugging Face and community (indicated by 🌎) resources to help you get started with DistilBERT. If you’re interested in submitting a resource to be included here, please feel free to open a Pull Request and we’ll review it! The resource should ideally demonstrate something new instead of duplicating an existing resource.",Ht,We,yn,Yt,N='<li>A blog post on <a href="https://huggingface.co/blog/sentiment-analysis-python" rel="nofollow">Getting Started with Sentiment Analysis using Python</a> with DistilBERT.</li> <li>A blog post on how to <a href="https://huggingface.co/blog/fastai" rel="nofollow">train DistilBERT with Blurr for sequence classification</a>.</li> <li>A blog post on how to use <a href="https://huggingface.co/blog/ray-tune" rel="nofollow">Ray to tune DistilBERT hyperparameters</a>.</li> <li>A blog post on how to <a href="https://huggingface.co/blog/the-partnership-amazon-sagemaker-and-hugging-face" rel="nofollow">train DistilBERT with Hugging Face and Amazon SageMaker</a>.</li> <li>A notebook on how to <a href="https://colab.research.google.com/github/DhavalTaunk08/Transformers_scripts/blob/master/Transformers_multilabel_distilbert.ipynb" rel="nofollow">finetune DistilBERT for multi-label classification</a>. 🌎</li> <li>A notebook on how to <a href="https://colab.research.google.com/github/abhimishra91/transformers-tutorials/blob/master/transformers_multiclass_classification.ipynb" rel="nofollow">finetune DistilBERT for multiclass classification with PyTorch</a>. 🌎</li> <li>A notebook on how to <a href="https://colab.research.google.com/github/peterbayerle/huggingface_notebook/blob/main/distilbert_tf.ipynb" rel="nofollow">finetune DistilBERT for text classification in TensorFlow</a>. 🌎</li> <li><a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertForSequenceClassification">DistilBertForSequenceClassification</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-classification" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification.ipynb" rel="nofollow">notebook</a>.</li> <li><a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.TFDistilBertForSequenceClassification">TFDistilBertForSequenceClassification</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/tensorflow/text-classification" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification-tf.ipynb" rel="nofollow">notebook</a>.</li> <li><a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.FlaxDistilBertForSequenceClassification">FlaxDistilBertForSequenceClassification</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/flax/text-classification" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/text_classification_flax.ipynb" rel="nofollow">notebook</a>.</li> <li><a href="../tasks/sequence_classification">Text classification task guide</a></li>',ft,pn,Se,Nn,An='<li><a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertForTokenClassification">DistilBertForTokenClassification</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/token-classification" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification.ipynb" rel="nofollow">notebook</a>.</li> <li><a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.TFDistilBertForTokenClassification">TFDistilBertForTokenClassification</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/tensorflow/token-classification" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification-tf.ipynb" rel="nofollow">notebook</a>.</li> <li><a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.FlaxDistilBertForTokenClassification">FlaxDistilBertForTokenClassification</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/flax/token-classification" rel="nofollow">example script</a>.</li> <li><a href="https://huggingface.co/course/chapter7/2?fw=pt" rel="nofollow">Token classification</a> chapter of the 🤗 Hugging Face Course.</li> <li><a href="../tasks/token_classification">Token classification task guide</a></li>',ye,wn,ie,Ze,kn='<li><a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertForMaskedLM">DistilBertForMaskedLM</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/language-modeling#robertabertdistilbert-and-masked-language-modeling" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb" rel="nofollow">notebook</a>.</li> <li><a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.TFDistilBertForMaskedLM">TFDistilBertForMaskedLM</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/tensorflow/language-modeling#run_mlmpy" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb" rel="nofollow">notebook</a>.</li> <li><a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.FlaxDistilBertForMaskedLM">FlaxDistilBertForMaskedLM</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/flax/language-modeling#masked-language-modeling" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/masked_language_modeling_flax.ipynb" rel="nofollow">notebook</a>.</li> <li><a href="https://huggingface.co/course/chapter7/3?fw=pt" rel="nofollow">Masked language modeling</a> chapter of the 🤗 Hugging Face Course.</li> <li><a href="../tasks/masked_language_modeling">Masked language modeling task guide</a></li>',Ot,Ae,Hn,A,Lt='<li><a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertForQuestionAnswering">DistilBertForQuestionAnswering</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/question-answering" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering.ipynb" rel="nofollow">notebook</a>.</li> <li><a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.TFDistilBertForQuestionAnswering">TFDistilBertForQuestionAnswering</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/tensorflow/question-answering" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering-tf.ipynb" rel="nofollow">notebook</a>.</li> <li><a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.FlaxDistilBertForQuestionAnswering">FlaxDistilBertForQuestionAnswering</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/flax/question-answering" rel="nofollow">example script</a>.</li> <li><a href="https://huggingface.co/course/chapter7/7?fw=pt" rel="nofollow">Question answering</a> chapter of the 🤗 Hugging Face Course.</li> <li><a href="../tasks/question_answering">Question answering task guide</a></li>',Kt,$t,Je="<strong>Multiple choice</strong>",Xt,Ie,Zn='<li><a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertForMultipleChoice">DistilBertForMultipleChoice</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/pytorch/multiple-choice" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice.ipynb" rel="nofollow">notebook</a>.</li> <li><a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.TFDistilBertForMultipleChoice">TFDistilBertForMultipleChoice</a> is supported by this <a href="https://github.com/huggingface/transformers/tree/main/examples/tensorflow/multiple-choice" rel="nofollow">example script</a> and <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/multiple_choice-tf.ipynb" rel="nofollow">notebook</a>.</li> <li><a href="../tasks/multiple_choice">Multiple choice task guide</a></li>',we,Ge,$n="⚗️ Optimization",mn,le,un='<li>A blog post on how to <a href="https://huggingface.co/blog/intel" rel="nofollow">quantize DistilBERT with 🤗 Optimum and Intel</a>.</li> <li>A blog post on how <a href="https://www.philschmid.de/optimizing-transformers-with-optimum-gpu" rel="nofollow">Optimizing Transformers for GPUs with 🤗 Optimum</a>.</li> <li>A blog post on <a href="https://www.philschmid.de/optimizing-transformers-with-optimum" rel="nofollow">Optimizing Transformers with Hugging Face Optimum</a>.</li>',gt,vt,ke="⚡️ Inference",_t,bt,In='<li>A blog post on how to <a href="https://huggingface.co/blog/bert-inferentia-sagemaker" rel="nofollow">Accelerate BERT inference with Hugging Face Transformers and AWS Inferentia</a> with DistilBERT.</li> <li>A blog post on <a href="https://www.philschmid.de/sagemaker-serverless-huggingface-distilbert" rel="nofollow">Serverless Inference with Hugging Face’s Transformers, DistilBERT and Amazon SageMaker</a>.</li>',Pe,en,fe="🚀 Deploy",tn,ce,ot='<li>A blog post on how to <a href="https://huggingface.co/blog/how-to-deploy-a-pipeline-to-google-clouds" rel="nofollow">deploy DistilBERT on Google Cloud</a>.</li> <li>A blog post on how to <a href="https://huggingface.co/blog/deploy-hugging-face-models-easily-with-amazon-sagemaker" rel="nofollow">deploy DistilBERT with Amazon SageMaker</a>.</li> <li>A blog post on how to <a href="https://www.philschmid.de/terraform-huggingface-amazon-sagemaker" rel="nofollow">Deploy BERT with Hugging Face Transformers, Amazon SageMaker and Terraform module</a>.</li>',Pn,xt,Tt,vn,Bt="First, make sure to install the latest version of Flash Attention 2 to include the sliding window attention feature.",hn,Ft,nn,X,jt="Make also sure that you have a hardware that is compatible with Flash-Attention 2. Read more about it in the official documentation of flash-attn repository. Make also sure to load your model in half-precision (e.g. <code>torch.float16</code>)",Ye,$e,ss="To load and run a model using Flash Attention 2, refer to the snippet below:",fn,Re,Xn,ve,sn,se,Vt,V,Mt,S=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertModel">DistilBertModel</a> or a <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.TFDistilBertModel">TFDistilBertModel</a>. It | |
| is used to instantiate a DistilBERT model according to the specified arguments, defining the model architecture. | |
| Instantiating a configuration with the defaults will yield a similar configuration to that of the DistilBERT | |
| <a href="https://huggingface.co/distilbert-base-uncased" rel="nofollow">distilbert-base-uncased</a> architecture.`,qe,Gn,on=`Configuration objects inherit from <a href="/docs/transformers/pr_34652/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the | |
| documentation from <a href="/docs/transformers/pr_34652/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Ln,gn,at,Et,an,te,Ne,Vn,pe,Ct="Construct a DistilBERT tokenizer. Based on WordPiece.",Fe,Oe,Jt=`This tokenizer inherits from <a href="/docs/transformers/pr_34652/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a> which contains most of the main methods. Users should refer to | |
| this superclass for more information regarding those methods.`,zt,He,Ut,Dt,xn,$=`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and | |
| adding special tokens. A BERT sequence has the following format:`,C,ge,Ke="<li>single sequence: <code>[CLS] X [SEP]</code></li> <li>pair of sequences: <code>[CLS] A [SEP] B [SEP]</code></li>",de,me,W,oe,Le,_e="Converts a sequence of tokens (string) in a single string.",Qt,ne,Y,es,Wt,ts="Create a mask from the two sequences passed to be used in a sequence-pair classification task. A BERT sequence",En,Rn,h,F,Bn="If <code>token_ids_1</code> is <code>None</code>, this method only returns the first portion of the mask (0s).",Xe,et,ze,be,Te,Fn=`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding | |
| special tokens using the tokenizer <code>prepare_for_model</code> method.`,Ue,rt,it,Q,Yn,Qn,On,v="Construct a “fast” DistilBERT tokenizer (backed by HuggingFace’s <em>tokenizers</em> library). Based on WordPiece.",J,St,yt=`This tokenizer inherits from <a href="/docs/transformers/pr_34652/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast">PreTrainedTokenizerFast</a> which contains most of the main methods. Users should | |
| refer to this superclass for more information regarding those methods.`,jn,ue,Zt,lt,Cn,rn=`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and | |
| adding special tokens. A BERT sequence has the following format:`,Sn,dt,Kn="<li>single sequence: <code>[CLS] X [SEP]</code></li> <li>pair of sequences: <code>[CLS] A [SEP] B [SEP]</code></li>",fs,os,ms,xs,gs,Cs="Create a mask from the two sequences passed to be used in a sequence-pair classification task. A BERT sequence",Bs,ls,Fs,_s,Js="If <code>token_ids_1</code> is <code>None</code>, this method only returns the first portion of the mask (0s).",Ms,ds,ys,us,ws,Ts,ks;return w=new xe({props:{title:"DistilBERT",local:"distilbert",headingTag:"h1"}}),z=new xe({props:{title:"Overview",local:"overview",headingTag:"h2"}}),pt=new xe({props:{title:"Usage tips",local:"usage-tips",headingTag:"h2"}}),E=new xe({props:{title:"Using Scaled Dot Product Attention (SDPA)",local:"using-scaled-dot-product-attention-sdpa",headingTag:"h3"}}),zn=new Be({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERpc3RpbEJlcnRNb2RlbCUwQW1vZGVsJTIwJTNEJTIwRGlzdGlsQmVydE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMGF0dG5faW1wbGVtZW50YXRpb24lM0QlMjJzZHBhJTIyKQ==",highlighted:`from transformers import DistilBertModel | |
| model = <span class="hljs-module-access"><span class="hljs-module"><span class="hljs-identifier">DistilBertModel</span>.</span></span>from<span class="hljs-constructor">_pretrained(<span class="hljs-string">"distilbert-base-uncased"</span>, <span class="hljs-params">torch_dtype</span>=<span class="hljs-params">torch</span>.<span class="hljs-params">float16</span>, <span class="hljs-params">attn_implementation</span>=<span class="hljs-string">"sdpa"</span>)</span>`,wrap:!1}}),je=new xe({props:{title:"Training",local:"training",headingTag:"h4"}}),Pt=new xe({props:{title:"Inference",local:"inference",headingTag:"h4"}}),Nt=new xe({props:{title:"Resources",local:"resources",headingTag:"h2"}}),We=new vs({props:{pipeline:"text-classification"}}),pn=new vs({props:{pipeline:"token-classification"}}),wn=new vs({props:{pipeline:"fill-mask"}}),Ae=new vs({props:{pipeline:"question-answering"}}),xt=new xe({props:{title:"Combining DistilBERT and Flash Attention 2",local:"combining-distilbert-and-flash-attention-2",headingTag:"h2"}}),Ft=new Be({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1VJTIwZmxhc2gtYXR0biUyMC0tbm8tYnVpbGQtaXNvbGF0aW9u",highlighted:"pip install -U flash-attn --no-build-isolation",wrap:!1}}),Re=new Be({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEF1dG9Nb2RlbCUwQSUwQWRldmljZSUyMCUzRCUyMCUyMmN1ZGElMjIlMjAlMjMlMjB0aGUlMjBkZXZpY2UlMjB0byUyMGxvYWQlMjB0aGUlMjBtb2RlbCUyMG9udG8lMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCgnZGlzdGlsYmVydCUyRmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJyklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydCUyRmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwYXR0bl9pbXBsZW1lbnRhdGlvbiUzRCUyMmZsYXNoX2F0dGVudGlvbl8yJTIyKSUwQSUwQXRleHQlMjAlM0QlMjAlMjJSZXBsYWNlJTIwbWUlMjBieSUyMGFueSUyMHRleHQlMjB5b3UnZCUyMGxpa2UuJTIyJTBBJTBBZW5jb2RlZF9pbnB1dCUyMCUzRCUyMHRva2VuaXplcih0ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QncHQnKS50byhkZXZpY2UpJTBBbW9kZWwudG8oZGV2aWNlKSUwQSUwQW91dHB1dCUyMCUzRCUyMG1vZGVsKCoqZW5jb2RlZF9pbnB1dCk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModel | |
| <span class="hljs-meta">>>> </span>device = <span class="hljs-string">"cuda"</span> <span class="hljs-comment"># the device to load the model onto</span> | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">'distilbert/distilbert-base-uncased'</span>) | |
| <span class="hljs-meta">>>> </span>model = AutoModel.from_pretrained(<span class="hljs-string">"distilbert/distilbert-base-uncased"</span>, torch_dtype=torch.float16, attn_implementation=<span class="hljs-string">"flash_attention_2"</span>) | |
| <span class="hljs-meta">>>> </span>text = <span class="hljs-string">"Replace me by any text you'd like."</span> | |
| <span class="hljs-meta">>>> </span>encoded_input = tokenizer(text, return_tensors=<span class="hljs-string">'pt'</span>).to(device) | |
| <span class="hljs-meta">>>> </span>model.to(device) | |
| <span class="hljs-meta">>>> </span>output = model(**encoded_input)`,wrap:!1}}),ve=new xe({props:{title:"DistilBertConfig",local:"transformers.DistilBertConfig",headingTag:"h2"}}),Vt=new q({props:{name:"class transformers.DistilBertConfig",anchor:"transformers.DistilBertConfig",parameters:[{name:"vocab_size",val:" = 30522"},{name:"max_position_embeddings",val:" = 512"},{name:"sinusoidal_pos_embds",val:" = False"},{name:"n_layers",val:" = 6"},{name:"n_heads",val:" = 12"},{name:"dim",val:" = 768"},{name:"hidden_dim",val:" = 3072"},{name:"dropout",val:" = 0.1"},{name:"attention_dropout",val:" = 0.1"},{name:"activation",val:" = 'gelu'"},{name:"initializer_range",val:" = 0.02"},{name:"qa_dropout",val:" = 0.1"},{name:"seq_classif_dropout",val:" = 0.2"},{name:"pad_token_id",val:" = 0"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DistilBertConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) — | |
| Vocabulary size of the DistilBERT model. Defines the number of different tokens that can be represented by | |
| the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertModel">DistilBertModel</a> or <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.TFDistilBertModel">TFDistilBertModel</a>.`,name:"vocab_size"},{anchor:"transformers.DistilBertConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 512) — | |
| The maximum sequence length that this model might ever be used with. Typically set this to something large | |
| just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.DistilBertConfig.sinusoidal_pos_embds",description:`<strong>sinusoidal_pos_embds</strong> (<code>boolean</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to use sinusoidal positional embeddings.`,name:"sinusoidal_pos_embds"},{anchor:"transformers.DistilBertConfig.n_layers",description:`<strong>n_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 6) — | |
| Number of hidden layers in the Transformer encoder.`,name:"n_layers"},{anchor:"transformers.DistilBertConfig.n_heads",description:`<strong>n_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) — | |
| Number of attention heads for each attention layer in the Transformer encoder.`,name:"n_heads"},{anchor:"transformers.DistilBertConfig.dim",description:`<strong>dim</strong> (<code>int</code>, <em>optional</em>, defaults to 768) — | |
| Dimensionality of the encoder layers and the pooler layer.`,name:"dim"},{anchor:"transformers.DistilBertConfig.hidden_dim",description:`<strong>hidden_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) — | |
| The size of the “intermediate” (often named feed-forward) layer in the Transformer encoder.`,name:"hidden_dim"},{anchor:"transformers.DistilBertConfig.dropout",description:`<strong>dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) — | |
| The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout"},{anchor:"transformers.DistilBertConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) — | |
| The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.DistilBertConfig.activation",description:`<strong>activation</strong> (<code>str</code> or <code>Callable</code>, <em>optional</em>, defaults to <code>"gelu"</code>) — | |
| The non-linear activation function (function or string) in the encoder and pooler. If string, <code>"gelu"</code>, | |
| <code>"relu"</code>, <code>"silu"</code> and <code>"gelu_new"</code> are supported.`,name:"activation"},{anchor:"transformers.DistilBertConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) — | |
| The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.DistilBertConfig.qa_dropout",description:`<strong>qa_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) — | |
| The dropout probabilities used in the question answering model <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertForQuestionAnswering">DistilBertForQuestionAnswering</a>.`,name:"qa_dropout"},{anchor:"transformers.DistilBertConfig.seq_classif_dropout",description:`<strong>seq_classif_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.2) — | |
| The dropout probabilities used in the sequence classification and the multiple choice model | |
| <a href="/docs/transformers/pr_34652/en/model_doc/distilbert#transformers.DistilBertForSequenceClassification">DistilBertForSequenceClassification</a>.`,name:"seq_classif_dropout"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/configuration_distilbert.py#L28"}}),gn=new Ve({props:{anchor:"transformers.DistilBertConfig.example",$$slots:{default:[Rs]},$$scope:{ctx:B}}}),Et=new xe({props:{title:"DistilBertTokenizer",local:"transformers.DistilBertTokenizer",headingTag:"h2"}}),Ne=new q({props:{name:"class transformers.DistilBertTokenizer",anchor:"transformers.DistilBertTokenizer",parameters:[{name:"vocab_file",val:""},{name:"do_lower_case",val:" = True"},{name:"do_basic_tokenize",val:" = True"},{name:"never_split",val:" = None"},{name:"unk_token",val:" = '[UNK]'"},{name:"sep_token",val:" = '[SEP]'"},{name:"pad_token",val:" = '[PAD]'"},{name:"cls_token",val:" = '[CLS]'"},{name:"mask_token",val:" = '[MASK]'"},{name:"tokenize_chinese_chars",val:" = True"},{name:"strip_accents",val:" = None"},{name:"clean_up_tokenization_spaces",val:" = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DistilBertTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) — | |
| File containing the vocabulary.`,name:"vocab_file"},{anchor:"transformers.DistilBertTokenizer.do_lower_case",description:`<strong>do_lower_case</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to lowercase the input when tokenizing.`,name:"do_lower_case"},{anchor:"transformers.DistilBertTokenizer.do_basic_tokenize",description:`<strong>do_basic_tokenize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to do basic tokenization before WordPiece.`,name:"do_basic_tokenize"},{anchor:"transformers.DistilBertTokenizer.never_split",description:`<strong>never_split</strong> (<code>Iterable</code>, <em>optional</em>) — | |
| Collection of tokens which will never be split during tokenization. Only has an effect when | |
| <code>do_basic_tokenize=True</code>`,name:"never_split"},{anchor:"transformers.DistilBertTokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"[UNK]"</code>) — | |
| The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this | |
| token instead.`,name:"unk_token"},{anchor:"transformers.DistilBertTokenizer.sep_token",description:`<strong>sep_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"[SEP]"</code>) — | |
| The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for | |
| sequence classification or for a text and a question for question answering. It is also used as the last | |
| token of a sequence built with special tokens.`,name:"sep_token"},{anchor:"transformers.DistilBertTokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"[PAD]"</code>) — | |
| The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.DistilBertTokenizer.cls_token",description:`<strong>cls_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"[CLS]"</code>) — | |
| The classifier token which is used when doing sequence classification (classification of the whole sequence | |
| instead of per-token classification). It is the first token of the sequence when built with special tokens.`,name:"cls_token"},{anchor:"transformers.DistilBertTokenizer.mask_token",description:`<strong>mask_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"[MASK]"</code>) — | |
| The token used for masking values. This is the token used when training this model with masked language | |
| modeling. This is the token which the model will try to predict.`,name:"mask_token"},{anchor:"transformers.DistilBertTokenizer.tokenize_chinese_chars",description:`<strong>tokenize_chinese_chars</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to tokenize Chinese characters.</p> | |
| <p>This should likely be deactivated for Japanese (see this | |
| <a href="https://github.com/huggingface/transformers/issues/328" rel="nofollow">issue</a>).`,name:"tokenize_chinese_chars"},{anchor:"transformers.DistilBertTokenizer.strip_accents",description:`<strong>strip_accents</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to strip all accents. If this option is not specified, then it will be determined by the | |
| value for <code>lowercase</code> (as in the original BERT).`,name:"strip_accents"},{anchor:"transformers.DistilBertTokenizer.clean_up_tokenization_spaces",description:`<strong>clean_up_tokenization_spaces</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to cleanup spaces after decoding, cleanup consists in removing potential artifacts like | |
| extra spaces.`,name:"clean_up_tokenization_spaces"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/tokenization_distilbert.py#L53"}}),Ut=new q({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.DistilBertTokenizer.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.DistilBertTokenizer.build_inputs_with_special_tokens.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) — | |
| List of IDs to which the special tokens will be added.`,name:"token_ids_0"},{anchor:"transformers.DistilBertTokenizer.build_inputs_with_special_tokens.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) — | |
| Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/tokenization_distilbert.py#L196",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>List[int]</code></p> | |
| `}}),W=new q({props:{name:"convert_tokens_to_string",anchor:"transformers.DistilBertTokenizer.convert_tokens_to_string",parameters:[{name:"tokens",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/tokenization_distilbert.py#L190"}}),Y=new q({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.DistilBertTokenizer.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.DistilBertTokenizer.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) — | |
| List of IDs.`,name:"token_ids_0"},{anchor:"transformers.DistilBertTokenizer.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) — | |
| Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/tokenization_distilbert.py#L251",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>List of <a href="../glossary#token-type-ids">token type IDs</a> according to the given sequence(s).</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>List[int]</code></p> | |
| `}}),Rn=new Ve({props:{anchor:"transformers.DistilBertTokenizer.create_token_type_ids_from_sequences.example",$$slots:{default:[qs]},$$scope:{ctx:B}}}),ze=new q({props:{name:"get_special_tokens_mask",anchor:"transformers.DistilBertTokenizer.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"},{name:"already_has_special_tokens",val:": bool = False"}],parametersDescription:[{anchor:"transformers.DistilBertTokenizer.get_special_tokens_mask.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) — | |
| List of IDs.`,name:"token_ids_0"},{anchor:"transformers.DistilBertTokenizer.get_special_tokens_mask.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) — | |
| Optional second list of IDs for sequence pairs.`,name:"token_ids_1"},{anchor:"transformers.DistilBertTokenizer.get_special_tokens_mask.already_has_special_tokens",description:`<strong>already_has_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not the token list is already formatted with special tokens for the model.`,name:"already_has_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/tokenization_distilbert.py#L222",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>List[int]</code></p> | |
| `}}),rt=new xe({props:{title:"DistilBertTokenizerFast",local:"transformers.DistilBertTokenizerFast",headingTag:"h2"}}),Yn=new q({props:{name:"class transformers.DistilBertTokenizerFast",anchor:"transformers.DistilBertTokenizerFast",parameters:[{name:"vocab_file",val:" = None"},{name:"tokenizer_file",val:" = None"},{name:"do_lower_case",val:" = True"},{name:"unk_token",val:" = '[UNK]'"},{name:"sep_token",val:" = '[SEP]'"},{name:"pad_token",val:" = '[PAD]'"},{name:"cls_token",val:" = '[CLS]'"},{name:"mask_token",val:" = '[MASK]'"},{name:"tokenize_chinese_chars",val:" = True"},{name:"strip_accents",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.DistilBertTokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) — | |
| File containing the vocabulary.`,name:"vocab_file"},{anchor:"transformers.DistilBertTokenizerFast.do_lower_case",description:`<strong>do_lower_case</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to lowercase the input when tokenizing.`,name:"do_lower_case"},{anchor:"transformers.DistilBertTokenizerFast.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"[UNK]"</code>) — | |
| The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this | |
| token instead.`,name:"unk_token"},{anchor:"transformers.DistilBertTokenizerFast.sep_token",description:`<strong>sep_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"[SEP]"</code>) — | |
| The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for | |
| sequence classification or for a text and a question for question answering. It is also used as the last | |
| token of a sequence built with special tokens.`,name:"sep_token"},{anchor:"transformers.DistilBertTokenizerFast.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"[PAD]"</code>) — | |
| The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.DistilBertTokenizerFast.cls_token",description:`<strong>cls_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"[CLS]"</code>) — | |
| The classifier token which is used when doing sequence classification (classification of the whole sequence | |
| instead of per-token classification). It is the first token of the sequence when built with special tokens.`,name:"cls_token"},{anchor:"transformers.DistilBertTokenizerFast.mask_token",description:`<strong>mask_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"[MASK]"</code>) — | |
| The token used for masking values. This is the token used when training this model with masked language | |
| modeling. This is the token which the model will try to predict.`,name:"mask_token"},{anchor:"transformers.DistilBertTokenizerFast.clean_text",description:`<strong>clean_text</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to clean the text before tokenization by removing any control characters and replacing all | |
| whitespaces by the classic one.`,name:"clean_text"},{anchor:"transformers.DistilBertTokenizerFast.tokenize_chinese_chars",description:`<strong>tokenize_chinese_chars</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to tokenize Chinese characters. This should likely be deactivated for Japanese (see <a href="https://github.com/huggingface/transformers/issues/328" rel="nofollow">this | |
| issue</a>).`,name:"tokenize_chinese_chars"},{anchor:"transformers.DistilBertTokenizerFast.strip_accents",description:`<strong>strip_accents</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to strip all accents. If this option is not specified, then it will be determined by the | |
| value for <code>lowercase</code> (as in the original BERT).`,name:"strip_accents"},{anchor:"transformers.DistilBertTokenizerFast.wordpieces_prefix",description:`<strong>wordpieces_prefix</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"##"</code>) — | |
| The prefix for subwords.`,name:"wordpieces_prefix"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/tokenization_distilbert_fast.py#L32"}}),Zt=new q({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.DistilBertTokenizerFast.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:""},{name:"token_ids_1",val:" = None"}],parametersDescription:[{anchor:"transformers.DistilBertTokenizerFast.build_inputs_with_special_tokens.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) — | |
| List of IDs to which the special tokens will be added.`,name:"token_ids_0"},{anchor:"transformers.DistilBertTokenizerFast.build_inputs_with_special_tokens.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) — | |
| Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/tokenization_distilbert_fast.py#L119",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>List[int]</code></p> | |
| `}}),ms=new q({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.DistilBertTokenizerFast.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.DistilBertTokenizerFast.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) — | |
| List of IDs.`,name:"token_ids_0"},{anchor:"transformers.DistilBertTokenizerFast.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) — | |
| Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/vr_34652/src/transformers/models/distilbert/tokenization_distilbert_fast.py#L144",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>List of <a href="../glossary#token-type-ids">token type IDs</a> according to the given sequence(s).</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>List[int]</code></p> | |
| `}}),ls=new Ve({props:{anchor:"transformers.DistilBertTokenizerFast.create_token_type_ids_from_sequences.example",$$slots:{default:[Ns]},$$scope:{ctx:B}}}),ds=new Is({props:{pytorch:!0,tensorflow:!0,jax:!0,$$slots:{jax:[No],tensorflow:[Bo],pytorch:[no]},$$scope:{ctx:B}}}),us=new Gs({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/distilbert.md"}}),{c(){e=c("meta"),u=a(),n=c("p"),s=a(),g(w.$$.fragment),t=a(),k=c("div"),k.innerHTML=ae,Z=a(),g(z.$$.fragment),O=a(),D=c("p"),D.innerHTML=U,K=a(),f=c("p"),f.textContent=j,Ee=a(),Me=c("p"),Me.innerHTML=ns,ln=a(),re=c("p"),re.innerHTML=_n,De=a(),g(pt.$$.fragment),tt=a(),It=c("ul"),It.innerHTML=P,Gt=a(),g(E.$$.fragment),nt=a(),wt=c("p"),wt.innerHTML=bn,ee=a(),kt=c("p"),kt.innerHTML=Jn,Rt=a(),g(zn.$$.fragment),dn=a(),he=c("p"),he.innerHTML=Un,qt=a(),Qe=c("p"),Qe.innerHTML=mt,At=a(),g(je.$$.fragment),Tn=a(),ut=c("table"),ut.innerHTML=Mn,st=a(),g(Pt.$$.fragment),H=a(),Ce=c("table"),Ce.innerHTML=cn,ht=a(),g(Nt.$$.fragment),Dn=a(),L=c("p"),L.textContent=Wn,Ht=a(),g(We.$$.fragment),yn=a(),Yt=c("ul"),Yt.innerHTML=N,ft=a(),g(pn.$$.fragment),Se=a(),Nn=c("ul"),Nn.innerHTML=An,ye=a(),g(wn.$$.fragment),ie=a(),Ze=c("ul"),Ze.innerHTML=kn,Ot=a(),g(Ae.$$.fragment),Hn=a(),A=c("ul"),A.innerHTML=Lt,Kt=a(),$t=c("p"),$t.innerHTML=Je,Xt=a(),Ie=c("ul"),Ie.innerHTML=Zn,we=a(),Ge=c("p"),Ge.textContent=$n,mn=a(),le=c("ul"),le.innerHTML=un,gt=a(),vt=c("p"),vt.textContent=ke,_t=a(),bt=c("ul"),bt.innerHTML=In,Pe=a(),en=c("p"),en.textContent=fe,tn=a(),ce=c("ul"),ce.innerHTML=ot,Pn=a(),g(xt.$$.fragment),Tt=a(),vn=c("p"),vn.textContent=Bt,hn=a(),g(Ft.$$.fragment),nn=a(),X=c("p"),X.innerHTML=jt,Ye=a(),$e=c("p"),$e.textContent=ss,fn=a(),g(Re.$$.fragment),Xn=a(),g(ve.$$.fragment),sn=a(),se=c("div"),g(Vt.$$.fragment),V=a(),Mt=c("p"),Mt.innerHTML=S,qe=a(),Gn=c("p"),Gn.innerHTML=on,Ln=a(),g(gn.$$.fragment),at=a(),g(Et.$$.fragment),an=a(),te=c("div"),g(Ne.$$.fragment),Vn=a(),pe=c("p"),pe.textContent=Ct,Fe=a(),Oe=c("p"),Oe.innerHTML=Jt,zt=a(),He=c("div"),g(Ut.$$.fragment),Dt=a(),xn=c("p"),xn.textContent=$,C=a(),ge=c("ul"),ge.innerHTML=Ke,de=a(),me=c("div"),g(W.$$.fragment),oe=a(),Le=c("p"),Le.textContent=_e,Qt=a(),ne=c("div"),g(Y.$$.fragment),es=a(),Wt=c("p"),Wt.textContent=ts,En=a(),g(Rn.$$.fragment),h=a(),F=c("p"),F.innerHTML=Bn,Xe=a(),et=c("div"),g(ze.$$.fragment),be=a(),Te=c("p"),Te.innerHTML=Fn,Ue=a(),g(rt.$$.fragment),it=a(),Q=c("div"),g(Yn.$$.fragment),Qn=a(),On=c("p"),On.innerHTML=v,J=a(),St=c("p"),St.innerHTML=yt,jn=a(),ue=c("div"),g(Zt.$$.fragment),lt=a(),Cn=c("p"),Cn.textContent=rn,Sn=a(),dt=c("ul"),dt.innerHTML=Kn,fs=a(),os=c("div"),g(ms.$$.fragment),xs=a(),gs=c("p"),gs.textContent=Cs,Bs=a(),g(ls.$$.fragment),Fs=a(),_s=c("p"),_s.innerHTML=Js,Ms=a(),g(ds.$$.fragment),ys=a(),g(us.$$.fragment),ws=a(),Ts=c("p"),this.h()},l(o){const x=Zs("svelte-u9bgzb",document.head);e=p(x,"META",{name:!0,content:!0}),x.forEach(i),u=r(o),n=p(o,"P",{}),R(n).forEach(i),s=r(o),_(w.$$.fragment,o),t=r(o),k=p(o,"DIV",{class:!0,"data-svelte-h":!0}),m(k)!=="svelte-19va6f1"&&(k.innerHTML=ae),Z=r(o),_(z.$$.fragment,o),O=r(o),D=p(o,"P",{"data-svelte-h":!0}),m(D)!=="svelte-wyvay1"&&(D.innerHTML=U),K=r(o),f=p(o,"P",{"data-svelte-h":!0}),m(f)!=="svelte-vfdo9a"&&(f.textContent=j),Ee=r(o),Me=p(o,"P",{"data-svelte-h":!0}),m(Me)!=="svelte-yrk2ws"&&(Me.innerHTML=ns),ln=r(o),re=p(o,"P",{"data-svelte-h":!0}),m(re)!=="svelte-d89fny"&&(re.innerHTML=_n),De=r(o),_(pt.$$.fragment,o),tt=r(o),It=p(o,"UL",{"data-svelte-h":!0}),m(It)!=="svelte-1pw0ah6"&&(It.innerHTML=P),Gt=r(o),_(E.$$.fragment,o),nt=r(o),wt=p(o,"P",{"data-svelte-h":!0}),m(wt)!=="svelte-1cid2pe"&&(wt.innerHTML=bn),ee=r(o),kt=p(o,"P",{"data-svelte-h":!0}),m(kt)!=="svelte-1x11lxg"&&(kt.innerHTML=Jn),Rt=r(o),_(zn.$$.fragment,o),dn=r(o),he=p(o,"P",{"data-svelte-h":!0}),m(he)!=="svelte-djb2w0"&&(he.innerHTML=Un),qt=r(o),Qe=p(o,"P",{"data-svelte-h":!0}),m(Qe)!=="svelte-dj0ua3"&&(Qe.innerHTML=mt),At=r(o),_(je.$$.fragment,o),Tn=r(o),ut=p(o,"TABLE",{"data-svelte-h":!0}),m(ut)!=="svelte-4nxzk4"&&(ut.innerHTML=Mn),st=r(o),_(Pt.$$.fragment,o),H=r(o),Ce=p(o,"TABLE",{"data-svelte-h":!0}),m(Ce)!=="svelte-1q3rpuw"&&(Ce.innerHTML=cn),ht=r(o),_(Nt.$$.fragment,o),Dn=r(o),L=p(o,"P",{"data-svelte-h":!0}),m(L)!=="svelte-1204ph7"&&(L.textContent=Wn),Ht=r(o),_(We.$$.fragment,o),yn=r(o),Yt=p(o,"UL",{"data-svelte-h":!0}),m(Yt)!=="svelte-hz8xc"&&(Yt.innerHTML=N),ft=r(o),_(pn.$$.fragment,o),Se=r(o),Nn=p(o,"UL",{"data-svelte-h":!0}),m(Nn)!=="svelte-dwpyep"&&(Nn.innerHTML=An),ye=r(o),_(wn.$$.fragment,o),ie=r(o),Ze=p(o,"UL",{"data-svelte-h":!0}),m(Ze)!=="svelte-krd5yg"&&(Ze.innerHTML=kn),Ot=r(o),_(Ae.$$.fragment,o),Hn=r(o),A=p(o,"UL",{"data-svelte-h":!0}),m(A)!=="svelte-hvrgm2"&&(A.innerHTML=Lt),Kt=r(o),$t=p(o,"P",{"data-svelte-h":!0}),m($t)!=="svelte-cplu6u"&&($t.innerHTML=Je),Xt=r(o),Ie=p(o,"UL",{"data-svelte-h":!0}),m(Ie)!=="svelte-1w647ih"&&(Ie.innerHTML=Zn),we=r(o),Ge=p(o,"P",{"data-svelte-h":!0}),m(Ge)!=="svelte-liq2q7"&&(Ge.textContent=$n),mn=r(o),le=p(o,"UL",{"data-svelte-h":!0}),m(le)!=="svelte-1i3rzd0"&&(le.innerHTML=un),gt=r(o),vt=p(o,"P",{"data-svelte-h":!0}),m(vt)!=="svelte-1wntqpp"&&(vt.textContent=ke),_t=r(o),bt=p(o,"UL",{"data-svelte-h":!0}),m(bt)!=="svelte-1hcjkg2"&&(bt.innerHTML=In),Pe=r(o),en=p(o,"P",{"data-svelte-h":!0}),m(en)!=="svelte-lk14e4"&&(en.textContent=fe),tn=r(o),ce=p(o,"UL",{"data-svelte-h":!0}),m(ce)!=="svelte-ii18nw"&&(ce.innerHTML=ot),Pn=r(o),_(xt.$$.fragment,o),Tt=r(o),vn=p(o,"P",{"data-svelte-h":!0}),m(vn)!=="svelte-o3pzzu"&&(vn.textContent=Bt),hn=r(o),_(Ft.$$.fragment,o),nn=r(o),X=p(o,"P",{"data-svelte-h":!0}),m(X)!=="svelte-awcq03"&&(X.innerHTML=jt),Ye=r(o),$e=p(o,"P",{"data-svelte-h":!0}),m($e)!=="svelte-14hchid"&&($e.textContent=ss),fn=r(o),_(Re.$$.fragment,o),Xn=r(o),_(ve.$$.fragment,o),sn=r(o),se=p(o,"DIV",{class:!0});var as=R(se);_(Vt.$$.fragment,as),V=r(as),Mt=p(as,"P",{"data-svelte-h":!0}),m(Mt)!=="svelte-vbauyi"&&(Mt.innerHTML=S),qe=r(as),Gn=p(as,"P",{"data-svelte-h":!0}),m(Gn)!=="svelte-1mon8q7"&&(Gn.innerHTML=on),Ln=r(as),_(gn.$$.fragment,as),as.forEach(i),at=r(o),_(Et.$$.fragment,o),an=r(o),te=p(o,"DIV",{class:!0});var qn=R(te);_(Ne.$$.fragment,qn),Vn=r(qn),pe=p(qn,"P",{"data-svelte-h":!0}),m(pe)!=="svelte-10o6nt5"&&(pe.textContent=Ct),Fe=r(qn),Oe=p(qn,"P",{"data-svelte-h":!0}),m(Oe)!=="svelte-1tupggq"&&(Oe.innerHTML=Jt),zt=r(qn),He=p(qn,"DIV",{class:!0});var is=R(He);_(Ut.$$.fragment,is),Dt=r(is),xn=p(is,"P",{"data-svelte-h":!0}),m(xn)!=="svelte-t7qurq"&&(xn.textContent=$),C=r(is),ge=p(is,"UL",{"data-svelte-h":!0}),m(ge)!=="svelte-xi6653"&&(ge.innerHTML=Ke),is.forEach(i),de=r(qn),me=p(qn,"DIV",{class:!0});var hs=R(me);_(W.$$.fragment,hs),oe=r(hs),Le=p(hs,"P",{"data-svelte-h":!0}),m(Le)!=="svelte-b3k2yi"&&(Le.textContent=_e),hs.forEach(i),Qt=r(qn),ne=p(qn,"DIV",{class:!0});var cs=R(ne);_(Y.$$.fragment,cs),es=r(cs),Wt=p(cs,"P",{"data-svelte-h":!0}),m(Wt)!=="svelte-gn6wi7"&&(Wt.textContent=ts),En=r(cs),_(Rn.$$.fragment,cs),h=r(cs),F=p(cs,"P",{"data-svelte-h":!0}),m(F)!=="svelte-owoxgn"&&(F.innerHTML=Bn),cs.forEach(i),Xe=r(qn),et=p(qn,"DIV",{class:!0});var $s=R(et);_(ze.$$.fragment,$s),be=r($s),Te=p($s,"P",{"data-svelte-h":!0}),m(Te)!=="svelte-1f4f5kp"&&(Te.innerHTML=Fn),$s.forEach(i),qn.forEach(i),Ue=r(o),_(rt.$$.fragment,o),it=r(o),Q=p(o,"DIV",{class:!0});var rs=R(Q);_(Yn.$$.fragment,rs),Qn=r(rs),On=p(rs,"P",{"data-svelte-h":!0}),m(On)!=="svelte-88fhae"&&(On.innerHTML=v),J=r(rs),St=p(rs,"P",{"data-svelte-h":!0}),m(St)!=="svelte-1e2pjbq"&&(St.innerHTML=yt),jn=r(rs),ue=p(rs,"DIV",{class:!0});var bs=R(ue);_(Zt.$$.fragment,bs),lt=r(bs),Cn=p(bs,"P",{"data-svelte-h":!0}),m(Cn)!=="svelte-t7qurq"&&(Cn.textContent=rn),Sn=r(bs),dt=p(bs,"UL",{"data-svelte-h":!0}),m(dt)!=="svelte-xi6653"&&(dt.innerHTML=Kn),bs.forEach(i),fs=r(rs),os=p(rs,"DIV",{class:!0});var ps=R(os);_(ms.$$.fragment,ps),xs=r(ps),gs=p(ps,"P",{"data-svelte-h":!0}),m(gs)!=="svelte-gn6wi7"&&(gs.textContent=Cs),Bs=r(ps),_(ls.$$.fragment,ps),Fs=r(ps),_s=p(ps,"P",{"data-svelte-h":!0}),m(_s)!=="svelte-owoxgn"&&(_s.innerHTML=Js),ps.forEach(i),rs.forEach(i),Ms=r(o),_(ds.$$.fragment,o),ys=r(o),_(us.$$.fragment,o),ws=r(o),Ts=p(o,"P",{}),R(Ts).forEach(i),this.h()},h(){G(e,"name","hf:doc:metadata"),G(e,"content",Lo),G(k,"class","flex flex-wrap space-x-1"),G(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(He,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(os,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),G(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,x){l(document.head,e),d(o,u,x),d(o,n,x),d(o,s,x),b(w,o,x),d(o,t,x),d(o,k,x),d(o,Z,x),b(z,o,x),d(o,O,x),d(o,D,x),d(o,K,x),d(o,f,x),d(o,Ee,x),d(o,Me,x),d(o,ln,x),d(o,re,x),d(o,De,x),b(pt,o,x),d(o,tt,x),d(o,It,x),d(o,Gt,x),b(E,o,x),d(o,nt,x),d(o,wt,x),d(o,ee,x),d(o,kt,x),d(o,Rt,x),b(zn,o,x),d(o,dn,x),d(o,he,x),d(o,qt,x),d(o,Qe,x),d(o,At,x),b(je,o,x),d(o,Tn,x),d(o,ut,x),d(o,st,x),b(Pt,o,x),d(o,H,x),d(o,Ce,x),d(o,ht,x),b(Nt,o,x),d(o,Dn,x),d(o,L,x),d(o,Ht,x),b(We,o,x),d(o,yn,x),d(o,Yt,x),d(o,ft,x),b(pn,o,x),d(o,Se,x),d(o,Nn,x),d(o,ye,x),b(wn,o,x),d(o,ie,x),d(o,Ze,x),d(o,Ot,x),b(Ae,o,x),d(o,Hn,x),d(o,A,x),d(o,Kt,x),d(o,$t,x),d(o,Xt,x),d(o,Ie,x),d(o,we,x),d(o,Ge,x),d(o,mn,x),d(o,le,x),d(o,gt,x),d(o,vt,x),d(o,_t,x),d(o,bt,x),d(o,Pe,x),d(o,en,x),d(o,tn,x),d(o,ce,x),d(o,Pn,x),b(xt,o,x),d(o,Tt,x),d(o,vn,x),d(o,hn,x),b(Ft,o,x),d(o,nn,x),d(o,X,x),d(o,Ye,x),d(o,$e,x),d(o,fn,x),b(Re,o,x),d(o,Xn,x),b(ve,o,x),d(o,sn,x),d(o,se,x),b(Vt,se,null),l(se,V),l(se,Mt),l(se,qe),l(se,Gn),l(se,Ln),b(gn,se,null),d(o,at,x),b(Et,o,x),d(o,an,x),d(o,te,x),b(Ne,te,null),l(te,Vn),l(te,pe),l(te,Fe),l(te,Oe),l(te,zt),l(te,He),b(Ut,He,null),l(He,Dt),l(He,xn),l(He,C),l(He,ge),l(te,de),l(te,me),b(W,me,null),l(me,oe),l(me,Le),l(te,Qt),l(te,ne),b(Y,ne,null),l(ne,es),l(ne,Wt),l(ne,En),b(Rn,ne,null),l(ne,h),l(ne,F),l(te,Xe),l(te,et),b(ze,et,null),l(et,be),l(et,Te),d(o,Ue,x),b(rt,o,x),d(o,it,x),d(o,Q,x),b(Yn,Q,null),l(Q,Qn),l(Q,On),l(Q,J),l(Q,St),l(Q,jn),l(Q,ue),b(Zt,ue,null),l(ue,lt),l(ue,Cn),l(ue,Sn),l(ue,dt),l(Q,fs),l(Q,os),b(ms,os,null),l(os,xs),l(os,gs),l(os,Bs),b(ls,os,null),l(os,Fs),l(os,_s),d(o,Ms,x),b(ds,o,x),d(o,ys,x),b(us,o,x),d(o,ws,x),d(o,Ts,x),ks=!0},p(o,[x]){const as={};x&2&&(as.$$scope={dirty:x,ctx:o}),gn.$set(as);const qn={};x&2&&(qn.$$scope={dirty:x,ctx:o}),Rn.$set(qn);const is={};x&2&&(is.$$scope={dirty:x,ctx:o}),ls.$set(is);const hs={};x&2&&(hs.$$scope={dirty:x,ctx:o}),ds.$set(hs)},i(o){ks||(T(w.$$.fragment,o),T(z.$$.fragment,o),T(pt.$$.fragment,o),T(E.$$.fragment,o),T(zn.$$.fragment,o),T(je.$$.fragment,o),T(Pt.$$.fragment,o),T(Nt.$$.fragment,o),T(We.$$.fragment,o),T(pn.$$.fragment,o),T(wn.$$.fragment,o),T(Ae.$$.fragment,o),T(xt.$$.fragment,o),T(Ft.$$.fragment,o),T(Re.$$.fragment,o),T(ve.$$.fragment,o),T(Vt.$$.fragment,o),T(gn.$$.fragment,o),T(Et.$$.fragment,o),T(Ne.$$.fragment,o),T(Ut.$$.fragment,o),T(W.$$.fragment,o),T(Y.$$.fragment,o),T(Rn.$$.fragment,o),T(ze.$$.fragment,o),T(rt.$$.fragment,o),T(Yn.$$.fragment,o),T(Zt.$$.fragment,o),T(ms.$$.fragment,o),T(ls.$$.fragment,o),T(ds.$$.fragment,o),T(us.$$.fragment,o),ks=!0)},o(o){M(w.$$.fragment,o),M(z.$$.fragment,o),M(pt.$$.fragment,o),M(E.$$.fragment,o),M(zn.$$.fragment,o),M(je.$$.fragment,o),M(Pt.$$.fragment,o),M(Nt.$$.fragment,o),M(We.$$.fragment,o),M(pn.$$.fragment,o),M(wn.$$.fragment,o),M(Ae.$$.fragment,o),M(xt.$$.fragment,o),M(Ft.$$.fragment,o),M(Re.$$.fragment,o),M(ve.$$.fragment,o),M(Vt.$$.fragment,o),M(gn.$$.fragment,o),M(Et.$$.fragment,o),M(Ne.$$.fragment,o),M(Ut.$$.fragment,o),M(W.$$.fragment,o),M(Y.$$.fragment,o),M(Rn.$$.fragment,o),M(ze.$$.fragment,o),M(rt.$$.fragment,o),M(Yn.$$.fragment,o),M(Zt.$$.fragment,o),M(ms.$$.fragment,o),M(ls.$$.fragment,o),M(ds.$$.fragment,o),M(us.$$.fragment,o),ks=!1},d(o){o&&(i(u),i(n),i(s),i(t),i(k),i(Z),i(O),i(D),i(K),i(f),i(Ee),i(Me),i(ln),i(re),i(De),i(tt),i(It),i(Gt),i(nt),i(wt),i(ee),i(kt),i(Rt),i(dn),i(he),i(qt),i(Qe),i(At),i(Tn),i(ut),i(st),i(H),i(Ce),i(ht),i(Dn),i(L),i(Ht),i(yn),i(Yt),i(ft),i(Se),i(Nn),i(ye),i(ie),i(Ze),i(Ot),i(Hn),i(A),i(Kt),i($t),i(Xt),i(Ie),i(we),i(Ge),i(mn),i(le),i(gt),i(vt),i(_t),i(bt),i(Pe),i(en),i(tn),i(ce),i(Pn),i(Tt),i(vn),i(hn),i(nn),i(X),i(Ye),i($e),i(fn),i(Xn),i(sn),i(se),i(at),i(an),i(te),i(Ue),i(it),i(Q),i(Ms),i(ys),i(ws),i(Ts)),i(e),y(w,o),y(z,o),y(pt,o),y(E,o),y(zn,o),y(je,o),y(Pt,o),y(Nt,o),y(We,o),y(pn,o),y(wn,o),y(Ae,o),y(xt,o),y(Ft,o),y(Re,o),y(ve,o),y(Vt),y(gn),y(Et,o),y(Ne),y(Ut),y(W),y(Y),y(Rn),y(ze),y(rt,o),y(Yn),y(Zt),y(ms),y(ls),y(ds,o),y(us,o)}}}const Lo='{"title":"DistilBERT","local":"distilbert","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Usage tips","local":"usage-tips","sections":[{"title":"Using Scaled Dot Product Attention (SDPA)","local":"using-scaled-dot-product-attention-sdpa","sections":[{"title":"Training","local":"training","sections":[],"depth":4},{"title":"Inference","local":"inference","sections":[],"depth":4}],"depth":3}],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"Combining DistilBERT and Flash Attention 2","local":"combining-distilbert-and-flash-attention-2","sections":[],"depth":2},{"title":"DistilBertConfig","local":"transformers.DistilBertConfig","sections":[],"depth":2},{"title":"DistilBertTokenizer","local":"transformers.DistilBertTokenizer","sections":[],"depth":2},{"title":"DistilBertTokenizerFast","local":"transformers.DistilBertTokenizerFast","sections":[],"depth":2},{"title":"DistilBertModel","local":"transformers.DistilBertModel","sections":[],"depth":2},{"title":"DistilBertForMaskedLM","local":"transformers.DistilBertForMaskedLM","sections":[],"depth":2},{"title":"DistilBertForSequenceClassification","local":"transformers.DistilBertForSequenceClassification","sections":[],"depth":2},{"title":"DistilBertForMultipleChoice","local":"transformers.DistilBertForMultipleChoice","sections":[],"depth":2},{"title":"DistilBertForTokenClassification","local":"transformers.DistilBertForTokenClassification","sections":[],"depth":2},{"title":"DistilBertForQuestionAnswering","local":"transformers.DistilBertForQuestionAnswering","sections":[],"depth":2},{"title":"TFDistilBertModel","local":"transformers.TFDistilBertModel","sections":[],"depth":2},{"title":"TFDistilBertForMaskedLM","local":"transformers.TFDistilBertForMaskedLM","sections":[],"depth":2},{"title":"TFDistilBertForSequenceClassification","local":"transformers.TFDistilBertForSequenceClassification","sections":[],"depth":2},{"title":"TFDistilBertForMultipleChoice","local":"transformers.TFDistilBertForMultipleChoice","sections":[],"depth":2},{"title":"TFDistilBertForTokenClassification","local":"transformers.TFDistilBertForTokenClassification","sections":[],"depth":2},{"title":"TFDistilBertForQuestionAnswering","local":"transformers.TFDistilBertForQuestionAnswering","sections":[],"depth":2},{"title":"FlaxDistilBertModel","local":"transformers.FlaxDistilBertModel","sections":[],"depth":2},{"title":"FlaxDistilBertForMaskedLM","local":"transformers.FlaxDistilBertForMaskedLM","sections":[],"depth":2},{"title":"FlaxDistilBertForSequenceClassification","local":"transformers.FlaxDistilBertForSequenceClassification","sections":[],"depth":2},{"title":"FlaxDistilBertForMultipleChoice","local":"transformers.FlaxDistilBertForMultipleChoice","sections":[],"depth":2},{"title":"FlaxDistilBertForTokenClassification","local":"transformers.FlaxDistilBertForTokenClassification","sections":[],"depth":2},{"title":"FlaxDistilBertForQuestionAnswering","local":"transformers.FlaxDistilBertForQuestionAnswering","sections":[],"depth":2}],"depth":1}';function Xo(B){return Us(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ea extends Ds{constructor(e){super(),Ws(this,e,Xo,Ho,zs,{})}}export{ea as component}; | |
Xet Storage Details
- Size:
- 351 kB
- Xet hash:
- 84af3b1b4ed0d0c0680ce803c0db7acc4db16d845d3bb6c3c6ec73db81eba7b9
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.