import{S as iu,i as lu,s as du,e as n,k as p,w as M,t as r,M as cu,c as s,d as o,m as h,a,x as T,h as i,b as c,G as e,g as _,y as w,q as k,o as Q,B as v,v as pu,L as me}from"../../chunks/vendor-hf-doc-builder.js";import{T as $t}from"../../chunks/Tip-hf-doc-builder.js";import{D as z}from"../../chunks/Docstring-hf-doc-builder.js";import{C as X}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Z}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as he}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function hu(B){let d,y,g,u,b;return u=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFFEUUJlcnRNb2RlbCUyQyUyMFFEUUJlcnRDb25maWclMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwUURRQkVSVCUyMGJlcnQtYmFzZS11bmNhc2VkJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMFFEUUJlcnRDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMGZyb20lMjB0aGUlMjBiZXJ0LWJhc2UtdW5jYXNlZCUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwUURRQmVydE1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> QDQBertModel, QDQBertConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a QDQBERT bert-base-uncased style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = QDQBertConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the bert-base-uncased style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = QDQBertModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){d=n("p"),y=r("Examples:"),g=p(),M(u.$$.fragment)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Examples:"),m.forEach(o),g=h(l),T(u.$$.fragment,l)},m(l,m){_(l,d,m),e(d,y),_(l,g,m),w(u,l,m),b=!0},p:me,i(l){b||(k(u.$$.fragment,l),b=!0)},o(l){Q(u.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),v(u,l)}}}function mu(B){let d,y,g,u,b;return{c(){d=n("p"),y=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),u=r("Module"),b=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(m,"CODE",{});var j=a(g);u=i(j,"Module"),j.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,y),e(d,g),e(g,u),e(d,b)},d(l){l&&o(d)}}}function uu(B){let d,y,g,u,b;return u=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBRRFFCZXJ0TW9kZWwlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmJlcnQtYmFzZS11bmNhc2VkJTIyKSUwQW1vZGVsJTIwJTNEJTIwUURRQmVydE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, QDQBertModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = QDQBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){d=n("p"),y=r("Example:"),g=p(),M(u.$$.fragment)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Example:"),m.forEach(o),g=h(l),T(u.$$.fragment,l)},m(l,m){_(l,d,m),e(d,y),_(l,g,m),w(u,l,m),b=!0},p:me,i(l){b||(k(u.$$.fragment,l),b=!0)},o(l){Q(u.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),v(u,l)}}}function fu(B){let d,y,g,u,b;return{c(){d=n("p"),y=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),u=r("Module"),b=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(m,"CODE",{});var j=a(g);u=i(j,"Module"),j.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,y),e(d,g),e(g,u),e(d,b)},d(l){l&&o(d)}}}function gu(B){let d,y,g,u,b;return u=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBRRFFCZXJ0TE1IZWFkTW9kZWwlMkMlMjBRRFFCZXJ0Q29uZmlnJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJiZXJ0LWJhc2UtY2FzZWQlMjIpJTBBY29uZmlnJTIwJTNEJTIwUURRQmVydENvbmZpZy5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLWNhc2VkJTIyKSUwQWNvbmZpZy5pc19kZWNvZGVyJTIwJTNEJTIwVHJ1ZSUwQW1vZGVsJTIwJTNEJTIwUURRQmVydExNSGVhZE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJiZXJ0LWJhc2UtY2FzZWQlMjIlMkMlMjBjb25maWclM0Rjb25maWcpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFwcmVkaWN0aW9uX2xvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, QDQBertLMHeadModel, QDQBertConfig
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>config = QDQBertConfig.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>config.is_decoder = <span class="hljs-literal">True</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = QDQBertLMHeadModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>, config=config)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>prediction_logits = outputs.logits`}}),{c(){d=n("p"),y=r("Example:"),g=p(),M(u.$$.fragment)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Example:"),m.forEach(o),g=h(l),T(u.$$.fragment,l)},m(l,m){_(l,d,m),e(d,y),_(l,g,m),w(u,l,m),b=!0},p:me,i(l){b||(k(u.$$.fragment,l),b=!0)},o(l){Q(u.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),v(u,l)}}}function _u(B){let d,y,g,u,b;return{c(){d=n("p"),y=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),u=r("Module"),b=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(m,"CODE",{});var j=a(g);u=i(j,"Module"),j.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,y),e(d,g),e(g,u),e(d,b)},d(l){l&&o(d)}}}function bu(B){let d,y,g,u,b;return u=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBRRFFCZXJ0Rm9yTWFza2VkTE0lMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmJlcnQtYmFzZS11bmNhc2VkJTIyKSUwQW1vZGVsJTIwJTNEJTIwUURRQmVydEZvck1hc2tlZExNLmZyb21fcHJldHJhaW5lZCglMjJiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIyVGhlJTIwY2FwaXRhbCUyMG9mJTIwRnJhbmNlJTIwaXMlMjAlNUJNQVNLJTVELiUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEElMjMlMjByZXRyaWV2ZSUyMGluZGV4JTIwb2YlMjAlNUJNQVNLJTVEJTBBbWFza190b2tlbl9pbmRleCUyMCUzRCUyMChpbnB1dHMuaW5wdXRfaWRzJTIwJTNEJTNEJTIwdG9rZW5pemVyLm1hc2tfdG9rZW5faWQpJTVCMCU1RC5ub256ZXJvKGFzX3R1cGxlJTNEVHJ1ZSklNUIwJTVEJTBBJTBBcHJlZGljdGVkX3Rva2VuX2lkJTIwJTNEJTIwbG9naXRzJTVCMCUyQyUyMG1hc2tfdG9rZW5faW5kZXglNUQuYXJnbWF4KGF4aXMlM0QtMSklMEElMEFsYWJlbHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIyVGhlJTIwY2FwaXRhbCUyMG9mJTIwRnJhbmNlJTIwaXMlMjBQYXJpcy4lMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSU1QiUyMmlucHV0X2lkcyUyMiU1RCUwQSUyMyUyMG1hc2slMjBsYWJlbHMlMjBvZiUyMG5vbi0lNUJNQVNLJTVEJTIwdG9rZW5zJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2gud2hlcmUoaW5wdXRzLmlucHV0X2lkcyUyMCUzRCUzRCUyMHRva2VuaXplci5tYXNrX3Rva2VuX2lkJTJDJTIwbGFiZWxzJTJDJTIwLTEwMCklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMlMkMlMjBsYWJlbHMlM0RsYWJlbHMp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, QDQBertForMaskedLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = QDQBertForMaskedLM.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;The capital of France is [MASK].&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># retrieve index of [MASK]</span>
<span class="hljs-meta">&gt;&gt;&gt; </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">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span>labels = tokenizer(<span class="hljs-string">&quot;The capital of France is Paris.&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># mask labels of non-[MASK] tokens</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.where(inputs.input_ids == tokenizer.mask_token_id, labels, -<span class="hljs-number">100</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, labels=labels)`}}),{c(){d=n("p"),y=r("Example:"),g=p(),M(u.$$.fragment)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Example:"),m.forEach(o),g=h(l),T(u.$$.fragment,l)},m(l,m){_(l,d,m),e(d,y),_(l,g,m),w(u,l,m),b=!0},p:me,i(l){b||(k(u.$$.fragment,l),b=!0)},o(l){Q(u.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),v(u,l)}}}function yu(B){let d,y,g,u,b;return{c(){d=n("p"),y=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),u=r("Module"),b=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(m,"CODE",{});var j=a(g);u=i(j,"Module"),j.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,y),e(d,g),e(g,u),e(d,b)},d(l){l&&o(d)}}}function Mu(B){let d,y,g,u,b;return u=new X({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMFFEUUJlcnRGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBRRFFCZXJ0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX2NsYXNzX2lkJTIwJTNEJTIwbG9naXRzLmFyZ21heCgpLml0ZW0oKSUwQSUwQSUyMyUyMFRvJTIwdHJhaW4lMjBhJTIwbW9kZWwlMjBvbiUyMCU2MG51bV9sYWJlbHMlNjAlMjBjbGFzc2VzJTJDJTIweW91JTIwY2FuJTIwcGFzcyUyMCU2MG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTYwJTIwdG8lMjAlNjAuZnJvbV9wcmV0cmFpbmVkKC4uLiklNjAlMEFudW1fbGFiZWxzJTIwJTNEJTIwbGVuKG1vZGVsLmNvbmZpZy5pZDJsYWJlbCklMEFtb2RlbCUyMCUzRCUyMFFEUUJlcnRGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJiZXJ0LWJhc2UtdW5jYXNlZCUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTVEKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, QDQBertForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = QDQBertForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_class_id = logits.argmax().item()

<span class="hljs-meta">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = QDQBertForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>, num_labels=num_labels)

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.tensor([<span class="hljs-number">1</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){d=n("p"),y=r("Example of single-label classification:"),g=p(),M(u.$$.fragment)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Example of single-label classification:"),m.forEach(o),g=h(l),T(u.$$.fragment,l)},m(l,m){_(l,d,m),e(d,y),_(l,g,m),w(u,l,m),b=!0},p:me,i(l){b||(k(u.$$.fragment,l),b=!0)},o(l){Q(u.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),v(u,l)}}}function Tu(B){let d,y,g,u,b;return u=new X({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMFFEUUJlcnRGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBRRFFCZXJ0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLXVuY2FzZWQlMjIlMkMlMjBwcm9ibGVtX3R5cGUlM0QlMjJtdWx0aV9sYWJlbF9jbGFzc2lmaWNhdGlvbiUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfY2xhc3NfaWRzJTIwJTNEJTIwdG9yY2guYXJhbmdlKDAlMkMlMjBsb2dpdHMuc2hhcGUlNUItMSU1RCklNUJ0b3JjaC5zaWdtb2lkKGxvZ2l0cykuc3F1ZWV6ZShkaW0lM0QwKSUyMCUzRSUyMDAuNSU1RCUwQSUwQSUyMyUyMFRvJTIwdHJhaW4lMjBhJTIwbW9kZWwlMjBvbiUyMCU2MG51bV9sYWJlbHMlNjAlMjBjbGFzc2VzJTJDJTIweW91JTIwY2FuJTIwcGFzcyUyMCU2MG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTYwJTIwdG8lMjAlNjAuZnJvbV9wcmV0cmFpbmVkKC4uLiklNjAlMEFudW1fbGFiZWxzJTIwJTNEJTIwbGVuKG1vZGVsLmNvbmZpZy5pZDJsYWJlbCklMEFtb2RlbCUyMCUzRCUyMFFEUUJlcnRGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJiZXJ0LWJhc2UtdW5jYXNlZCUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIlMEEpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2guc3VtKCUwQSUyMCUyMCUyMCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwub25lX2hvdChwcmVkaWN0ZWRfY2xhc3NfaWRzJTVCTm9uZSUyQyUyMCUzQSU1RC5jbG9uZSgpJTJDJTIwbnVtX2NsYXNzZXMlM0RudW1fbGFiZWxzKSUyQyUyMGRpbSUzRDElMEEpLnRvKHRvcmNoLmZsb2F0KSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, QDQBertForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = QDQBertForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>, problem_type=<span class="hljs-string">&quot;multi_label_classification&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </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>) &gt; <span class="hljs-number">0.5</span>]

<span class="hljs-meta">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = QDQBertForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;bert-base-uncased&quot;</span>, num_labels=num_labels, problem_type=<span class="hljs-string">&quot;multi_label_classification&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){d=n("p"),y=r("Example of multi-label classification:"),g=p(),M(u.$$.fragment)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Example of multi-label classification:"),m.forEach(o),g=h(l),T(u.$$.fragment,l)},m(l,m){_(l,d,m),e(d,y),_(l,g,m),w(u,l,m),b=!0},p:me,i(l){b||(k(u.$$.fragment,l),b=!0)},o(l){Q(u.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),v(u,l)}}}function wu(B){let d,y,g,u,b;return{c(){d=n("p"),y=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),u=r("Module"),b=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(m,"CODE",{});var j=a(g);u=i(j,"Module"),j.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,y),e(d,g),e(g,u),e(d,b)},d(l){l&&o(d)}}}function ku(B){let d,y,g,u,b;return u=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBRRFFCZXJ0Rm9yTmV4dFNlbnRlbmNlUHJlZGljdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBRRFFCZXJ0Rm9yTmV4dFNlbnRlbmNlUHJlZGljdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIySW4lMjBJdGFseSUyQyUyMHBpenphJTIwc2VydmVkJTIwaW4lMjBmb3JtYWwlMjBzZXR0aW5ncyUyQyUyMHN1Y2glMjBhcyUyMGF0JTIwYSUyMHJlc3RhdXJhbnQlMkMlMjBpcyUyMHByZXNlbnRlZCUyMHVuc2xpY2VkLiUyMiUwQW5leHRfc2VudGVuY2UlMjAlM0QlMjAlMjJUaGUlMjBza3klMjBpcyUyMGJsdWUlMjBkdWUlMjB0byUyMHRoZSUyMHNob3J0ZXIlMjB3YXZlbGVuZ3RoJTIwb2YlMjBibHVlJTIwbGlnaHQuJTIyJTBBZW5jb2RpbmclMjAlM0QlMjB0b2tlbml6ZXIocHJvbXB0JTJDJTIwbmV4dF9zZW50ZW5jZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqZW5jb2RpbmclMkMlMjBsYWJlbHMlM0R0b3JjaC5Mb25nVGVuc29yKCU1QjElNUQpKSUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRzJTBBYXNzZXJ0JTIwbG9naXRzJTVCMCUyQyUyMDAlNUQlMjAlM0MlMjBsb2dpdHMlNUIwJTJDJTIwMSU1RCUyMCUyMCUyMyUyMG5leHQlMjBzZW50ZW5jZSUyMHdhcyUyMHJhbmRvbQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, QDQBertForNextSentencePrediction
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = QDQBertForNextSentencePrediction.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>next_sentence = <span class="hljs-string">&quot;The sky is blue due to the shorter wavelength of blue light.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(prompt, next_sentence, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**encoding, labels=torch.LongTensor([<span class="hljs-number">1</span>]))
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">assert</span> logits[<span class="hljs-number">0</span>, <span class="hljs-number">0</span>] &lt; logits[<span class="hljs-number">0</span>, <span class="hljs-number">1</span>]  <span class="hljs-comment"># next sentence was random</span>`}}),{c(){d=n("p"),y=r("Example:"),g=p(),M(u.$$.fragment)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Example:"),m.forEach(o),g=h(l),T(u.$$.fragment,l)},m(l,m){_(l,d,m),e(d,y),_(l,g,m),w(u,l,m),b=!0},p:me,i(l){b||(k(u.$$.fragment,l),b=!0)},o(l){Q(u.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),v(u,l)}}}function Qu(B){let d,y,g,u,b;return{c(){d=n("p"),y=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),u=r("Module"),b=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(m,"CODE",{});var j=a(g);u=i(j,"Module"),j.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,y),e(d,g),e(g,u),e(d,b)},d(l){l&&o(d)}}}function vu(B){let d,y,g,u,b;return u=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBRRFFCZXJ0Rm9yTXVsdGlwbGVDaG9pY2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmJlcnQtYmFzZS11bmNhc2VkJTIyKSUwQW1vZGVsJTIwJTNEJTIwUURRQmVydEZvck11bHRpcGxlQ2hvaWNlLmZyb21fcHJldHJhaW5lZCglMjJiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJJbiUyMEl0YWx5JTJDJTIwcGl6emElMjBzZXJ2ZWQlMjBpbiUyMGZvcm1hbCUyMHNldHRpbmdzJTJDJTIwc3VjaCUyMGFzJTIwYXQlMjBhJTIwcmVzdGF1cmFudCUyQyUyMGlzJTIwcHJlc2VudGVkJTIwdW5zbGljZWQuJTIyJTBBY2hvaWNlMCUyMCUzRCUyMCUyMkl0JTIwaXMlMjBlYXRlbiUyMHdpdGglMjBhJTIwZm9yayUyMGFuZCUyMGElMjBrbmlmZS4lMjIlMEFjaG9pY2UxJTIwJTNEJTIwJTIySXQlMjBpcyUyMGVhdGVuJTIwd2hpbGUlMjBoZWxkJTIwaW4lMjB0aGUlMjBoYW5kLiUyMiUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvcigwKS51bnNxdWVlemUoMCklMjAlMjAlMjMlMjBjaG9pY2UwJTIwaXMlMjBjb3JyZWN0JTIwKGFjY29yZGluZyUyMHRvJTIwV2lraXBlZGlhJTIwJTNCKSklMkMlMjBiYXRjaCUyMHNpemUlMjAxJTBBJTBBZW5jb2RpbmclMjAlM0QlMjB0b2tlbml6ZXIoJTVCcHJvbXB0JTJDJTIwcHJvbXB0JTVEJTJDJTIwJTVCY2hvaWNlMCUyQyUyMGNob2ljZTElNUQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTJDJTIwcGFkZGluZyUzRFRydWUpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqJTdCayUzQSUyMHYudW5zcXVlZXplKDApJTIwZm9yJTIwayUyQyUyMHYlMjBpbiUyMGVuY29kaW5nLml0ZW1zKCklN0QlMkMlMjBsYWJlbHMlM0RsYWJlbHMpJTIwJTIwJTIzJTIwYmF0Y2glMjBzaXplJTIwaXMlMjAxJTBBJTBBJTIzJTIwdGhlJTIwbGluZWFyJTIwY2xhc3NpZmllciUyMHN0aWxsJTIwbmVlZHMlMjB0byUyMGJlJTIwdHJhaW5lZCUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3MlMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, QDQBertForMultipleChoice
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = QDQBertForMultipleChoice.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>choice0 = <span class="hljs-string">&quot;It is eaten with a fork and a knife.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>choice1 = <span class="hljs-string">&quot;It is eaten while held in the hand.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span>encoding = tokenizer([prompt, prompt], [choice0, choice1], return_tensors=<span class="hljs-string">&quot;pt&quot;</span>, padding=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span><span class="hljs-comment"># the linear classifier still needs to be trained</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){d=n("p"),y=r("Example:"),g=p(),M(u.$$.fragment)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Example:"),m.forEach(o),g=h(l),T(u.$$.fragment,l)},m(l,m){_(l,d,m),e(d,y),_(l,g,m),w(u,l,m),b=!0},p:me,i(l){b||(k(u.$$.fragment,l),b=!0)},o(l){Q(u.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),v(u,l)}}}function Bu(B){let d,y,g,u,b;return{c(){d=n("p"),y=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),u=r("Module"),b=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(m,"CODE",{});var j=a(g);u=i(j,"Module"),j.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,y),e(d,g),e(g,u),e(d,b)},d(l){l&&o(d)}}}function ju(B){let d,y,g,u,b;return u=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBRRFFCZXJ0Rm9yVG9rZW5DbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBRRFFCZXJ0Rm9yVG9rZW5DbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyYmVydC1iYXNlLXVuY2FzZWQlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUwQSUyMCUyMCUyMCUyMCUyMkh1Z2dpbmdGYWNlJTIwaXMlMjBhJTIwY29tcGFueSUyMGJhc2VkJTIwaW4lMjBQYXJpcyUyMGFuZCUyME5ldyUyMFlvcmslMjIlMkMlMjBhZGRfc3BlY2lhbF90b2tlbnMlM0RGYWxzZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMEEpJTBBJTBBd2l0aCUyMHRvcmNoLm5vX2dyYWQoKSUzQSUwQSUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEElMEFwcmVkaWN0ZWRfdG9rZW5fY2xhc3NfaWRzJTIwJTNEJTIwbG9naXRzLmFyZ21heCgtMSklMEElMEElMjMlMjBOb3RlJTIwdGhhdCUyMHRva2VucyUyMGFyZSUyMGNsYXNzaWZpZWQlMjByYXRoZXIlMjB0aGVuJTIwaW5wdXQlMjB3b3JkcyUyMHdoaWNoJTIwbWVhbnMlMjB0aGF0JTBBJTIzJTIwdGhlcmUlMjBtaWdodCUyMGJlJTIwbW9yZSUyMHByZWRpY3RlZCUyMHRva2VuJTIwY2xhc3NlcyUyMHRoYW4lMjB3b3Jkcy4lMEElMjMlMjBNdWx0aXBsZSUyMHRva2VuJTIwY2xhc3NlcyUyMG1pZ2h0JTIwYWNjb3VudCUyMGZvciUyMHRoZSUyMHNhbWUlMjB3b3JkJTBBcHJlZGljdGVkX3Rva2Vuc19jbGFzc2VzJTIwJTNEJTIwJTVCbW9kZWwuY29uZmlnLmlkMmxhYmVsJTVCdC5pdGVtKCklNUQlMjBmb3IlMjB0JTIwaW4lMjBwcmVkaWN0ZWRfdG9rZW5fY2xhc3NfaWRzJTVCMCU1RCU1RCUwQSUwQWxhYmVscyUyMCUzRCUyMHByZWRpY3RlZF90b2tlbl9jbGFzc19pZHMlMEFsb3NzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMlMkMlMjBsYWJlbHMlM0RsYWJlbHMpLmxvc3M=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, QDQBertForTokenClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = QDQBertForTokenClassification.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;HuggingFace is a company based in Paris and New York&quot;</span>, add_special_tokens=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits

<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_token_class_ids = logits.argmax(-<span class="hljs-number">1</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Note that tokens are classified rather then input words which means that</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># there might be more predicted token classes than words.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Multiple token classes might account for the same word</span>
<span class="hljs-meta">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span>labels = predicted_token_class_ids
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = model(**inputs, labels=labels).loss`}}),{c(){d=n("p"),y=r("Example:"),g=p(),M(u.$$.fragment)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Example:"),m.forEach(o),g=h(l),T(u.$$.fragment,l)},m(l,m){_(l,d,m),e(d,y),_(l,g,m),w(u,l,m),b=!0},p:me,i(l){b||(k(u.$$.fragment,l),b=!0)},o(l){Q(u.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),v(u,l)}}}function Ju(B){let d,y,g,u,b;return{c(){d=n("p"),y=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),u=r("Module"),b=r(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(m,"CODE",{});var j=a(g);u=i(j,"Module"),j.forEach(o),b=i(m,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),m.forEach(o)},m(l,m){_(l,d,m),e(d,y),e(d,g),e(g,u),e(d,b)},d(l){l&&o(d)}}}function $u(B){let d,y,g,u,b;return u=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBRRFFCZXJ0Rm9yUXVlc3Rpb25BbnN3ZXJpbmclMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmJlcnQtYmFzZS11bmNhc2VkJTIyKSUwQW1vZGVsJTIwJTNEJTIwUURRQmVydEZvclF1ZXN0aW9uQW5zd2VyaW5nLmZyb21fcHJldHJhaW5lZCglMjJiZXJ0LWJhc2UtdW5jYXNlZCUyMiklMEElMEFxdWVzdGlvbiUyQyUyMHRleHQlMjAlM0QlMjAlMjJXaG8lMjB3YXMlMjBKaW0lMjBIZW5zb24lM0YlMjIlMkMlMjAlMjJKaW0lMjBIZW5zb24lMjB3YXMlMjBhJTIwbmljZSUyMHB1cHBldCUyMiUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihxdWVzdGlvbiUyQyUyMHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBYW5zd2VyX3N0YXJ0X2luZGV4JTIwJTNEJTIwb3V0cHV0cy5zdGFydF9sb2dpdHMuYXJnbWF4KCklMEFhbnN3ZXJfZW5kX2luZGV4JTIwJTNEJTIwb3V0cHV0cy5lbmRfbG9naXRzLmFyZ21heCgpJTBBJTBBcHJlZGljdF9hbnN3ZXJfdG9rZW5zJTIwJTNEJTIwaW5wdXRzLmlucHV0X2lkcyU1QjAlMkMlMjBhbnN3ZXJfc3RhcnRfaW5kZXglMjAlM0ElMjBhbnN3ZXJfZW5kX2luZGV4JTIwJTJCJTIwMSU1RCUwQSUwQSUyMyUyMHRhcmdldCUyMGlzJTIwJTIybmljZSUyMHB1cHBldCUyMiUwQXRhcmdldF9zdGFydF9pbmRleCUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxNCU1RCklMEF0YXJnZXRfZW5kX2luZGV4JTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QjE1JTVEKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMHN0YXJ0X3Bvc2l0aW9ucyUzRHRhcmdldF9zdGFydF9pbmRleCUyQyUyMGVuZF9wb3NpdGlvbnMlM0R0YXJnZXRfZW5kX2luZGV4KSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3M=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, QDQBertForQuestionAnswering
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = QDQBertForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>question, text = <span class="hljs-string">&quot;Who was Jim Henson?&quot;</span>, <span class="hljs-string">&quot;Jim Henson was a nice puppet&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(question, text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>answer_start_index = outputs.start_logits.argmax()
<span class="hljs-meta">&gt;&gt;&gt; </span>answer_end_index = outputs.end_logits.argmax()

<span class="hljs-meta">&gt;&gt;&gt; </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">&gt;&gt;&gt; </span><span class="hljs-comment"># target is &quot;nice puppet&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>target_start_index = torch.tensor([<span class="hljs-number">14</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>target_end_index = torch.tensor([<span class="hljs-number">15</span>])

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss`}}),{c(){d=n("p"),y=r("Example:"),g=p(),M(u.$$.fragment)},l(l){d=s(l,"P",{});var m=a(d);y=i(m,"Example:"),m.forEach(o),g=h(l),T(u.$$.fragment,l)},m(l,m){_(l,d,m),e(d,y),_(l,g,m),w(u,l,m),b=!0},p:me,i(l){b||(k(u.$$.fragment,l),b=!0)},o(l){Q(u.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),v(u,l)}}}function zu(B){let d,y,g,u,b,l,m,j,Nr,ya,ue,xe,Gn,zt,Rr,Vn,Gr,Ma,Ze,Vr,Ut,Xr,Ar,Ta,Ko,Sr,wa,en,Xn,Pr,ka,tn,Lr,Qa,A,An,Sn,Hr,Yr,Pn,Ne,Or,Et,Kr,ei,Ln,ti,oi,Hn,Ft,ni,Yn,si,ai,ri,On,Ct,ii,on,li,di,va,Re,ci,qt,pi,hi,Ba,fe,Ge,Kn,Wt,mi,es,ui,ja,U,fi,ts,gi,_i,Dt,bi,yi,os,Mi,Ti,ns,wi,ki,It,Qi,vi,Ja,Ve,Bi,ss,ji,Ji,$a,nn,$i,za,xt,Ua,ge,Xe,as,Zt,zi,rs,Ui,Ea,sn,Ei,Fa,Nt,Ca,_e,Ae,is,Rt,Fi,ls,Ci,qa,ne,qi,Gt,Wi,Di,Vt,Ii,xi,Wa,Xt,Da,be,Se,ds,At,Zi,cs,Ni,Ia,E,ps,an,Ri,Gi,hs,rn,Vi,Xi,ms,ln,Ai,Si,us,dn,Pi,Li,fs,cn,Hi,Yi,gs,pn,Oi,xa,ye,Pe,_s,St,Ki,bs,el,Za,V,Pt,tl,Me,ol,hn,nl,sl,Lt,al,rl,il,Te,ll,mn,dl,cl,un,pl,hl,ml,Le,Na,we,He,ys,Ht,ul,Ms,fl,Ra,J,Yt,gl,Ts,_l,bl,Ot,yl,fn,Ml,Tl,wl,Kt,kl,eo,Ql,vl,Bl,to,jl,oo,Jl,$l,zl,$,Ul,ws,El,Fl,ks,Cl,ql,Qs,Wl,Dl,vs,Il,xl,Bs,Zl,Nl,js,Rl,Gl,Vl,S,no,Xl,ke,Al,gn,Sl,Pl,Js,Ll,Hl,Yl,Ye,Ol,Oe,Ga,Qe,Ke,$s,so,Kl,zs,ed,Va,F,ao,td,ro,od,Us,nd,sd,ad,io,rd,_n,id,ld,dd,lo,cd,co,pd,hd,md,P,po,ud,ve,fd,bn,gd,_d,Es,bd,yd,Md,et,Td,tt,Xa,Be,ot,Fs,ho,wd,Cs,kd,Aa,C,mo,Qd,uo,vd,qs,Bd,jd,Jd,fo,$d,yn,zd,Ud,Ed,go,Fd,_o,Cd,qd,Wd,L,bo,Dd,je,Id,Mn,xd,Zd,Ws,Nd,Rd,Gd,nt,Vd,st,Sa,Je,at,Ds,yo,Xd,Is,Ad,Pa,q,Mo,Sd,xs,Pd,Ld,To,Hd,Tn,Yd,Od,Kd,wo,ec,ko,tc,oc,nc,N,Qo,sc,$e,ac,wn,rc,ic,Zs,lc,dc,cc,rt,pc,it,hc,lt,La,ze,dt,Ns,vo,mc,Rs,uc,Ha,W,Bo,fc,jo,gc,Gs,_c,bc,yc,Jo,Mc,kn,Tc,wc,kc,$o,Qc,zo,vc,Bc,jc,H,Uo,Jc,Ue,$c,Qn,zc,Uc,Vs,Ec,Fc,Cc,ct,qc,pt,Ya,Ee,ht,Xs,Eo,Wc,As,Dc,Oa,D,Fo,Ic,Ss,xc,Zc,Co,Nc,vn,Rc,Gc,Vc,qo,Xc,Wo,Ac,Sc,Pc,Y,Do,Lc,Fe,Hc,Bn,Yc,Oc,Ps,Kc,ep,tp,mt,op,ut,Ka,Ce,ft,Ls,Io,np,Hs,sp,er,I,xo,ap,Ys,rp,ip,Zo,lp,jn,dp,cp,pp,No,hp,Ro,mp,up,fp,O,Go,gp,qe,_p,Jn,bp,yp,Os,Mp,Tp,wp,gt,kp,_t,tr,We,bt,Ks,Vo,Qp,ea,vp,or,x,Xo,Bp,De,jp,ta,Jp,$p,oa,zp,Up,Ep,Ao,Fp,$n,Cp,qp,Wp,So,Dp,Po,Ip,xp,Zp,K,Lo,Np,Ie,Rp,zn,Gp,Vp,na,Xp,Ap,Sp,yt,Pp,Mt,nr;return l=new Z({}),zt=new Z({}),Wt=new Z({}),xt=new X({props:{code:"aW1wb3J0JTIwcHl0b3JjaF9xdWFudGl6YXRpb24ubm4lMjBhcyUyMHF1YW50X25uJTBBZnJvbSUyMHB5dG9yY2hfcXVhbnRpemF0aW9uLnRlbnNvcl9xdWFudCUyMGltcG9ydCUyMFF1YW50RGVzY3JpcHRvciUwQSUwQSUyMyUyMFRoZSUyMGRlZmF1bHQlMjB0ZW5zb3IlMjBxdWFudGl6ZXIlMjBpcyUyMHNldCUyMHRvJTIwdXNlJTIwTWF4JTIwY2FsaWJyYXRpb24lMjBtZXRob2QlMEFpbnB1dF9kZXNjJTIwJTNEJTIwUXVhbnREZXNjcmlwdG9yKG51bV9iaXRzJTNEOCUyQyUyMGNhbGliX21ldGhvZCUzRCUyMm1heCUyMiklMEElMjMlMjBUaGUlMjBkZWZhdWx0JTIwdGVuc29yJTIwcXVhbnRpemVyJTIwaXMlMjBzZXQlMjB0byUyMGJlJTIwcGVyLWNoYW5uZWwlMjBxdWFudGl6YXRpb24lMjBmb3IlMjB3ZWlnaHRzJTBBd2VpZ2h0X2Rlc2MlMjAlM0QlMjBRdWFudERlc2NyaXB0b3IobnVtX2JpdHMlM0Q4JTJDJTIwYXhpcyUzRCgoMCUyQykpKSUwQXF1YW50X25uLlF1YW50TGluZWFyLnNldF9kZWZhdWx0X3F1YW50X2Rlc2NfaW5wdXQoaW5wdXRfZGVzYyklMEFxdWFudF9ubi5RdWFudExpbmVhci5zZXRfZGVmYXVsdF9xdWFudF9kZXNjX3dlaWdodCh3ZWlnaHRfZGVzYyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> pytorch_quantization.nn <span class="hljs-keyword">as</span> quant_nn
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> pytorch_quantization.tensor_quant <span class="hljs-keyword">import</span> QuantDescriptor

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># The default tensor quantizer is set to use Max calibration method</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>input_desc = QuantDescriptor(num_bits=<span class="hljs-number">8</span>, calib_method=<span class="hljs-string">&quot;max&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># The default tensor quantizer is set to be per-channel quantization for weights</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>weight_desc = QuantDescriptor(num_bits=<span class="hljs-number">8</span>, axis=((<span class="hljs-number">0</span>,)))
<span class="hljs-meta">&gt;&gt;&gt; </span>quant_nn.QuantLinear.set_default_quant_desc_input(input_desc)
<span class="hljs-meta">&gt;&gt;&gt; </span>quant_nn.QuantLinear.set_default_quant_desc_weight(weight_desc)`}}),Zt=new Z({}),Nt=new X({props:{code:"JTIzJTIwRmluZCUyMHRoZSUyMFRlbnNvclF1YW50aXplciUyMGFuZCUyMGVuYWJsZSUyMGNhbGlicmF0aW9uJTBBZm9yJTIwbmFtZSUyQyUyMG1vZHVsZSUyMGluJTIwbW9kZWwubmFtZWRfbW9kdWxlcygpJTNBJTBBJTIwJTIwJTIwJTIwaWYlMjBuYW1lLmVuZHN3aXRoKCUyMl9pbnB1dF9xdWFudGl6ZXIlMjIpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbW9kdWxlLmVuYWJsZV9jYWxpYigpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbW9kdWxlLmRpc2FibGVfcXVhbnQoKSUyMCUyMCUyMyUyMFVzZSUyMGZ1bGwlMjBwcmVjaXNpb24lMjBkYXRhJTIwdG8lMjBjYWxpYnJhdGUlMEElMEElMjMlMjBGZWVkaW5nJTIwZGF0YSUyMHNhbXBsZXMlMEFtb2RlbCh4KSUwQSUyMyUyMC4uLiUwQSUwQSUyMyUyMEZpbmFsaXplJTIwY2FsaWJyYXRpb24lMEFmb3IlMjBuYW1lJTJDJTIwbW9kdWxlJTIwaW4lMjBtb2RlbC5uYW1lZF9tb2R1bGVzKCklM0ElMEElMjAlMjAlMjAlMjBpZiUyMG5hbWUuZW5kc3dpdGgoJTIyX2lucHV0X3F1YW50aXplciUyMiklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBtb2R1bGUubG9hZF9jYWxpYl9hbWF4KCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBtb2R1bGUuZW5hYmxlX3F1YW50KCklMEElMEElMjMlMjBJZiUyMHJ1bm5pbmclMjBvbiUyMEdQVSUyQyUyMGl0JTIwbmVlZHMlMjB0byUyMGNhbGwlMjAuY3VkYSgpJTIwYWdhaW4lMjBiZWNhdXNlJTIwbmV3JTIwdGVuc29ycyUyMHdpbGwlMjBiZSUyMGNyZWF0ZWQlMjBieSUyMGNhbGlicmF0aW9uJTIwcHJvY2VzcyUwQW1vZGVsLmN1ZGEoKSUwQSUwQSUyMyUyMEtlZXAlMjBydW5uaW5nJTIwdGhlJTIwcXVhbnRpemVkJTIwbW9kZWwlMEElMjMlMjAuLi4=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Find the TensorQuantizer and enable calibration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> name, module <span class="hljs-keyword">in</span> model.named_modules():
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> name.endswith(<span class="hljs-string">&quot;_input_quantizer&quot;</span>):
<span class="hljs-meta">... </span>        module.enable_calib()
<span class="hljs-meta">... </span>        module.disable_quant()  <span class="hljs-comment"># Use full precision data to calibrate</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Feeding data samples</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model(x)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># ...</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Finalize calibration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> name, module <span class="hljs-keyword">in</span> model.named_modules():
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> name.endswith(<span class="hljs-string">&quot;_input_quantizer&quot;</span>):
<span class="hljs-meta">... </span>        module.load_calib_amax()
<span class="hljs-meta">... </span>        module.enable_quant()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># If running on GPU, it needs to call .cuda() again because new tensors will be created by calibration process</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model.cuda()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Keep running the quantized model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># ...</span>`}}),Rt=new Z({}),Xt=new X({props:{code:"ZnJvbSUyMHB5dG9yY2hfcXVhbnRpemF0aW9uLm5uJTIwaW1wb3J0JTIwVGVuc29yUXVhbnRpemVyJTBBJTBBVGVuc29yUXVhbnRpemVyLnVzZV9mYl9mYWtlX3F1YW50JTIwJTNEJTIwVHJ1ZSUwQSUwQSUyMyUyMExvYWQlMjB0aGUlMjBjYWxpYnJhdGVkJTIwbW9kZWwlMEEuLi4lMEElMjMlMjBPTk5YJTIwZXhwb3J0JTBBdG9yY2gub25ueC5leHBvcnQoLi4uKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> pytorch_quantization.nn <span class="hljs-keyword">import</span> TensorQuantizer

<span class="hljs-meta">&gt;&gt;&gt; </span>TensorQuantizer.use_fb_fake_quant = <span class="hljs-literal">True</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Load the calibrated model</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>...
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># ONNX export</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>torch.onnx.export(...)`}}),At=new Z({}),St=new Z({}),Pt=new z({props:{name:"class transformers.QDQBertConfig",anchor:"transformers.QDQBertConfig",parameters:[{name:"vocab_size",val:" = 30522"},{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"intermediate_size",val:" = 3072"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout_prob",val:" = 0.1"},{name:"attention_probs_dropout_prob",val:" = 0.1"},{name:"max_position_embeddings",val:" = 512"},{name:"type_vocab_size",val:" = 2"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"use_cache",val:" = True"},{name:"pad_token_id",val:" = 1"},{name:"bos_token_id",val:" = 0"},{name:"eos_token_id",val:" = 2"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.QDQBertConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) &#x2014;
Vocabulary size of the QDQBERT model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertModel">QDQBertModel</a>.`,name:"vocab_size"},{anchor:"transformers.QDQBertConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimension of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.QDQBertConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.QDQBertConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.QDQBertConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimension of the &#x201C;intermediate&#x201D; (i.e., feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.QDQBertConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;selu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.QDQBertConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probabilitiy for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.QDQBertConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.QDQBertConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
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.QDQBertConfig.type_vocab_size",description:`<strong>type_vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The vocabulary size of the <code>token_type_ids</code> passed when calling <a href="/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertModel">QDQBertModel</a>.`,name:"type_vocab_size"},{anchor:"transformers.QDQBertConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.QDQBertConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.QDQBertConfig.is_decoder",description:`<strong>is_decoder</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether the model is used as a decoder or not. If <code>False</code>, the model is used as an encoder.`,name:"is_decoder"},{anchor:"transformers.QDQBertConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models). Only
relevant if <code>config.is_decoder=True</code>.`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qdqbert/configuration_qdqbert.py#L29"}}),Le=new he({props:{anchor:"transformers.QDQBertConfig.example",$$slots:{default:[hu]},$$scope:{ctx:B}}}),Ht=new Z({}),Yt=new z({props:{name:"class transformers.QDQBertModel",anchor:"transformers.QDQBertModel",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:": bool = True"}],parametersDescription:[{anchor:"transformers.QDQBertModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertConfig">QDQBertConfig</a>) &#x2014; 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/main/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/main/src/transformers/models/qdqbert/modeling_qdqbert.py#L835"}}),no=new z({props:{name:"forward",anchor:"transformers.QDQBertModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"use_cache",val:": typing.Optional[bool] = 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.QDQBertModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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.QDQBertModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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.QDQBertModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.QDQBertModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.QDQBertModel.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>) &#x2014;
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.QDQBertModel.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>) &#x2014;
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&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.QDQBertModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.QDQBertModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.QDQBertModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.QDQBertModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong>  (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention if
the model is configured as a decoder.`,name:"encoder_hidden_states"},{anchor:"transformers.QDQBertModel.forward.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on the padding token indices of the encoder input. This mask is used in
the cross-attention if the model is configured as a decoder. 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>`,name:"encoder_attention_mask"},{anchor:"transformers.QDQBertModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.QDQBertModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qdqbert/modeling_qdqbert.py#L875",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions</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/main/en/model_doc/qdqbert#transformers.QDQBertConfig"
>QDQBertConfig</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>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</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>) \u2014 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>) \u2014 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>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> and <code>config.add_cross_attention=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 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 of the decoder\u2019s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and optionally if
<code>config.is_encoder_decoder=True</code> 2 additional tensors of shape <code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and optionally if
<code>config.is_encoder_decoder=True</code> in the cross-attention blocks) that can be used (see <code>past_key_values</code>
input) to speed up sequential decoding.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ye=new $t({props:{$$slots:{default:[mu]},$$scope:{ctx:B}}}),Oe=new he({props:{anchor:"transformers.QDQBertModel.forward.example",$$slots:{default:[uu]},$$scope:{ctx:B}}}),so=new Z({}),ao=new z({props:{name:"class transformers.QDQBertLMHeadModel",anchor:"transformers.QDQBertLMHeadModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.QDQBertLMHeadModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertConfig">QDQBertConfig</a>) &#x2014; 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/main/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/main/src/transformers/models/qdqbert/modeling_qdqbert.py#L1016"}}),po=new z({props:{name:"forward",anchor:"transformers.QDQBertLMHeadModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.LongTensor]]] = None"},{name:"use_cache",val:": typing.Optional[bool] = 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.QDQBertLMHeadModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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.QDQBertLMHeadModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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.QDQBertLMHeadModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.QDQBertLMHeadModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.QDQBertLMHeadModel.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>) &#x2014;
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.QDQBertLMHeadModel.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>) &#x2014;
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&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.QDQBertLMHeadModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.QDQBertLMHeadModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.QDQBertLMHeadModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.QDQBertLMHeadModel.forward.encoder_hidden_states",description:`<strong>encoder_hidden_states</strong>  (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Sequence of hidden-states at the output of the last layer of the encoder. Used in the cross-attention if
the model is configured as a decoder.`,name:"encoder_hidden_states"},{anchor:"transformers.QDQBertLMHeadModel.forward.encoder_attention_mask",description:`<strong>encoder_attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on the padding token indices of the encoder input. This mask is used in
the cross-attention if the model is configured as a decoder. 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>`,name:"encoder_attention_mask"},{anchor:"transformers.QDQBertLMHeadModel.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the left-to-right language modeling loss (next word prediction). 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 n <code>[0, ..., config.vocab_size]</code>`,name:"labels"},{anchor:"transformers.QDQBertLMHeadModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden states of the attention blocks. Can be used to speed up decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>.`,name:"past_key_values"},{anchor:"transformers.QDQBertLMHeadModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qdqbert/modeling_qdqbert.py#L1037",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</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/main/en/model_doc/qdqbert#transformers.QDQBertConfig"
>QDQBertConfig</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) \u2014 Language modeling loss (for next-token prediction).</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 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>) \u2014 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>) \u2014 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>
<li>
<p><strong>cross_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>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Cross attentions weights after the attention softmax, used to compute the weighted average in the
cross-attention heads.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> tuples of length <code>config.n_layers</code>, with each tuple containing the cached key,
value states of the self-attention and the cross-attention layers if model is used in encoder-decoder
setting. Only relevant if <code>config.is_decoder = True</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the attention blocks) that can be used (see
<code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),et=new $t({props:{$$slots:{default:[fu]},$$scope:{ctx:B}}}),tt=new he({props:{anchor:"transformers.QDQBertLMHeadModel.forward.example",$$slots:{default:[gu]},$$scope:{ctx:B}}}),ho=new Z({}),mo=new z({props:{name:"class transformers.QDQBertForMaskedLM",anchor:"transformers.QDQBertForMaskedLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.QDQBertForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertConfig">QDQBertConfig</a>) &#x2014; 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/main/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/main/src/transformers/models/qdqbert/modeling_qdqbert.py#L1168"}}),bo=new z({props:{name:"forward",anchor:"transformers.QDQBertForMaskedLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.FloatTensor] = 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.QDQBertForMaskedLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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.QDQBertForMaskedLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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.QDQBertForMaskedLM.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.QDQBertForMaskedLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.QDQBertForMaskedLM.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>) &#x2014;
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.QDQBertForMaskedLM.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>) &#x2014;
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&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.QDQBertForMaskedLM.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.QDQBertForMaskedLM.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.QDQBertForMaskedLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.QDQBertForMaskedLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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/main/src/transformers/models/qdqbert/modeling_qdqbert.py#L1192",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/en/model_doc/qdqbert#transformers.QDQBertConfig"
>QDQBertConfig</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) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),nt=new $t({props:{$$slots:{default:[_u]},$$scope:{ctx:B}}}),st=new he({props:{anchor:"transformers.QDQBertForMaskedLM.forward.example",$$slots:{default:[bu]},$$scope:{ctx:B}}}),yo=new Z({}),Mo=new z({props:{name:"class transformers.QDQBertForSequenceClassification",anchor:"transformers.QDQBertForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.QDQBertForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertConfig">QDQBertConfig</a>) &#x2014; 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/main/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/main/src/transformers/models/qdqbert/modeling_qdqbert.py#L1382"}}),Qo=new z({props:{name:"forward",anchor:"transformers.QDQBertForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = 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.QDQBertForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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.QDQBertForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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.QDQBertForSequenceClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.QDQBertForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.QDQBertForSequenceClassification.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>) &#x2014;
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.QDQBertForSequenceClassification.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>) &#x2014;
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&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.QDQBertForSequenceClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.QDQBertForSequenceClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.QDQBertForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.QDQBertForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
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 &gt; 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qdqbert/modeling_qdqbert.py#L1394",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/en/model_doc/qdqbert#transformers.QDQBertConfig"
>QDQBertConfig</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) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),rt=new $t({props:{$$slots:{default:[yu]},$$scope:{ctx:B}}}),it=new he({props:{anchor:"transformers.QDQBertForSequenceClassification.forward.example",$$slots:{default:[Mu]},$$scope:{ctx:B}}}),lt=new he({props:{anchor:"transformers.QDQBertForSequenceClassification.forward.example-2",$$slots:{default:[Tu]},$$scope:{ctx:B}}}),vo=new Z({}),Bo=new z({props:{name:"class transformers.QDQBertForNextSentencePrediction",anchor:"transformers.QDQBertForNextSentencePrediction",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.QDQBertForNextSentencePrediction.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertConfig">QDQBertConfig</a>) &#x2014; 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/main/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/main/src/transformers/models/qdqbert/modeling_qdqbert.py#L1278"}}),Uo=new z({props:{name:"forward",anchor:"transformers.QDQBertForNextSentencePrediction.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = 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"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.QDQBertForNextSentencePrediction.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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.QDQBertForNextSentencePrediction.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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.QDQBertForNextSentencePrediction.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.QDQBertForNextSentencePrediction.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.QDQBertForNextSentencePrediction.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>) &#x2014;
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.QDQBertForNextSentencePrediction.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>) &#x2014;
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&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.QDQBertForNextSentencePrediction.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.QDQBertForNextSentencePrediction.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.QDQBertForNextSentencePrediction.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.QDQBertForNextSentencePrediction.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the next sequence prediction (classification) loss. Input should be a sequence pair
(see <code>input_ids</code> docstring). Indices should be in <code>[0, 1]</code>:</p>
<ul>
<li>0 indicates sequence B is a continuation of sequence A,</li>
<li>1 indicates sequence B is a random sequence.</li>
</ul>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/qdqbert/modeling_qdqbert.py#L1288",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.NextSentencePredictorOutput"
>transformers.modeling_outputs.NextSentencePredictorOutput</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/main/en/model_doc/qdqbert#transformers.QDQBertConfig"
>QDQBertConfig</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>next_sentence_label</code> is provided) \u2014 Next sequence prediction (classification) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, 2)</code>) \u2014 Prediction scores of the next sequence prediction (classification) head (scores of True/False continuation
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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.NextSentencePredictorOutput"
>transformers.modeling_outputs.NextSentencePredictorOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ct=new $t({props:{$$slots:{default:[wu]},$$scope:{ctx:B}}}),pt=new he({props:{anchor:"transformers.QDQBertForNextSentencePrediction.forward.example",$$slots:{default:[ku]},$$scope:{ctx:B}}}),Eo=new Z({}),Fo=new z({props:{name:"class transformers.QDQBertForMultipleChoice",anchor:"transformers.QDQBertForMultipleChoice",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.QDQBertForMultipleChoice.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertConfig">QDQBertConfig</a>) &#x2014; 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/main/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/main/src/transformers/models/qdqbert/modeling_qdqbert.py#L1479"}}),Do=new z({props:{name:"forward",anchor:"transformers.QDQBertForMultipleChoice.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = 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.QDQBertForMultipleChoice.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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.QDQBertForMultipleChoice.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>) &#x2014;
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.QDQBertForMultipleChoice.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.QDQBertForMultipleChoice.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.QDQBertForMultipleChoice.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>) &#x2014;
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.QDQBertForMultipleChoice.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>) &#x2014;
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&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.QDQBertForMultipleChoice.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.QDQBertForMultipleChoice.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.QDQBertForMultipleChoice.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.QDQBertForMultipleChoice.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
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/main/src/transformers/models/qdqbert/modeling_qdqbert.py#L1490",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/en/model_doc/qdqbert#transformers.QDQBertConfig"
>QDQBertConfig</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) \u2014 Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices)</code>) \u2014 <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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.MultipleChoiceModelOutput"
>transformers.modeling_outputs.MultipleChoiceModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),mt=new $t({props:{$$slots:{default:[Qu]},$$scope:{ctx:B}}}),ut=new he({props:{anchor:"transformers.QDQBertForMultipleChoice.forward.example",$$slots:{default:[vu]},$$scope:{ctx:B}}}),Io=new Z({}),xo=new z({props:{name:"class transformers.QDQBertForTokenClassification",anchor:"transformers.QDQBertForTokenClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.QDQBertForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertConfig">QDQBertConfig</a>) &#x2014; 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/main/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/main/src/transformers/models/qdqbert/modeling_qdqbert.py#L1570"}}),Go=new z({props:{name:"forward",anchor:"transformers.QDQBertForTokenClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = 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.QDQBertForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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.QDQBertForTokenClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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.QDQBertForTokenClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.QDQBertForTokenClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.QDQBertForTokenClassification.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>) &#x2014;
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.QDQBertForTokenClassification.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>) &#x2014;
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&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.QDQBertForTokenClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.QDQBertForTokenClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.QDQBertForTokenClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.QDQBertForTokenClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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/main/src/transformers/models/qdqbert/modeling_qdqbert.py#L1582",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/en/model_doc/qdqbert#transformers.QDQBertConfig"
>QDQBertConfig</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)  \u2014 Classification loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) \u2014 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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),gt=new $t({props:{$$slots:{default:[Bu]},$$scope:{ctx:B}}}),_t=new he({props:{anchor:"transformers.QDQBertForTokenClassification.forward.example",$$slots:{default:[ju]},$$scope:{ctx:B}}}),Vo=new Z({}),Xo=new z({props:{name:"class transformers.QDQBertForQuestionAnswering",anchor:"transformers.QDQBertForQuestionAnswering",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.QDQBertForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertConfig">QDQBertConfig</a>) &#x2014; 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/main/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/main/src/transformers/models/qdqbert/modeling_qdqbert.py#L1648"}}),Lo=new z({props:{name:"forward",anchor:"transformers.QDQBertForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"start_positions",val:": typing.Optional[torch.LongTensor] = None"},{name:"end_positions",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.QDQBertForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/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.QDQBertForQuestionAnswering.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
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.QDQBertForQuestionAnswering.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p>
<ul>
<li>0 corresponds to a <em>sentence A</em> token,</li>
<li>1 corresponds to a <em>sentence B</em> token.</li>
</ul>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.QDQBertForQuestionAnswering.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. Selected in the range <code>[0, config.max_position_embeddings - 1]</code>.</p>
<p><a href="../glossary#position-ids">What are position IDs?</a>`,name:"position_ids"},{anchor:"transformers.QDQBertForQuestionAnswering.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>) &#x2014;
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.QDQBertForQuestionAnswering.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>) &#x2014;
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&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.QDQBertForQuestionAnswering.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.QDQBertForQuestionAnswering.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
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.QDQBertForQuestionAnswering.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.QDQBertForQuestionAnswering.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
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.QDQBertForQuestionAnswering.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
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/main/src/transformers/models/qdqbert/modeling_qdqbert.py#L1659",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/en/model_doc/qdqbert#transformers.QDQBertConfig"
>QDQBertConfig</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) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),yt=new $t({props:{$$slots:{default:[Ju]},$$scope:{ctx:B}}}),Mt=new he({props:{anchor:"transformers.QDQBertForQuestionAnswering.forward.example",$$slots:{default:[$u]},$$scope:{ctx:B}}}),{c(){d=n("meta"),y=p(),g=n("h1"),u=n("a"),b=n("span"),M(l.$$.fragment),m=p(),j=n("span"),Nr=r("QDQBERT"),ya=p(),ue=n("h2"),xe=n("a"),Gn=n("span"),M(zt.$$.fragment),Rr=p(),Vn=n("span"),Gr=r("Overview"),Ma=p(),Ze=n("p"),Vr=r("The QDQBERT model can be referenced in "),Ut=n("a"),Xr=r(`Integer Quantization for Deep Learning Inference: Principles and Empirical
Evaluation`),Ar=r(` by Hao Wu, Patrick Judd, Xiaojie Zhang, Mikhail Isaev and Paulius
Micikevicius.`),Ta=p(),Ko=n("p"),Sr=r("The abstract from the paper is the following:"),wa=p(),en=n("p"),Xn=n("em"),Pr=r(`Quantization techniques can reduce the size of Deep Neural Networks and improve inference latency and throughput by
taking advantage of high throughput integer instructions. In this paper we review the mathematical aspects of
quantization parameters and evaluate their choices on a wide range of neural network models for different application
domains, including vision, speech, and language. We focus on quantization techniques that are amenable to acceleration
by processors with high-throughput integer math pipelines. We also present a workflow for 8-bit quantization that is
able to maintain accuracy within 1% of the floating-point baseline on all networks studied, including models that are
more difficult to quantize, such as MobileNets and BERT-large.`),ka=p(),tn=n("p"),Lr=r("Tips:"),Qa=p(),A=n("ul"),An=n("li"),Sn=n("p"),Hr=r(`QDQBERT model adds fake quantization operations (pair of QuantizeLinear/DequantizeLinear ops) to (i) linear layer
inputs and weights, (ii) matmul inputs, (iii) residual add inputs, in BERT model.`),Yr=p(),Pn=n("li"),Ne=n("p"),Or=r("QDQBERT requires the dependency of "),Et=n("a"),Kr=r("Pytorch Quantization Toolkit"),ei=r(". To install "),Ln=n("code"),ti=r("pip install pytorch-quantization --extra-index-url https://pypi.ngc.nvidia.com"),oi=p(),Hn=n("li"),Ft=n("p"),ni=r("QDQBERT model can be loaded from any checkpoint of HuggingFace BERT model (for example "),Yn=n("em"),si=r("bert-base-uncased"),ai=r(`), and
perform Quantization Aware Training/Post Training Quantization.`),ri=p(),On=n("li"),Ct=n("p"),ii=r(`A complete example of using QDQBERT model to perform Quatization Aware Training and Post Training Quantization for
SQUAD task can be found at `),on=n("a"),li=r("transformers/examples/research_projects/quantization-qdqbert/"),di=r("."),va=p(),Re=n("p"),ci=r("This model was contributed by "),qt=n("a"),pi=r("shangz"),hi=r("."),Ba=p(),fe=n("h3"),Ge=n("a"),Kn=n("span"),M(Wt.$$.fragment),mi=p(),es=n("span"),ui=r("Set default quantizers"),ja=p(),U=n("p"),fi=r(`QDQBERT model adds fake quantization operations (pair of QuantizeLinear/DequantizeLinear ops) to BERT by
`),ts=n("code"),gi=r("TensorQuantizer"),_i=r(" in "),Dt=n("a"),bi=r("Pytorch Quantization Toolkit"),yi=r(". "),os=n("code"),Mi=r("TensorQuantizer"),Ti=r(` is the module
for quantizing tensors, with `),ns=n("code"),wi=r("QuantDescriptor"),ki=r(" defining how the tensor should be quantized. Refer to "),It=n("a"),Qi=r(`Pytorch
Quantization Toolkit userguide`),vi=r(" for more details."),Ja=p(),Ve=n("p"),Bi=r("Before creating QDQBERT model, one has to set the default "),ss=n("code"),ji=r("QuantDescriptor"),Ji=r(" defining default tensor quantizers."),$a=p(),nn=n("p"),$i=r("Example:"),za=p(),M(xt.$$.fragment),Ua=p(),ge=n("h3"),Xe=n("a"),as=n("span"),M(Zt.$$.fragment),zi=p(),rs=n("span"),Ui=r("Calibration"),Ea=p(),sn=n("p"),Ei=r(`Calibration is the terminology of passing data samples to the quantizer and deciding the best scaling factors for
tensors. After setting up the tensor quantizers, one can use the following example to calibrate the model:`),Fa=p(),M(Nt.$$.fragment),Ca=p(),_e=n("h3"),Ae=n("a"),is=n("span"),M(Rt.$$.fragment),Fi=p(),ls=n("span"),Ci=r("Export to ONNX"),qa=p(),ne=n("p"),qi=r("The goal of exporting to ONNX is to deploy inference by "),Gt=n("a"),Wi=r("TensorRT"),Di=r(`. Fake
quantization will be broken into a pair of QuantizeLinear/DequantizeLinear ONNX ops. After setting static member of
TensorQuantizer to use Pytorch\u2019s own fake quantization functions, fake quantized model can be exported to ONNX, follow
the instructions in `),Vt=n("a"),Ii=r("torch.onnx"),xi=r(". Example:"),Wa=p(),M(Xt.$$.fragment),Da=p(),be=n("h2"),Se=n("a"),ds=n("span"),M(At.$$.fragment),Zi=p(),cs=n("span"),Ni=r("Documentation resources"),Ia=p(),E=n("ul"),ps=n("li"),an=n("a"),Ri=r("Text classification task guide"),Gi=p(),hs=n("li"),rn=n("a"),Vi=r("Token classification task guide"),Xi=p(),ms=n("li"),ln=n("a"),Ai=r("Question answering task guide"),Si=p(),us=n("li"),dn=n("a"),Pi=r("Causal language modeling task guide"),Li=p(),fs=n("li"),cn=n("a"),Hi=r("Masked language modeling task guide"),Yi=p(),gs=n("li"),pn=n("a"),Oi=r("Multiple choice task guide"),xa=p(),ye=n("h2"),Pe=n("a"),_s=n("span"),M(St.$$.fragment),Ki=p(),bs=n("span"),el=r("QDQBertConfig"),Za=p(),V=n("div"),M(Pt.$$.fragment),tl=p(),Me=n("p"),ol=r("This is the configuration class to store the configuration of a "),hn=n("a"),nl=r("QDQBertModel"),sl=r(`. It is used to instantiate an
QDQBERT 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 BERT
`),Lt=n("a"),al=r("bert-base-uncased"),rl=r(" architecture."),il=p(),Te=n("p"),ll=r("Configuration objects inherit from "),mn=n("a"),dl=r("PretrainedConfig"),cl=r(` and can be used to control the model outputs. Read the
documentation from `),un=n("a"),pl=r("PretrainedConfig"),hl=r(" for more information."),ml=p(),M(Le.$$.fragment),Na=p(),we=n("h2"),He=n("a"),ys=n("span"),M(Ht.$$.fragment),ul=p(),Ms=n("span"),fl=r("QDQBertModel"),Ra=p(),J=n("div"),M(Yt.$$.fragment),gl=p(),Ts=n("p"),_l=r("The bare QDQBERT Model transformer outputting raw hidden-states without any specific head on top."),bl=p(),Ot=n("p"),yl=r("This model inherits from "),fn=n("a"),Ml=r("PreTrainedModel"),Tl=r(`. 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.)`),wl=p(),Kt=n("p"),kl=r("This model is also a PyTorch "),eo=n("a"),Ql=r("torch.nn.Module"),vl=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Bl=p(),to=n("p"),jl=r(`The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
cross-attention is added between the self-attention layers, following the architecture described in `),oo=n("a"),Jl=r(`Attention is
all you need`),$l=r(` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),zl=p(),$=n("p"),Ul=r("To behave as an decoder the model needs to be initialized with the "),ws=n("code"),El=r("is_decoder"),Fl=r(` argument of the configuration set
to `),ks=n("code"),Cl=r("True"),ql=r(". To be used in a Seq2Seq model, the model needs to initialized with both "),Qs=n("code"),Wl=r("is_decoder"),Dl=r(` argument and
`),vs=n("code"),Il=r("add_cross_attention"),xl=r(" set to "),Bs=n("code"),Zl=r("True"),Nl=r("; an "),js=n("code"),Rl=r("encoder_hidden_states"),Gl=r(" is then expected as an input to the forward pass."),Vl=p(),S=n("div"),M(no.$$.fragment),Xl=p(),ke=n("p"),Al=r("The "),gn=n("a"),Sl=r("QDQBertModel"),Pl=r(" forward method, overrides the "),Js=n("code"),Ll=r("__call__"),Hl=r(" special method."),Yl=p(),M(Ye.$$.fragment),Ol=p(),M(Oe.$$.fragment),Ga=p(),Qe=n("h2"),Ke=n("a"),$s=n("span"),M(so.$$.fragment),Kl=p(),zs=n("span"),ed=r("QDQBertLMHeadModel"),Va=p(),F=n("div"),M(ao.$$.fragment),td=p(),ro=n("p"),od=r("QDQBERT Model with a "),Us=n("code"),nd=r("language modeling"),sd=r(" head on top for CLM fine-tuning."),ad=p(),io=n("p"),rd=r("This model inherits from "),_n=n("a"),id=r("PreTrainedModel"),ld=r(`. 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.)`),dd=p(),lo=n("p"),cd=r("This model is also a PyTorch "),co=n("a"),pd=r("torch.nn.Module"),hd=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),md=p(),P=n("div"),M(po.$$.fragment),ud=p(),ve=n("p"),fd=r("The "),bn=n("a"),gd=r("QDQBertLMHeadModel"),_d=r(" forward method, overrides the "),Es=n("code"),bd=r("__call__"),yd=r(" special method."),Md=p(),M(et.$$.fragment),Td=p(),M(tt.$$.fragment),Xa=p(),Be=n("h2"),ot=n("a"),Fs=n("span"),M(ho.$$.fragment),wd=p(),Cs=n("span"),kd=r("QDQBertForMaskedLM"),Aa=p(),C=n("div"),M(mo.$$.fragment),Qd=p(),uo=n("p"),vd=r("QDQBERT Model with a "),qs=n("code"),Bd=r("language modeling"),jd=r(" head on top."),Jd=p(),fo=n("p"),$d=r("This model inherits from "),yn=n("a"),zd=r("PreTrainedModel"),Ud=r(`. 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.)`),Ed=p(),go=n("p"),Fd=r("This model is also a PyTorch "),_o=n("a"),Cd=r("torch.nn.Module"),qd=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Wd=p(),L=n("div"),M(bo.$$.fragment),Dd=p(),je=n("p"),Id=r("The "),Mn=n("a"),xd=r("QDQBertForMaskedLM"),Zd=r(" forward method, overrides the "),Ws=n("code"),Nd=r("__call__"),Rd=r(" special method."),Gd=p(),M(nt.$$.fragment),Vd=p(),M(st.$$.fragment),Sa=p(),Je=n("h2"),at=n("a"),Ds=n("span"),M(yo.$$.fragment),Xd=p(),Is=n("span"),Ad=r("QDQBertForSequenceClassification"),Pa=p(),q=n("div"),M(Mo.$$.fragment),Sd=p(),xs=n("p"),Pd=r(`Bert Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled
output) e.g. for GLUE tasks.`),Ld=p(),To=n("p"),Hd=r("This model inherits from "),Tn=n("a"),Yd=r("PreTrainedModel"),Od=r(`. 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.)`),Kd=p(),wo=n("p"),ec=r("This model is also a PyTorch "),ko=n("a"),tc=r("torch.nn.Module"),oc=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),nc=p(),N=n("div"),M(Qo.$$.fragment),sc=p(),$e=n("p"),ac=r("The "),wn=n("a"),rc=r("QDQBertForSequenceClassification"),ic=r(" forward method, overrides the "),Zs=n("code"),lc=r("__call__"),dc=r(" special method."),cc=p(),M(rt.$$.fragment),pc=p(),M(it.$$.fragment),hc=p(),M(lt.$$.fragment),La=p(),ze=n("h2"),dt=n("a"),Ns=n("span"),M(vo.$$.fragment),mc=p(),Rs=n("span"),uc=r("QDQBertForNextSentencePrediction"),Ha=p(),W=n("div"),M(Bo.$$.fragment),fc=p(),jo=n("p"),gc=r("Bert Model with a "),Gs=n("code"),_c=r("next sentence prediction (classification)"),bc=r(" head on top."),yc=p(),Jo=n("p"),Mc=r("This model inherits from "),kn=n("a"),Tc=r("PreTrainedModel"),wc=r(`. 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.)`),kc=p(),$o=n("p"),Qc=r("This model is also a PyTorch "),zo=n("a"),vc=r("torch.nn.Module"),Bc=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),jc=p(),H=n("div"),M(Uo.$$.fragment),Jc=p(),Ue=n("p"),$c=r("The "),Qn=n("a"),zc=r("QDQBertForNextSentencePrediction"),Uc=r(" forward method, overrides the "),Vs=n("code"),Ec=r("__call__"),Fc=r(" special method."),Cc=p(),M(ct.$$.fragment),qc=p(),M(pt.$$.fragment),Ya=p(),Ee=n("h2"),ht=n("a"),Xs=n("span"),M(Eo.$$.fragment),Wc=p(),As=n("span"),Dc=r("QDQBertForMultipleChoice"),Oa=p(),D=n("div"),M(Fo.$$.fragment),Ic=p(),Ss=n("p"),xc=r(`Bert 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.`),Zc=p(),Co=n("p"),Nc=r("This model inherits from "),vn=n("a"),Rc=r("PreTrainedModel"),Gc=r(`. 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.)`),Vc=p(),qo=n("p"),Xc=r("This model is also a PyTorch "),Wo=n("a"),Ac=r("torch.nn.Module"),Sc=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Pc=p(),Y=n("div"),M(Do.$$.fragment),Lc=p(),Fe=n("p"),Hc=r("The "),Bn=n("a"),Yc=r("QDQBertForMultipleChoice"),Oc=r(" forward method, overrides the "),Ps=n("code"),Kc=r("__call__"),ep=r(" special method."),tp=p(),M(mt.$$.fragment),op=p(),M(ut.$$.fragment),Ka=p(),Ce=n("h2"),ft=n("a"),Ls=n("span"),M(Io.$$.fragment),np=p(),Hs=n("span"),sp=r("QDQBertForTokenClassification"),er=p(),I=n("div"),M(xo.$$.fragment),ap=p(),Ys=n("p"),rp=r(`QDQBERT 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.`),ip=p(),Zo=n("p"),lp=r("This model inherits from "),jn=n("a"),dp=r("PreTrainedModel"),cp=r(`. 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.)`),pp=p(),No=n("p"),hp=r("This model is also a PyTorch "),Ro=n("a"),mp=r("torch.nn.Module"),up=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),fp=p(),O=n("div"),M(Go.$$.fragment),gp=p(),qe=n("p"),_p=r("The "),Jn=n("a"),bp=r("QDQBertForTokenClassification"),yp=r(" forward method, overrides the "),Os=n("code"),Mp=r("__call__"),Tp=r(" special method."),wp=p(),M(gt.$$.fragment),kp=p(),M(_t.$$.fragment),tr=p(),We=n("h2"),bt=n("a"),Ks=n("span"),M(Vo.$$.fragment),Qp=p(),ea=n("span"),vp=r("QDQBertForQuestionAnswering"),or=p(),x=n("div"),M(Xo.$$.fragment),Bp=p(),De=n("p"),jp=r(`QDQBERT 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 `),ta=n("code"),Jp=r("span start logits"),$p=r(" and "),oa=n("code"),zp=r("span end logits"),Up=r(")."),Ep=p(),Ao=n("p"),Fp=r("This model inherits from "),$n=n("a"),Cp=r("PreTrainedModel"),qp=r(`. 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.)`),Wp=p(),So=n("p"),Dp=r("This model is also a PyTorch "),Po=n("a"),Ip=r("torch.nn.Module"),xp=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Zp=p(),K=n("div"),M(Lo.$$.fragment),Np=p(),Ie=n("p"),Rp=r("The "),zn=n("a"),Gp=r("QDQBertForQuestionAnswering"),Vp=r(" forward method, overrides the "),na=n("code"),Xp=r("__call__"),Ap=r(" special method."),Sp=p(),M(yt.$$.fragment),Pp=p(),M(Mt.$$.fragment),this.h()},l(t){const f=cu('[data-svelte="svelte-1phssyn"]',document.head);d=s(f,"META",{name:!0,content:!0}),f.forEach(o),y=h(t),g=s(t,"H1",{class:!0});var Ho=a(g);u=s(Ho,"A",{id:!0,class:!0,href:!0});var sa=a(u);b=s(sa,"SPAN",{});var aa=a(b);T(l.$$.fragment,aa),aa.forEach(o),sa.forEach(o),m=h(Ho),j=s(Ho,"SPAN",{});var ra=a(j);Nr=i(ra,"QDQBERT"),ra.forEach(o),Ho.forEach(o),ya=h(t),ue=s(t,"H2",{class:!0});var Yo=a(ue);xe=s(Yo,"A",{id:!0,class:!0,href:!0});var ia=a(xe);Gn=s(ia,"SPAN",{});var la=a(Gn);T(zt.$$.fragment,la),la.forEach(o),ia.forEach(o),Rr=h(Yo),Vn=s(Yo,"SPAN",{});var da=a(Vn);Gr=i(da,"Overview"),da.forEach(o),Yo.forEach(o),Ma=h(t),Ze=s(t,"P",{});var Oo=a(Ze);Vr=i(Oo,"The QDQBERT model can be referenced in "),Ut=s(Oo,"A",{href:!0,rel:!0});var ca=a(Ut);Xr=i(ca,`Integer Quantization for Deep Learning Inference: Principles and Empirical
Evaluation`),ca.forEach(o),Ar=i(Oo,` by Hao Wu, Patrick Judd, Xiaojie Zhang, Mikhail Isaev and Paulius
Micikevicius.`),Oo.forEach(o),Ta=h(t),Ko=s(t,"P",{});var pa=a(Ko);Sr=i(pa,"The abstract from the paper is the following:"),pa.forEach(o),wa=h(t),en=s(t,"P",{});var ha=a(en);Xn=s(ha,"EM",{});var ma=a(Xn);Pr=i(ma,`Quantization techniques can reduce the size of Deep Neural Networks and improve inference latency and throughput by
taking advantage of high throughput integer instructions. In this paper we review the mathematical aspects of
quantization parameters and evaluate their choices on a wide range of neural network models for different application
domains, including vision, speech, and language. We focus on quantization techniques that are amenable to acceleration
by processors with high-throughput integer math pipelines. We also present a workflow for 8-bit quantization that is
able to maintain accuracy within 1% of the floating-point baseline on all networks studied, including models that are
more difficult to quantize, such as MobileNets and BERT-large.`),ma.forEach(o),ha.forEach(o),ka=h(t),tn=s(t,"P",{});var ua=a(tn);Lr=i(ua,"Tips:"),ua.forEach(o),Qa=h(t),A=s(t,"UL",{});var oe=a(A);An=s(oe,"LI",{});var fa=a(An);Sn=s(fa,"P",{});var ga=a(Sn);Hr=i(ga,`QDQBERT model adds fake quantization operations (pair of QuantizeLinear/DequantizeLinear ops) to (i) linear layer
inputs and weights, (ii) matmul inputs, (iii) residual add inputs, in BERT model.`),ga.forEach(o),fa.forEach(o),Yr=h(oe),Pn=s(oe,"LI",{});var _a=a(Pn);Ne=s(_a,"P",{});var ba=a(Ne);Or=i(ba,"QDQBERT requires the dependency of "),Et=s(ba,"A",{href:!0,rel:!0});var Lp=a(Et);Kr=i(Lp,"Pytorch Quantization Toolkit"),Lp.forEach(o),ei=i(ba,". To install "),Ln=s(ba,"CODE",{});var Hp=a(Ln);ti=i(Hp,"pip install pytorch-quantization --extra-index-url https://pypi.ngc.nvidia.com"),Hp.forEach(o),ba.forEach(o),_a.forEach(o),oi=h(oe),Hn=s(oe,"LI",{});var Yp=a(Hn);Ft=s(Yp,"P",{});var sr=a(Ft);ni=i(sr,"QDQBERT model can be loaded from any checkpoint of HuggingFace BERT model (for example "),Yn=s(sr,"EM",{});var Op=a(Yn);si=i(Op,"bert-base-uncased"),Op.forEach(o),ai=i(sr,`), and
perform Quantization Aware Training/Post Training Quantization.`),sr.forEach(o),Yp.forEach(o),ri=h(oe),On=s(oe,"LI",{});var Kp=a(On);Ct=s(Kp,"P",{});var ar=a(Ct);ii=i(ar,`A complete example of using QDQBERT model to perform Quatization Aware Training and Post Training Quantization for
SQUAD task can be found at `),on=s(ar,"A",{href:!0});var eh=a(on);li=i(eh,"transformers/examples/research_projects/quantization-qdqbert/"),eh.forEach(o),di=i(ar,"."),ar.forEach(o),Kp.forEach(o),oe.forEach(o),va=h(t),Re=s(t,"P",{});var rr=a(Re);ci=i(rr,"This model was contributed by "),qt=s(rr,"A",{href:!0,rel:!0});var th=a(qt);pi=i(th,"shangz"),th.forEach(o),hi=i(rr,"."),rr.forEach(o),Ba=h(t),fe=s(t,"H3",{class:!0});var ir=a(fe);Ge=s(ir,"A",{id:!0,class:!0,href:!0});var oh=a(Ge);Kn=s(oh,"SPAN",{});var nh=a(Kn);T(Wt.$$.fragment,nh),nh.forEach(o),oh.forEach(o),mi=h(ir),es=s(ir,"SPAN",{});var sh=a(es);ui=i(sh,"Set default quantizers"),sh.forEach(o),ir.forEach(o),ja=h(t),U=s(t,"P",{});var ee=a(U);fi=i(ee,`QDQBERT model adds fake quantization operations (pair of QuantizeLinear/DequantizeLinear ops) to BERT by
`),ts=s(ee,"CODE",{});var ah=a(ts);gi=i(ah,"TensorQuantizer"),ah.forEach(o),_i=i(ee," in "),Dt=s(ee,"A",{href:!0,rel:!0});var rh=a(Dt);bi=i(rh,"Pytorch Quantization Toolkit"),rh.forEach(o),yi=i(ee,". "),os=s(ee,"CODE",{});var ih=a(os);Mi=i(ih,"TensorQuantizer"),ih.forEach(o),Ti=i(ee,` is the module
for quantizing tensors, with `),ns=s(ee,"CODE",{});var lh=a(ns);wi=i(lh,"QuantDescriptor"),lh.forEach(o),ki=i(ee," defining how the tensor should be quantized. Refer to "),It=s(ee,"A",{href:!0,rel:!0});var dh=a(It);Qi=i(dh,`Pytorch
Quantization Toolkit userguide`),dh.forEach(o),vi=i(ee," for more details."),ee.forEach(o),Ja=h(t),Ve=s(t,"P",{});var lr=a(Ve);Bi=i(lr,"Before creating QDQBERT model, one has to set the default "),ss=s(lr,"CODE",{});var ch=a(ss);ji=i(ch,"QuantDescriptor"),ch.forEach(o),Ji=i(lr," defining default tensor quantizers."),lr.forEach(o),$a=h(t),nn=s(t,"P",{});var ph=a(nn);$i=i(ph,"Example:"),ph.forEach(o),za=h(t),T(xt.$$.fragment,t),Ua=h(t),ge=s(t,"H3",{class:!0});var dr=a(ge);Xe=s(dr,"A",{id:!0,class:!0,href:!0});var hh=a(Xe);as=s(hh,"SPAN",{});var mh=a(as);T(Zt.$$.fragment,mh),mh.forEach(o),hh.forEach(o),zi=h(dr),rs=s(dr,"SPAN",{});var uh=a(rs);Ui=i(uh,"Calibration"),uh.forEach(o),dr.forEach(o),Ea=h(t),sn=s(t,"P",{});var fh=a(sn);Ei=i(fh,`Calibration is the terminology of passing data samples to the quantizer and deciding the best scaling factors for
tensors. After setting up the tensor quantizers, one can use the following example to calibrate the model:`),fh.forEach(o),Fa=h(t),T(Nt.$$.fragment,t),Ca=h(t),_e=s(t,"H3",{class:!0});var cr=a(_e);Ae=s(cr,"A",{id:!0,class:!0,href:!0});var gh=a(Ae);is=s(gh,"SPAN",{});var _h=a(is);T(Rt.$$.fragment,_h),_h.forEach(o),gh.forEach(o),Fi=h(cr),ls=s(cr,"SPAN",{});var bh=a(ls);Ci=i(bh,"Export to ONNX"),bh.forEach(o),cr.forEach(o),qa=h(t),ne=s(t,"P",{});var Un=a(ne);qi=i(Un,"The goal of exporting to ONNX is to deploy inference by "),Gt=s(Un,"A",{href:!0,rel:!0});var yh=a(Gt);Wi=i(yh,"TensorRT"),yh.forEach(o),Di=i(Un,`. Fake
quantization will be broken into a pair of QuantizeLinear/DequantizeLinear ONNX ops. After setting static member of
TensorQuantizer to use Pytorch\u2019s own fake quantization functions, fake quantized model can be exported to ONNX, follow
the instructions in `),Vt=s(Un,"A",{href:!0,rel:!0});var Mh=a(Vt);Ii=i(Mh,"torch.onnx"),Mh.forEach(o),xi=i(Un,". Example:"),Un.forEach(o),Wa=h(t),T(Xt.$$.fragment,t),Da=h(t),be=s(t,"H2",{class:!0});var pr=a(be);Se=s(pr,"A",{id:!0,class:!0,href:!0});var Th=a(Se);ds=s(Th,"SPAN",{});var wh=a(ds);T(At.$$.fragment,wh),wh.forEach(o),Th.forEach(o),Zi=h(pr),cs=s(pr,"SPAN",{});var kh=a(cs);Ni=i(kh,"Documentation resources"),kh.forEach(o),pr.forEach(o),Ia=h(t),E=s(t,"UL",{});var te=a(E);ps=s(te,"LI",{});var Qh=a(ps);an=s(Qh,"A",{href:!0});var vh=a(an);Ri=i(vh,"Text classification task guide"),vh.forEach(o),Qh.forEach(o),Gi=h(te),hs=s(te,"LI",{});var Bh=a(hs);rn=s(Bh,"A",{href:!0});var jh=a(rn);Vi=i(jh,"Token classification task guide"),jh.forEach(o),Bh.forEach(o),Xi=h(te),ms=s(te,"LI",{});var Jh=a(ms);ln=s(Jh,"A",{href:!0});var $h=a(ln);Ai=i($h,"Question answering task guide"),$h.forEach(o),Jh.forEach(o),Si=h(te),us=s(te,"LI",{});var zh=a(us);dn=s(zh,"A",{href:!0});var Uh=a(dn);Pi=i(Uh,"Causal language modeling task guide"),Uh.forEach(o),zh.forEach(o),Li=h(te),fs=s(te,"LI",{});var Eh=a(fs);cn=s(Eh,"A",{href:!0});var Fh=a(cn);Hi=i(Fh,"Masked language modeling task guide"),Fh.forEach(o),Eh.forEach(o),Yi=h(te),gs=s(te,"LI",{});var Ch=a(gs);pn=s(Ch,"A",{href:!0});var qh=a(pn);Oi=i(qh,"Multiple choice task guide"),qh.forEach(o),Ch.forEach(o),te.forEach(o),xa=h(t),ye=s(t,"H2",{class:!0});var hr=a(ye);Pe=s(hr,"A",{id:!0,class:!0,href:!0});var Wh=a(Pe);_s=s(Wh,"SPAN",{});var Dh=a(_s);T(St.$$.fragment,Dh),Dh.forEach(o),Wh.forEach(o),Ki=h(hr),bs=s(hr,"SPAN",{});var Ih=a(bs);el=i(Ih,"QDQBertConfig"),Ih.forEach(o),hr.forEach(o),Za=h(t),V=s(t,"DIV",{class:!0});var Tt=a(V);T(Pt.$$.fragment,Tt),tl=h(Tt),Me=s(Tt,"P",{});var En=a(Me);ol=i(En,"This is the configuration class to store the configuration of a "),hn=s(En,"A",{href:!0});var xh=a(hn);nl=i(xh,"QDQBertModel"),xh.forEach(o),sl=i(En,`. It is used to instantiate an
QDQBERT 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 BERT
`),Lt=s(En,"A",{href:!0,rel:!0});var Zh=a(Lt);al=i(Zh,"bert-base-uncased"),Zh.forEach(o),rl=i(En," architecture."),En.forEach(o),il=h(Tt),Te=s(Tt,"P",{});var Fn=a(Te);ll=i(Fn,"Configuration objects inherit from "),mn=s(Fn,"A",{href:!0});var Nh=a(mn);dl=i(Nh,"PretrainedConfig"),Nh.forEach(o),cl=i(Fn,` and can be used to control the model outputs. Read the
documentation from `),un=s(Fn,"A",{href:!0});var Rh=a(un);pl=i(Rh,"PretrainedConfig"),Rh.forEach(o),hl=i(Fn," for more information."),Fn.forEach(o),ml=h(Tt),T(Le.$$.fragment,Tt),Tt.forEach(o),Na=h(t),we=s(t,"H2",{class:!0});var mr=a(we);He=s(mr,"A",{id:!0,class:!0,href:!0});var Gh=a(He);ys=s(Gh,"SPAN",{});var Vh=a(ys);T(Ht.$$.fragment,Vh),Vh.forEach(o),Gh.forEach(o),ul=h(mr),Ms=s(mr,"SPAN",{});var Xh=a(Ms);fl=i(Xh,"QDQBertModel"),Xh.forEach(o),mr.forEach(o),Ra=h(t),J=s(t,"DIV",{class:!0});var R=a(J);T(Yt.$$.fragment,R),gl=h(R),Ts=s(R,"P",{});var Ah=a(Ts);_l=i(Ah,"The bare QDQBERT Model transformer outputting raw hidden-states without any specific head on top."),Ah.forEach(o),bl=h(R),Ot=s(R,"P",{});var ur=a(Ot);yl=i(ur,"This model inherits from "),fn=s(ur,"A",{href:!0});var Sh=a(fn);Ml=i(Sh,"PreTrainedModel"),Sh.forEach(o),Tl=i(ur,`. 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.)`),ur.forEach(o),wl=h(R),Kt=s(R,"P",{});var fr=a(Kt);kl=i(fr,"This model is also a PyTorch "),eo=s(fr,"A",{href:!0,rel:!0});var Ph=a(eo);Ql=i(Ph,"torch.nn.Module"),Ph.forEach(o),vl=i(fr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),fr.forEach(o),Bl=h(R),to=s(R,"P",{});var gr=a(to);jl=i(gr,`The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
cross-attention is added between the self-attention layers, following the architecture described in `),oo=s(gr,"A",{href:!0,rel:!0});var Lh=a(oo);Jl=i(Lh,`Attention is
all you need`),Lh.forEach(o),$l=i(gr,` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),gr.forEach(o),zl=h(R),$=s(R,"P",{});var G=a($);Ul=i(G,"To behave as an decoder the model needs to be initialized with the "),ws=s(G,"CODE",{});var Hh=a(ws);El=i(Hh,"is_decoder"),Hh.forEach(o),Fl=i(G,` argument of the configuration set
to `),ks=s(G,"CODE",{});var Yh=a(ks);Cl=i(Yh,"True"),Yh.forEach(o),ql=i(G,". To be used in a Seq2Seq model, the model needs to initialized with both "),Qs=s(G,"CODE",{});var Oh=a(Qs);Wl=i(Oh,"is_decoder"),Oh.forEach(o),Dl=i(G,` argument and
`),vs=s(G,"CODE",{});var Kh=a(vs);Il=i(Kh,"add_cross_attention"),Kh.forEach(o),xl=i(G," set to "),Bs=s(G,"CODE",{});var em=a(Bs);Zl=i(em,"True"),em.forEach(o),Nl=i(G,"; an "),js=s(G,"CODE",{});var tm=a(js);Rl=i(tm,"encoder_hidden_states"),tm.forEach(o),Gl=i(G," is then expected as an input to the forward pass."),G.forEach(o),Vl=h(R),S=s(R,"DIV",{class:!0});var wt=a(S);T(no.$$.fragment,wt),Xl=h(wt),ke=s(wt,"P",{});var Cn=a(ke);Al=i(Cn,"The "),gn=s(Cn,"A",{href:!0});var om=a(gn);Sl=i(om,"QDQBertModel"),om.forEach(o),Pl=i(Cn," forward method, overrides the "),Js=s(Cn,"CODE",{});var nm=a(Js);Ll=i(nm,"__call__"),nm.forEach(o),Hl=i(Cn," special method."),Cn.forEach(o),Yl=h(wt),T(Ye.$$.fragment,wt),Ol=h(wt),T(Oe.$$.fragment,wt),wt.forEach(o),R.forEach(o),Ga=h(t),Qe=s(t,"H2",{class:!0});var _r=a(Qe);Ke=s(_r,"A",{id:!0,class:!0,href:!0});var sm=a(Ke);$s=s(sm,"SPAN",{});var am=a($s);T(so.$$.fragment,am),am.forEach(o),sm.forEach(o),Kl=h(_r),zs=s(_r,"SPAN",{});var rm=a(zs);ed=i(rm,"QDQBertLMHeadModel"),rm.forEach(o),_r.forEach(o),Va=h(t),F=s(t,"DIV",{class:!0});var se=a(F);T(ao.$$.fragment,se),td=h(se),ro=s(se,"P",{});var br=a(ro);od=i(br,"QDQBERT Model with a "),Us=s(br,"CODE",{});var im=a(Us);nd=i(im,"language modeling"),im.forEach(o),sd=i(br," head on top for CLM fine-tuning."),br.forEach(o),ad=h(se),io=s(se,"P",{});var yr=a(io);rd=i(yr,"This model inherits from "),_n=s(yr,"A",{href:!0});var lm=a(_n);id=i(lm,"PreTrainedModel"),lm.forEach(o),ld=i(yr,`. 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.)`),yr.forEach(o),dd=h(se),lo=s(se,"P",{});var Mr=a(lo);cd=i(Mr,"This model is also a PyTorch "),co=s(Mr,"A",{href:!0,rel:!0});var dm=a(co);pd=i(dm,"torch.nn.Module"),dm.forEach(o),hd=i(Mr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Mr.forEach(o),md=h(se),P=s(se,"DIV",{class:!0});var kt=a(P);T(po.$$.fragment,kt),ud=h(kt),ve=s(kt,"P",{});var qn=a(ve);fd=i(qn,"The "),bn=s(qn,"A",{href:!0});var cm=a(bn);gd=i(cm,"QDQBertLMHeadModel"),cm.forEach(o),_d=i(qn," forward method, overrides the "),Es=s(qn,"CODE",{});var pm=a(Es);bd=i(pm,"__call__"),pm.forEach(o),yd=i(qn," special method."),qn.forEach(o),Md=h(kt),T(et.$$.fragment,kt),Td=h(kt),T(tt.$$.fragment,kt),kt.forEach(o),se.forEach(o),Xa=h(t),Be=s(t,"H2",{class:!0});var Tr=a(Be);ot=s(Tr,"A",{id:!0,class:!0,href:!0});var hm=a(ot);Fs=s(hm,"SPAN",{});var mm=a(Fs);T(ho.$$.fragment,mm),mm.forEach(o),hm.forEach(o),wd=h(Tr),Cs=s(Tr,"SPAN",{});var um=a(Cs);kd=i(um,"QDQBertForMaskedLM"),um.forEach(o),Tr.forEach(o),Aa=h(t),C=s(t,"DIV",{class:!0});var ae=a(C);T(mo.$$.fragment,ae),Qd=h(ae),uo=s(ae,"P",{});var wr=a(uo);vd=i(wr,"QDQBERT Model with a "),qs=s(wr,"CODE",{});var fm=a(qs);Bd=i(fm,"language modeling"),fm.forEach(o),jd=i(wr," head on top."),wr.forEach(o),Jd=h(ae),fo=s(ae,"P",{});var kr=a(fo);$d=i(kr,"This model inherits from "),yn=s(kr,"A",{href:!0});var gm=a(yn);zd=i(gm,"PreTrainedModel"),gm.forEach(o),Ud=i(kr,`. 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.)`),kr.forEach(o),Ed=h(ae),go=s(ae,"P",{});var Qr=a(go);Fd=i(Qr,"This model is also a PyTorch "),_o=s(Qr,"A",{href:!0,rel:!0});var _m=a(_o);Cd=i(_m,"torch.nn.Module"),_m.forEach(o),qd=i(Qr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Qr.forEach(o),Wd=h(ae),L=s(ae,"DIV",{class:!0});var Qt=a(L);T(bo.$$.fragment,Qt),Dd=h(Qt),je=s(Qt,"P",{});var Wn=a(je);Id=i(Wn,"The "),Mn=s(Wn,"A",{href:!0});var bm=a(Mn);xd=i(bm,"QDQBertForMaskedLM"),bm.forEach(o),Zd=i(Wn," forward method, overrides the "),Ws=s(Wn,"CODE",{});var ym=a(Ws);Nd=i(ym,"__call__"),ym.forEach(o),Rd=i(Wn," special method."),Wn.forEach(o),Gd=h(Qt),T(nt.$$.fragment,Qt),Vd=h(Qt),T(st.$$.fragment,Qt),Qt.forEach(o),ae.forEach(o),Sa=h(t),Je=s(t,"H2",{class:!0});var vr=a(Je);at=s(vr,"A",{id:!0,class:!0,href:!0});var Mm=a(at);Ds=s(Mm,"SPAN",{});var Tm=a(Ds);T(yo.$$.fragment,Tm),Tm.forEach(o),Mm.forEach(o),Xd=h(vr),Is=s(vr,"SPAN",{});var wm=a(Is);Ad=i(wm,"QDQBertForSequenceClassification"),wm.forEach(o),vr.forEach(o),Pa=h(t),q=s(t,"DIV",{class:!0});var re=a(q);T(Mo.$$.fragment,re),Sd=h(re),xs=s(re,"P",{});var km=a(xs);Pd=i(km,`Bert Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled
output) e.g. for GLUE tasks.`),km.forEach(o),Ld=h(re),To=s(re,"P",{});var Br=a(To);Hd=i(Br,"This model inherits from "),Tn=s(Br,"A",{href:!0});var Qm=a(Tn);Yd=i(Qm,"PreTrainedModel"),Qm.forEach(o),Od=i(Br,`. 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.)`),Br.forEach(o),Kd=h(re),wo=s(re,"P",{});var jr=a(wo);ec=i(jr,"This model is also a PyTorch "),ko=s(jr,"A",{href:!0,rel:!0});var vm=a(ko);tc=i(vm,"torch.nn.Module"),vm.forEach(o),oc=i(jr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),jr.forEach(o),nc=h(re),N=s(re,"DIV",{class:!0});var ie=a(N);T(Qo.$$.fragment,ie),sc=h(ie),$e=s(ie,"P",{});var Dn=a($e);ac=i(Dn,"The "),wn=s(Dn,"A",{href:!0});var Bm=a(wn);rc=i(Bm,"QDQBertForSequenceClassification"),Bm.forEach(o),ic=i(Dn," forward method, overrides the "),Zs=s(Dn,"CODE",{});var jm=a(Zs);lc=i(jm,"__call__"),jm.forEach(o),dc=i(Dn," special method."),Dn.forEach(o),cc=h(ie),T(rt.$$.fragment,ie),pc=h(ie),T(it.$$.fragment,ie),hc=h(ie),T(lt.$$.fragment,ie),ie.forEach(o),re.forEach(o),La=h(t),ze=s(t,"H2",{class:!0});var Jr=a(ze);dt=s(Jr,"A",{id:!0,class:!0,href:!0});var Jm=a(dt);Ns=s(Jm,"SPAN",{});var $m=a(Ns);T(vo.$$.fragment,$m),$m.forEach(o),Jm.forEach(o),mc=h(Jr),Rs=s(Jr,"SPAN",{});var zm=a(Rs);uc=i(zm,"QDQBertForNextSentencePrediction"),zm.forEach(o),Jr.forEach(o),Ha=h(t),W=s(t,"DIV",{class:!0});var le=a(W);T(Bo.$$.fragment,le),fc=h(le),jo=s(le,"P",{});var $r=a(jo);gc=i($r,"Bert Model with a "),Gs=s($r,"CODE",{});var Um=a(Gs);_c=i(Um,"next sentence prediction (classification)"),Um.forEach(o),bc=i($r," head on top."),$r.forEach(o),yc=h(le),Jo=s(le,"P",{});var zr=a(Jo);Mc=i(zr,"This model inherits from "),kn=s(zr,"A",{href:!0});var Em=a(kn);Tc=i(Em,"PreTrainedModel"),Em.forEach(o),wc=i(zr,`. 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.)`),zr.forEach(o),kc=h(le),$o=s(le,"P",{});var Ur=a($o);Qc=i(Ur,"This model is also a PyTorch "),zo=s(Ur,"A",{href:!0,rel:!0});var Fm=a(zo);vc=i(Fm,"torch.nn.Module"),Fm.forEach(o),Bc=i(Ur,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ur.forEach(o),jc=h(le),H=s(le,"DIV",{class:!0});var vt=a(H);T(Uo.$$.fragment,vt),Jc=h(vt),Ue=s(vt,"P",{});var In=a(Ue);$c=i(In,"The "),Qn=s(In,"A",{href:!0});var Cm=a(Qn);zc=i(Cm,"QDQBertForNextSentencePrediction"),Cm.forEach(o),Uc=i(In," forward method, overrides the "),Vs=s(In,"CODE",{});var qm=a(Vs);Ec=i(qm,"__call__"),qm.forEach(o),Fc=i(In," special method."),In.forEach(o),Cc=h(vt),T(ct.$$.fragment,vt),qc=h(vt),T(pt.$$.fragment,vt),vt.forEach(o),le.forEach(o),Ya=h(t),Ee=s(t,"H2",{class:!0});var Er=a(Ee);ht=s(Er,"A",{id:!0,class:!0,href:!0});var Wm=a(ht);Xs=s(Wm,"SPAN",{});var Dm=a(Xs);T(Eo.$$.fragment,Dm),Dm.forEach(o),Wm.forEach(o),Wc=h(Er),As=s(Er,"SPAN",{});var Im=a(As);Dc=i(Im,"QDQBertForMultipleChoice"),Im.forEach(o),Er.forEach(o),Oa=h(t),D=s(t,"DIV",{class:!0});var de=a(D);T(Fo.$$.fragment,de),Ic=h(de),Ss=s(de,"P",{});var xm=a(Ss);xc=i(xm,`Bert 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.`),xm.forEach(o),Zc=h(de),Co=s(de,"P",{});var Fr=a(Co);Nc=i(Fr,"This model inherits from "),vn=s(Fr,"A",{href:!0});var Zm=a(vn);Rc=i(Zm,"PreTrainedModel"),Zm.forEach(o),Gc=i(Fr,`. 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.)`),Fr.forEach(o),Vc=h(de),qo=s(de,"P",{});var Cr=a(qo);Xc=i(Cr,"This model is also a PyTorch "),Wo=s(Cr,"A",{href:!0,rel:!0});var Nm=a(Wo);Ac=i(Nm,"torch.nn.Module"),Nm.forEach(o),Sc=i(Cr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Cr.forEach(o),Pc=h(de),Y=s(de,"DIV",{class:!0});var Bt=a(Y);T(Do.$$.fragment,Bt),Lc=h(Bt),Fe=s(Bt,"P",{});var xn=a(Fe);Hc=i(xn,"The "),Bn=s(xn,"A",{href:!0});var Rm=a(Bn);Yc=i(Rm,"QDQBertForMultipleChoice"),Rm.forEach(o),Oc=i(xn," forward method, overrides the "),Ps=s(xn,"CODE",{});var Gm=a(Ps);Kc=i(Gm,"__call__"),Gm.forEach(o),ep=i(xn," special method."),xn.forEach(o),tp=h(Bt),T(mt.$$.fragment,Bt),op=h(Bt),T(ut.$$.fragment,Bt),Bt.forEach(o),de.forEach(o),Ka=h(t),Ce=s(t,"H2",{class:!0});var qr=a(Ce);ft=s(qr,"A",{id:!0,class:!0,href:!0});var Vm=a(ft);Ls=s(Vm,"SPAN",{});var Xm=a(Ls);T(Io.$$.fragment,Xm),Xm.forEach(o),Vm.forEach(o),np=h(qr),Hs=s(qr,"SPAN",{});var Am=a(Hs);sp=i(Am,"QDQBertForTokenClassification"),Am.forEach(o),qr.forEach(o),er=h(t),I=s(t,"DIV",{class:!0});var ce=a(I);T(xo.$$.fragment,ce),ap=h(ce),Ys=s(ce,"P",{});var Sm=a(Ys);rp=i(Sm,`QDQBERT 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.`),Sm.forEach(o),ip=h(ce),Zo=s(ce,"P",{});var Wr=a(Zo);lp=i(Wr,"This model inherits from "),jn=s(Wr,"A",{href:!0});var Pm=a(jn);dp=i(Pm,"PreTrainedModel"),Pm.forEach(o),cp=i(Wr,`. 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.)`),Wr.forEach(o),pp=h(ce),No=s(ce,"P",{});var Dr=a(No);hp=i(Dr,"This model is also a PyTorch "),Ro=s(Dr,"A",{href:!0,rel:!0});var Lm=a(Ro);mp=i(Lm,"torch.nn.Module"),Lm.forEach(o),up=i(Dr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Dr.forEach(o),fp=h(ce),O=s(ce,"DIV",{class:!0});var jt=a(O);T(Go.$$.fragment,jt),gp=h(jt),qe=s(jt,"P",{});var Zn=a(qe);_p=i(Zn,"The "),Jn=s(Zn,"A",{href:!0});var Hm=a(Jn);bp=i(Hm,"QDQBertForTokenClassification"),Hm.forEach(o),yp=i(Zn," forward method, overrides the "),Os=s(Zn,"CODE",{});var Ym=a(Os);Mp=i(Ym,"__call__"),Ym.forEach(o),Tp=i(Zn," special method."),Zn.forEach(o),wp=h(jt),T(gt.$$.fragment,jt),kp=h(jt),T(_t.$$.fragment,jt),jt.forEach(o),ce.forEach(o),tr=h(t),We=s(t,"H2",{class:!0});var Ir=a(We);bt=s(Ir,"A",{id:!0,class:!0,href:!0});var Om=a(bt);Ks=s(Om,"SPAN",{});var Km=a(Ks);T(Vo.$$.fragment,Km),Km.forEach(o),Om.forEach(o),Qp=h(Ir),ea=s(Ir,"SPAN",{});var eu=a(ea);vp=i(eu,"QDQBertForQuestionAnswering"),eu.forEach(o),Ir.forEach(o),or=h(t),x=s(t,"DIV",{class:!0});var pe=a(x);T(Xo.$$.fragment,pe),Bp=h(pe),De=s(pe,"P",{});var Nn=a(De);jp=i(Nn,`QDQBERT 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 `),ta=s(Nn,"CODE",{});var tu=a(ta);Jp=i(tu,"span start logits"),tu.forEach(o),$p=i(Nn," and "),oa=s(Nn,"CODE",{});var ou=a(oa);zp=i(ou,"span end logits"),ou.forEach(o),Up=i(Nn,")."),Nn.forEach(o),Ep=h(pe),Ao=s(pe,"P",{});var xr=a(Ao);Fp=i(xr,"This model inherits from "),$n=s(xr,"A",{href:!0});var nu=a($n);Cp=i(nu,"PreTrainedModel"),nu.forEach(o),qp=i(xr,`. 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.)`),xr.forEach(o),Wp=h(pe),So=s(pe,"P",{});var Zr=a(So);Dp=i(Zr,"This model is also a PyTorch "),Po=s(Zr,"A",{href:!0,rel:!0});var su=a(Po);Ip=i(su,"torch.nn.Module"),su.forEach(o),xp=i(Zr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Zr.forEach(o),Zp=h(pe),K=s(pe,"DIV",{class:!0});var Jt=a(K);T(Lo.$$.fragment,Jt),Np=h(Jt),Ie=s(Jt,"P",{});var Rn=a(Ie);Rp=i(Rn,"The "),zn=s(Rn,"A",{href:!0});var au=a(zn);Gp=i(au,"QDQBertForQuestionAnswering"),au.forEach(o),Vp=i(Rn," forward method, overrides the "),na=s(Rn,"CODE",{});var ru=a(na);Xp=i(ru,"__call__"),ru.forEach(o),Ap=i(Rn," special method."),Rn.forEach(o),Sp=h(Jt),T(yt.$$.fragment,Jt),Pp=h(Jt),T(Mt.$$.fragment,Jt),Jt.forEach(o),pe.forEach(o),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify(Uu)),c(u,"id","qdqbert"),c(u,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(u,"href","#qdqbert"),c(g,"class","relative group"),c(xe,"id","overview"),c(xe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(xe,"href","#overview"),c(ue,"class","relative group"),c(Ut,"href","https://arxiv.org/abs/2004.09602"),c(Ut,"rel","nofollow"),c(Et,"href","https://github.com/NVIDIA/TensorRT/tree/master/tools/pytorch-quantization"),c(Et,"rel","nofollow"),c(on,"href","examples/research_projects/quantization-qdqbert/"),c(qt,"href","https://huggingface.co/shangz"),c(qt,"rel","nofollow"),c(Ge,"id","set-default-quantizers"),c(Ge,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Ge,"href","#set-default-quantizers"),c(fe,"class","relative group"),c(Dt,"href","https://github.com/NVIDIA/TensorRT/tree/master/tools/pytorch-quantization"),c(Dt,"rel","nofollow"),c(It,"href","https://docs.nvidia.com/deeplearning/tensorrt/pytorch-quantization-toolkit/docs/userguide.html"),c(It,"rel","nofollow"),c(Xe,"id","calibration"),c(Xe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Xe,"href","#calibration"),c(ge,"class","relative group"),c(Ae,"id","export-to-onnx"),c(Ae,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Ae,"href","#export-to-onnx"),c(_e,"class","relative group"),c(Gt,"href","https://developer.nvidia.com/tensorrt"),c(Gt,"rel","nofollow"),c(Vt,"href","https://pytorch.org/docs/stable/onnx.html"),c(Vt,"rel","nofollow"),c(Se,"id","documentation-resources"),c(Se,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Se,"href","#documentation-resources"),c(be,"class","relative group"),c(an,"href","../tasks/sequence_classification"),c(rn,"href","../tasks/token_classification"),c(ln,"href","../tasks/question_answering"),c(dn,"href","../tasks/language_modeling"),c(cn,"href","../tasks/masked_language_modeling"),c(pn,"href","../tasks/multiple_choice"),c(Pe,"id","transformers.QDQBertConfig"),c(Pe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Pe,"href","#transformers.QDQBertConfig"),c(ye,"class","relative group"),c(hn,"href","/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertModel"),c(Lt,"href","https://huggingface.co/bert-base-uncased"),c(Lt,"rel","nofollow"),c(mn,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(un,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),c(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(He,"id","transformers.QDQBertModel"),c(He,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(He,"href","#transformers.QDQBertModel"),c(we,"class","relative group"),c(fn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c(eo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(eo,"rel","nofollow"),c(oo,"href","https://arxiv.org/abs/1706.03762"),c(oo,"rel","nofollow"),c(gn,"href","/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertModel"),c(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ke,"id","transformers.QDQBertLMHeadModel"),c(Ke,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Ke,"href","#transformers.QDQBertLMHeadModel"),c(Qe,"class","relative group"),c(_n,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c(co,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(co,"rel","nofollow"),c(bn,"href","/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertLMHeadModel"),c(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ot,"id","transformers.QDQBertForMaskedLM"),c(ot,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ot,"href","#transformers.QDQBertForMaskedLM"),c(Be,"class","relative group"),c(yn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c(_o,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(_o,"rel","nofollow"),c(Mn,"href","/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertForMaskedLM"),c(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(at,"id","transformers.QDQBertForSequenceClassification"),c(at,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(at,"href","#transformers.QDQBertForSequenceClassification"),c(Je,"class","relative group"),c(Tn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c(ko,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(ko,"rel","nofollow"),c(wn,"href","/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertForSequenceClassification"),c(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(dt,"id","transformers.QDQBertForNextSentencePrediction"),c(dt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(dt,"href","#transformers.QDQBertForNextSentencePrediction"),c(ze,"class","relative group"),c(kn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c(zo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(zo,"rel","nofollow"),c(Qn,"href","/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertForNextSentencePrediction"),c(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ht,"id","transformers.QDQBertForMultipleChoice"),c(ht,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ht,"href","#transformers.QDQBertForMultipleChoice"),c(Ee,"class","relative group"),c(vn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c(Wo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Wo,"rel","nofollow"),c(Bn,"href","/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertForMultipleChoice"),c(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ft,"id","transformers.QDQBertForTokenClassification"),c(ft,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ft,"href","#transformers.QDQBertForTokenClassification"),c(Ce,"class","relative group"),c(jn,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c(Ro,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Ro,"rel","nofollow"),c(Jn,"href","/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertForTokenClassification"),c(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(bt,"id","transformers.QDQBertForQuestionAnswering"),c(bt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(bt,"href","#transformers.QDQBertForQuestionAnswering"),c(We,"class","relative group"),c($n,"href","/docs/transformers/main/en/main_classes/model#transformers.PreTrainedModel"),c(Po,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Po,"rel","nofollow"),c(zn,"href","/docs/transformers/main/en/model_doc/qdqbert#transformers.QDQBertForQuestionAnswering"),c(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,f){e(document.head,d),_(t,y,f),_(t,g,f),e(g,u),e(u,b),w(l,b,null),e(g,m),e(g,j),e(j,Nr),_(t,ya,f),_(t,ue,f),e(ue,xe),e(xe,Gn),w(zt,Gn,null),e(ue,Rr),e(ue,Vn),e(Vn,Gr),_(t,Ma,f),_(t,Ze,f),e(Ze,Vr),e(Ze,Ut),e(Ut,Xr),e(Ze,Ar),_(t,Ta,f),_(t,Ko,f),e(Ko,Sr),_(t,wa,f),_(t,en,f),e(en,Xn),e(Xn,Pr),_(t,ka,f),_(t,tn,f),e(tn,Lr),_(t,Qa,f),_(t,A,f),e(A,An),e(An,Sn),e(Sn,Hr),e(A,Yr),e(A,Pn),e(Pn,Ne),e(Ne,Or),e(Ne,Et),e(Et,Kr),e(Ne,ei),e(Ne,Ln),e(Ln,ti),e(A,oi),e(A,Hn),e(Hn,Ft),e(Ft,ni),e(Ft,Yn),e(Yn,si),e(Ft,ai),e(A,ri),e(A,On),e(On,Ct),e(Ct,ii),e(Ct,on),e(on,li),e(Ct,di),_(t,va,f),_(t,Re,f),e(Re,ci),e(Re,qt),e(qt,pi),e(Re,hi),_(t,Ba,f),_(t,fe,f),e(fe,Ge),e(Ge,Kn),w(Wt,Kn,null),e(fe,mi),e(fe,es),e(es,ui),_(t,ja,f),_(t,U,f),e(U,fi),e(U,ts),e(ts,gi),e(U,_i),e(U,Dt),e(Dt,bi),e(U,yi),e(U,os),e(os,Mi),e(U,Ti),e(U,ns),e(ns,wi),e(U,ki),e(U,It),e(It,Qi),e(U,vi),_(t,Ja,f),_(t,Ve,f),e(Ve,Bi),e(Ve,ss),e(ss,ji),e(Ve,Ji),_(t,$a,f),_(t,nn,f),e(nn,$i),_(t,za,f),w(xt,t,f),_(t,Ua,f),_(t,ge,f),e(ge,Xe),e(Xe,as),w(Zt,as,null),e(ge,zi),e(ge,rs),e(rs,Ui),_(t,Ea,f),_(t,sn,f),e(sn,Ei),_(t,Fa,f),w(Nt,t,f),_(t,Ca,f),_(t,_e,f),e(_e,Ae),e(Ae,is),w(Rt,is,null),e(_e,Fi),e(_e,ls),e(ls,Ci),_(t,qa,f),_(t,ne,f),e(ne,qi),e(ne,Gt),e(Gt,Wi),e(ne,Di),e(ne,Vt),e(Vt,Ii),e(ne,xi),_(t,Wa,f),w(Xt,t,f),_(t,Da,f),_(t,be,f),e(be,Se),e(Se,ds),w(At,ds,null),e(be,Zi),e(be,cs),e(cs,Ni),_(t,Ia,f),_(t,E,f),e(E,ps),e(ps,an),e(an,Ri),e(E,Gi),e(E,hs),e(hs,rn),e(rn,Vi),e(E,Xi),e(E,ms),e(ms,ln),e(ln,Ai),e(E,Si),e(E,us),e(us,dn),e(dn,Pi),e(E,Li),e(E,fs),e(fs,cn),e(cn,Hi),e(E,Yi),e(E,gs),e(gs,pn),e(pn,Oi),_(t,xa,f),_(t,ye,f),e(ye,Pe),e(Pe,_s),w(St,_s,null),e(ye,Ki),e(ye,bs),e(bs,el),_(t,Za,f),_(t,V,f),w(Pt,V,null),e(V,tl),e(V,Me),e(Me,ol),e(Me,hn),e(hn,nl),e(Me,sl),e(Me,Lt),e(Lt,al),e(Me,rl),e(V,il),e(V,Te),e(Te,ll),e(Te,mn),e(mn,dl),e(Te,cl),e(Te,un),e(un,pl),e(Te,hl),e(V,ml),w(Le,V,null),_(t,Na,f),_(t,we,f),e(we,He),e(He,ys),w(Ht,ys,null),e(we,ul),e(we,Ms),e(Ms,fl),_(t,Ra,f),_(t,J,f),w(Yt,J,null),e(J,gl),e(J,Ts),e(Ts,_l),e(J,bl),e(J,Ot),e(Ot,yl),e(Ot,fn),e(fn,Ml),e(Ot,Tl),e(J,wl),e(J,Kt),e(Kt,kl),e(Kt,eo),e(eo,Ql),e(Kt,vl),e(J,Bl),e(J,to),e(to,jl),e(to,oo),e(oo,Jl),e(to,$l),e(J,zl),e(J,$),e($,Ul),e($,ws),e(ws,El),e($,Fl),e($,ks),e(ks,Cl),e($,ql),e($,Qs),e(Qs,Wl),e($,Dl),e($,vs),e(vs,Il),e($,xl),e($,Bs),e(Bs,Zl),e($,Nl),e($,js),e(js,Rl),e($,Gl),e(J,Vl),e(J,S),w(no,S,null),e(S,Xl),e(S,ke),e(ke,Al),e(ke,gn),e(gn,Sl),e(ke,Pl),e(ke,Js),e(Js,Ll),e(ke,Hl),e(S,Yl),w(Ye,S,null),e(S,Ol),w(Oe,S,null),_(t,Ga,f),_(t,Qe,f),e(Qe,Ke),e(Ke,$s),w(so,$s,null),e(Qe,Kl),e(Qe,zs),e(zs,ed),_(t,Va,f),_(t,F,f),w(ao,F,null),e(F,td),e(F,ro),e(ro,od),e(ro,Us),e(Us,nd),e(ro,sd),e(F,ad),e(F,io),e(io,rd),e(io,_n),e(_n,id),e(io,ld),e(F,dd),e(F,lo),e(lo,cd),e(lo,co),e(co,pd),e(lo,hd),e(F,md),e(F,P),w(po,P,null),e(P,ud),e(P,ve),e(ve,fd),e(ve,bn),e(bn,gd),e(ve,_d),e(ve,Es),e(Es,bd),e(ve,yd),e(P,Md),w(et,P,null),e(P,Td),w(tt,P,null),_(t,Xa,f),_(t,Be,f),e(Be,ot),e(ot,Fs),w(ho,Fs,null),e(Be,wd),e(Be,Cs),e(Cs,kd),_(t,Aa,f),_(t,C,f),w(mo,C,null),e(C,Qd),e(C,uo),e(uo,vd),e(uo,qs),e(qs,Bd),e(uo,jd),e(C,Jd),e(C,fo),e(fo,$d),e(fo,yn),e(yn,zd),e(fo,Ud),e(C,Ed),e(C,go),e(go,Fd),e(go,_o),e(_o,Cd),e(go,qd),e(C,Wd),e(C,L),w(bo,L,null),e(L,Dd),e(L,je),e(je,Id),e(je,Mn),e(Mn,xd),e(je,Zd),e(je,Ws),e(Ws,Nd),e(je,Rd),e(L,Gd),w(nt,L,null),e(L,Vd),w(st,L,null),_(t,Sa,f),_(t,Je,f),e(Je,at),e(at,Ds),w(yo,Ds,null),e(Je,Xd),e(Je,Is),e(Is,Ad),_(t,Pa,f),_(t,q,f),w(Mo,q,null),e(q,Sd),e(q,xs),e(xs,Pd),e(q,Ld),e(q,To),e(To,Hd),e(To,Tn),e(Tn,Yd),e(To,Od),e(q,Kd),e(q,wo),e(wo,ec),e(wo,ko),e(ko,tc),e(wo,oc),e(q,nc),e(q,N),w(Qo,N,null),e(N,sc),e(N,$e),e($e,ac),e($e,wn),e(wn,rc),e($e,ic),e($e,Zs),e(Zs,lc),e($e,dc),e(N,cc),w(rt,N,null),e(N,pc),w(it,N,null),e(N,hc),w(lt,N,null),_(t,La,f),_(t,ze,f),e(ze,dt),e(dt,Ns),w(vo,Ns,null),e(ze,mc),e(ze,Rs),e(Rs,uc),_(t,Ha,f),_(t,W,f),w(Bo,W,null),e(W,fc),e(W,jo),e(jo,gc),e(jo,Gs),e(Gs,_c),e(jo,bc),e(W,yc),e(W,Jo),e(Jo,Mc),e(Jo,kn),e(kn,Tc),e(Jo,wc),e(W,kc),e(W,$o),e($o,Qc),e($o,zo),e(zo,vc),e($o,Bc),e(W,jc),e(W,H),w(Uo,H,null),e(H,Jc),e(H,Ue),e(Ue,$c),e(Ue,Qn),e(Qn,zc),e(Ue,Uc),e(Ue,Vs),e(Vs,Ec),e(Ue,Fc),e(H,Cc),w(ct,H,null),e(H,qc),w(pt,H,null),_(t,Ya,f),_(t,Ee,f),e(Ee,ht),e(ht,Xs),w(Eo,Xs,null),e(Ee,Wc),e(Ee,As),e(As,Dc),_(t,Oa,f),_(t,D,f),w(Fo,D,null),e(D,Ic),e(D,Ss),e(Ss,xc),e(D,Zc),e(D,Co),e(Co,Nc),e(Co,vn),e(vn,Rc),e(Co,Gc),e(D,Vc),e(D,qo),e(qo,Xc),e(qo,Wo),e(Wo,Ac),e(qo,Sc),e(D,Pc),e(D,Y),w(Do,Y,null),e(Y,Lc),e(Y,Fe),e(Fe,Hc),e(Fe,Bn),e(Bn,Yc),e(Fe,Oc),e(Fe,Ps),e(Ps,Kc),e(Fe,ep),e(Y,tp),w(mt,Y,null),e(Y,op),w(ut,Y,null),_(t,Ka,f),_(t,Ce,f),e(Ce,ft),e(ft,Ls),w(Io,Ls,null),e(Ce,np),e(Ce,Hs),e(Hs,sp),_(t,er,f),_(t,I,f),w(xo,I,null),e(I,ap),e(I,Ys),e(Ys,rp),e(I,ip),e(I,Zo),e(Zo,lp),e(Zo,jn),e(jn,dp),e(Zo,cp),e(I,pp),e(I,No),e(No,hp),e(No,Ro),e(Ro,mp),e(No,up),e(I,fp),e(I,O),w(Go,O,null),e(O,gp),e(O,qe),e(qe,_p),e(qe,Jn),e(Jn,bp),e(qe,yp),e(qe,Os),e(Os,Mp),e(qe,Tp),e(O,wp),w(gt,O,null),e(O,kp),w(_t,O,null),_(t,tr,f),_(t,We,f),e(We,bt),e(bt,Ks),w(Vo,Ks,null),e(We,Qp),e(We,ea),e(ea,vp),_(t,or,f),_(t,x,f),w(Xo,x,null),e(x,Bp),e(x,De),e(De,jp),e(De,ta),e(ta,Jp),e(De,$p),e(De,oa),e(oa,zp),e(De,Up),e(x,Ep),e(x,Ao),e(Ao,Fp),e(Ao,$n),e($n,Cp),e(Ao,qp),e(x,Wp),e(x,So),e(So,Dp),e(So,Po),e(Po,Ip),e(So,xp),e(x,Zp),e(x,K),w(Lo,K,null),e(K,Np),e(K,Ie),e(Ie,Rp),e(Ie,zn),e(zn,Gp),e(Ie,Vp),e(Ie,na),e(na,Xp),e(Ie,Ap),e(K,Sp),w(yt,K,null),e(K,Pp),w(Mt,K,null),nr=!0},p(t,[f]){const Ho={};f&2&&(Ho.$$scope={dirty:f,ctx:t}),Le.$set(Ho);const sa={};f&2&&(sa.$$scope={dirty:f,ctx:t}),Ye.$set(sa);const aa={};f&2&&(aa.$$scope={dirty:f,ctx:t}),Oe.$set(aa);const ra={};f&2&&(ra.$$scope={dirty:f,ctx:t}),et.$set(ra);const Yo={};f&2&&(Yo.$$scope={dirty:f,ctx:t}),tt.$set(Yo);const ia={};f&2&&(ia.$$scope={dirty:f,ctx:t}),nt.$set(ia);const la={};f&2&&(la.$$scope={dirty:f,ctx:t}),st.$set(la);const da={};f&2&&(da.$$scope={dirty:f,ctx:t}),rt.$set(da);const Oo={};f&2&&(Oo.$$scope={dirty:f,ctx:t}),it.$set(Oo);const ca={};f&2&&(ca.$$scope={dirty:f,ctx:t}),lt.$set(ca);const pa={};f&2&&(pa.$$scope={dirty:f,ctx:t}),ct.$set(pa);const ha={};f&2&&(ha.$$scope={dirty:f,ctx:t}),pt.$set(ha);const ma={};f&2&&(ma.$$scope={dirty:f,ctx:t}),mt.$set(ma);const ua={};f&2&&(ua.$$scope={dirty:f,ctx:t}),ut.$set(ua);const oe={};f&2&&(oe.$$scope={dirty:f,ctx:t}),gt.$set(oe);const fa={};f&2&&(fa.$$scope={dirty:f,ctx:t}),_t.$set(fa);const ga={};f&2&&(ga.$$scope={dirty:f,ctx:t}),yt.$set(ga);const _a={};f&2&&(_a.$$scope={dirty:f,ctx:t}),Mt.$set(_a)},i(t){nr||(k(l.$$.fragment,t),k(zt.$$.fragment,t),k(Wt.$$.fragment,t),k(xt.$$.fragment,t),k(Zt.$$.fragment,t),k(Nt.$$.fragment,t),k(Rt.$$.fragment,t),k(Xt.$$.fragment,t),k(At.$$.fragment,t),k(St.$$.fragment,t),k(Pt.$$.fragment,t),k(Le.$$.fragment,t),k(Ht.$$.fragment,t),k(Yt.$$.fragment,t),k(no.$$.fragment,t),k(Ye.$$.fragment,t),k(Oe.$$.fragment,t),k(so.$$.fragment,t),k(ao.$$.fragment,t),k(po.$$.fragment,t),k(et.$$.fragment,t),k(tt.$$.fragment,t),k(ho.$$.fragment,t),k(mo.$$.fragment,t),k(bo.$$.fragment,t),k(nt.$$.fragment,t),k(st.$$.fragment,t),k(yo.$$.fragment,t),k(Mo.$$.fragment,t),k(Qo.$$.fragment,t),k(rt.$$.fragment,t),k(it.$$.fragment,t),k(lt.$$.fragment,t),k(vo.$$.fragment,t),k(Bo.$$.fragment,t),k(Uo.$$.fragment,t),k(ct.$$.fragment,t),k(pt.$$.fragment,t),k(Eo.$$.fragment,t),k(Fo.$$.fragment,t),k(Do.$$.fragment,t),k(mt.$$.fragment,t),k(ut.$$.fragment,t),k(Io.$$.fragment,t),k(xo.$$.fragment,t),k(Go.$$.fragment,t),k(gt.$$.fragment,t),k(_t.$$.fragment,t),k(Vo.$$.fragment,t),k(Xo.$$.fragment,t),k(Lo.$$.fragment,t),k(yt.$$.fragment,t),k(Mt.$$.fragment,t),nr=!0)},o(t){Q(l.$$.fragment,t),Q(zt.$$.fragment,t),Q(Wt.$$.fragment,t),Q(xt.$$.fragment,t),Q(Zt.$$.fragment,t),Q(Nt.$$.fragment,t),Q(Rt.$$.fragment,t),Q(Xt.$$.fragment,t),Q(At.$$.fragment,t),Q(St.$$.fragment,t),Q(Pt.$$.fragment,t),Q(Le.$$.fragment,t),Q(Ht.$$.fragment,t),Q(Yt.$$.fragment,t),Q(no.$$.fragment,t),Q(Ye.$$.fragment,t),Q(Oe.$$.fragment,t),Q(so.$$.fragment,t),Q(ao.$$.fragment,t),Q(po.$$.fragment,t),Q(et.$$.fragment,t),Q(tt.$$.fragment,t),Q(ho.$$.fragment,t),Q(mo.$$.fragment,t),Q(bo.$$.fragment,t),Q(nt.$$.fragment,t),Q(st.$$.fragment,t),Q(yo.$$.fragment,t),Q(Mo.$$.fragment,t),Q(Qo.$$.fragment,t),Q(rt.$$.fragment,t),Q(it.$$.fragment,t),Q(lt.$$.fragment,t),Q(vo.$$.fragment,t),Q(Bo.$$.fragment,t),Q(Uo.$$.fragment,t),Q(ct.$$.fragment,t),Q(pt.$$.fragment,t),Q(Eo.$$.fragment,t),Q(Fo.$$.fragment,t),Q(Do.$$.fragment,t),Q(mt.$$.fragment,t),Q(ut.$$.fragment,t),Q(Io.$$.fragment,t),Q(xo.$$.fragment,t),Q(Go.$$.fragment,t),Q(gt.$$.fragment,t),Q(_t.$$.fragment,t),Q(Vo.$$.fragment,t),Q(Xo.$$.fragment,t),Q(Lo.$$.fragment,t),Q(yt.$$.fragment,t),Q(Mt.$$.fragment,t),nr=!1},d(t){o(d),t&&o(y),t&&o(g),v(l),t&&o(ya),t&&o(ue),v(zt),t&&o(Ma),t&&o(Ze),t&&o(Ta),t&&o(Ko),t&&o(wa),t&&o(en),t&&o(ka),t&&o(tn),t&&o(Qa),t&&o(A),t&&o(va),t&&o(Re),t&&o(Ba),t&&o(fe),v(Wt),t&&o(ja),t&&o(U),t&&o(Ja),t&&o(Ve),t&&o($a),t&&o(nn),t&&o(za),v(xt,t),t&&o(Ua),t&&o(ge),v(Zt),t&&o(Ea),t&&o(sn),t&&o(Fa),v(Nt,t),t&&o(Ca),t&&o(_e),v(Rt),t&&o(qa),t&&o(ne),t&&o(Wa),v(Xt,t),t&&o(Da),t&&o(be),v(At),t&&o(Ia),t&&o(E),t&&o(xa),t&&o(ye),v(St),t&&o(Za),t&&o(V),v(Pt),v(Le),t&&o(Na),t&&o(we),v(Ht),t&&o(Ra),t&&o(J),v(Yt),v(no),v(Ye),v(Oe),t&&o(Ga),t&&o(Qe),v(so),t&&o(Va),t&&o(F),v(ao),v(po),v(et),v(tt),t&&o(Xa),t&&o(Be),v(ho),t&&o(Aa),t&&o(C),v(mo),v(bo),v(nt),v(st),t&&o(Sa),t&&o(Je),v(yo),t&&o(Pa),t&&o(q),v(Mo),v(Qo),v(rt),v(it),v(lt),t&&o(La),t&&o(ze),v(vo),t&&o(Ha),t&&o(W),v(Bo),v(Uo),v(ct),v(pt),t&&o(Ya),t&&o(Ee),v(Eo),t&&o(Oa),t&&o(D),v(Fo),v(Do),v(mt),v(ut),t&&o(Ka),t&&o(Ce),v(Io),t&&o(er),t&&o(I),v(xo),v(Go),v(gt),v(_t),t&&o(tr),t&&o(We),v(Vo),t&&o(or),t&&o(x),v(Xo),v(Lo),v(yt),v(Mt)}}}const Uu={local:"qdqbert",sections:[{local:"overview",sections:[{local:"set-default-quantizers",title:"Set default quantizers"},{local:"calibration",title:"Calibration"},{local:"export-to-onnx",title:"Export to ONNX"}],title:"Overview"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.QDQBertConfig",title:"QDQBertConfig"},{local:"transformers.QDQBertModel",title:"QDQBertModel"},{local:"transformers.QDQBertLMHeadModel",title:"QDQBertLMHeadModel"},{local:"transformers.QDQBertForMaskedLM",title:"QDQBertForMaskedLM"},{local:"transformers.QDQBertForSequenceClassification",title:"QDQBertForSequenceClassification"},{local:"transformers.QDQBertForNextSentencePrediction",title:"QDQBertForNextSentencePrediction"},{local:"transformers.QDQBertForMultipleChoice",title:"QDQBertForMultipleChoice"},{local:"transformers.QDQBertForTokenClassification",title:"QDQBertForTokenClassification"},{local:"transformers.QDQBertForQuestionAnswering",title:"QDQBertForQuestionAnswering"}],title:"QDQBERT"};function Eu(B){return pu(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xu extends iu{constructor(d){super();lu(this,d,Eu,zu,du,{})}}export{xu as default,Uu as metadata};
