import{S as im,i as lm,s as dm,e as n,k as p,w as M,t as r,M as cm,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 v,o as k,B as Q,v as pm,L as ue}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 hm(B){let d,y,g,m,b;return m=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(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);y=i(u,"Examples:"),u.forEach(o),g=h(l),T(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,y),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(v(m.$$.fragment,l),b=!0)},o(l){k(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),Q(m,l)}}}function um(B){let d,y,g,m,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"),m=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 u=a(d);y=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var j=a(g);m=i(j,"Module"),j.forEach(o),b=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(o)},m(l,u){_(l,d,u),e(d,y),e(d,g),e(g,m),e(d,b)},d(l){l&&o(d)}}}function mm(B){let d,y,g,m,b;return m=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(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);y=i(u,"Example:"),u.forEach(o),g=h(l),T(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,y),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(v(m.$$.fragment,l),b=!0)},o(l){k(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),Q(m,l)}}}function fm(B){let d,y,g,m,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"),m=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 u=a(d);y=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var j=a(g);m=i(j,"Module"),j.forEach(o),b=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(o)},m(l,u){_(l,d,u),e(d,y),e(d,g),e(g,m),e(d,b)},d(l){l&&o(d)}}}function gm(B){let d,y,g,m,b;return m=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(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);y=i(u,"Example:"),u.forEach(o),g=h(l),T(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,y),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(v(m.$$.fragment,l),b=!0)},o(l){k(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),Q(m,l)}}}function _m(B){let d,y,g,m,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"),m=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 u=a(d);y=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var j=a(g);m=i(j,"Module"),j.forEach(o),b=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(o)},m(l,u){_(l,d,u),e(d,y),e(d,g),e(g,m),e(d,b)},d(l){l&&o(d)}}}function bm(B){let d,y,g,m,b;return m=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(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);y=i(u,"Example:"),u.forEach(o),g=h(l),T(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,y),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(v(m.$$.fragment,l),b=!0)},o(l){k(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),Q(m,l)}}}function ym(B){let d,y,g,m,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"),m=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 u=a(d);y=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var j=a(g);m=i(j,"Module"),j.forEach(o),b=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(o)},m(l,u){_(l,d,u),e(d,y),e(d,g),e(g,m),e(d,b)},d(l){l&&o(d)}}}function Mm(B){let d,y,g,m,b;return m=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(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);y=i(u,"Example of single-label classification:"),u.forEach(o),g=h(l),T(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,y),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(v(m.$$.fragment,l),b=!0)},o(l){k(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),Q(m,l)}}}function Tm(B){let d,y,g,m,b;return m=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(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);y=i(u,"Example of multi-label classification:"),u.forEach(o),g=h(l),T(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,y),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(v(m.$$.fragment,l),b=!0)},o(l){k(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),Q(m,l)}}}function wm(B){let d,y,g,m,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"),m=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 u=a(d);y=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var j=a(g);m=i(j,"Module"),j.forEach(o),b=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(o)},m(l,u){_(l,d,u),e(d,y),e(d,g),e(g,m),e(d,b)},d(l){l&&o(d)}}}function vm(B){let d,y,g,m,b;return m=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(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);y=i(u,"Example:"),u.forEach(o),g=h(l),T(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,y),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(v(m.$$.fragment,l),b=!0)},o(l){k(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),Q(m,l)}}}function km(B){let d,y,g,m,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"),m=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 u=a(d);y=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var j=a(g);m=i(j,"Module"),j.forEach(o),b=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(o)},m(l,u){_(l,d,u),e(d,y),e(d,g),e(g,m),e(d,b)},d(l){l&&o(d)}}}function Qm(B){let d,y,g,m,b;return m=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(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);y=i(u,"Example:"),u.forEach(o),g=h(l),T(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,y),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(v(m.$$.fragment,l),b=!0)},o(l){k(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),Q(m,l)}}}function Bm(B){let d,y,g,m,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"),m=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 u=a(d);y=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var j=a(g);m=i(j,"Module"),j.forEach(o),b=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(o)},m(l,u){_(l,d,u),e(d,y),e(d,g),e(g,m),e(d,b)},d(l){l&&o(d)}}}function jm(B){let d,y,g,m,b;return m=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(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);y=i(u,"Example:"),u.forEach(o),g=h(l),T(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,y),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(v(m.$$.fragment,l),b=!0)},o(l){k(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),Q(m,l)}}}function Jm(B){let d,y,g,m,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"),m=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 u=a(d);y=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var j=a(g);m=i(j,"Module"),j.forEach(o),b=i(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(o)},m(l,u){_(l,d,u),e(d,y),e(d,g),e(g,m),e(d,b)},d(l){l&&o(d)}}}function $m(B){let d,y,g,m,b;return m=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(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);y=i(u,"Example:"),u.forEach(o),g=h(l),T(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,y),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(v(m.$$.fragment,l),b=!0)},o(l){k(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),Q(m,l)}}}function zm(B){let d,y,g,m,b,l,u,j,Nr,ya,me,xe,Gn,zt,Rr,Vn,Gr,Ma,Ze,Vr,Ut,Xr,Ar,Ta,Ko,Sr,wa,en,Xn,Pr,va,tn,Lr,ka,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,Qa,Re,ci,qt,pi,hi,Ba,fe,Ge,Kn,Wt,ui,es,mi,ja,U,fi,ts,gi,_i,Dt,bi,yi,os,Mi,Ti,ns,wi,vi,It,ki,Qi,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,us,ln,Ai,Si,ms,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,un,dl,cl,mn,pl,hl,ul,Le,Na,we,He,ys,Ht,ml,Ms,fl,Ra,J,Yt,gl,Ts,_l,bl,Ot,yl,fn,Ml,Tl,wl,Kt,vl,eo,kl,Ql,Bl,to,jl,oo,Jl,$l,zl,$,Ul,ws,El,Fl,vs,Cl,ql,ks,Wl,Dl,Qs,Il,xl,Bs,Zl,Nl,js,Rl,Gl,Vl,S,no,Xl,ve,Al,gn,Sl,Pl,Js,Ll,Hl,Yl,Ye,Ol,Oe,Ga,ke,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,ud,P,po,md,Qe,fd,bn,gd,_d,Es,bd,yd,Md,et,Td,tt,Xa,Be,ot,Fs,ho,wd,Cs,vd,Aa,C,uo,kd,mo,Qd,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,vo,tc,oc,nc,N,ko,sc,$e,ac,wn,rc,ic,Zs,lc,dc,cc,rt,pc,it,hc,lt,La,ze,dt,Ns,Qo,uc,Rs,mc,Ha,W,Bo,fc,jo,gc,Gs,_c,bc,yc,Jo,Mc,vn,Tc,wc,vc,$o,kc,zo,Qc,Bc,jc,H,Uo,Jc,Ue,$c,kn,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,Qn,Rc,Gc,Vc,qo,Xc,Wo,Ac,Sc,Pc,Y,Do,Lc,Fe,Hc,Bn,Yc,Oc,Ps,Kc,ep,tp,ut,op,mt,Ka,Ce,ft,Ls,Io,np,Hs,sp,er,I,xo,ap,Ys,rp,ip,Zo,lp,jn,dp,cp,pp,No,hp,Ro,up,mp,fp,O,Go,gp,qe,_p,Jn,bp,yp,Os,Mp,Tp,wp,gt,vp,_t,tr,We,bt,Ks,Vo,kp,ea,Qp,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/v4.32.0/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/v4.32.0/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/v4.32.0/src/transformers/models/qdqbert/configuration_qdqbert.py#L29"}}),Le=new he({props:{anchor:"transformers.QDQBertConfig.example",$$slots:{default:[hm]},$$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/v4.32.0/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/v4.32.0/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/v4.32.0/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/v4.32.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L875",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/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:[um]},$$scope:{ctx:B}}}),Oe=new he({props:{anchor:"transformers.QDQBertModel.forward.example",$$slots:{default:[mm]},$$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/v4.32.0/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/v4.32.0/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/v4.32.0/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/v4.32.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1037",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/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:[fm]},$$scope:{ctx:B}}}),tt=new he({props:{anchor:"transformers.QDQBertLMHeadModel.forward.example",$$slots:{default:[gm]},$$scope:{ctx:B}}}),ho=new Z({}),uo=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/v4.32.0/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/v4.32.0/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/v4.32.0/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/v4.32.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1192",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/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:[_m]},$$scope:{ctx:B}}}),st=new he({props:{anchor:"transformers.QDQBertForMaskedLM.forward.example",$$slots:{default:[bm]},$$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/v4.32.0/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/v4.32.0/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/v4.32.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1382"}}),ko=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/v4.32.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1394",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/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:[ym]},$$scope:{ctx:B}}}),it=new he({props:{anchor:"transformers.QDQBertForSequenceClassification.forward.example",$$slots:{default:[Mm]},$$scope:{ctx:B}}}),lt=new he({props:{anchor:"transformers.QDQBertForSequenceClassification.forward.example-2",$$slots:{default:[Tm]},$$scope:{ctx:B}}}),Qo=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/v4.32.0/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/v4.32.0/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/v4.32.0/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/v4.32.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1288",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/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:[wm]},$$scope:{ctx:B}}}),pt=new he({props:{anchor:"transformers.QDQBertForNextSentencePrediction.forward.example",$$slots:{default:[vm]},$$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/v4.32.0/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/v4.32.0/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/v4.32.0/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/v4.32.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1490",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/en/main_classes/output#transformers.modeling_outputs.MultipleChoiceModelOutput"
>transformers.modeling_outputs.MultipleChoiceModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ut=new $t({props:{$$slots:{default:[km]},$$scope:{ctx:B}}}),mt=new he({props:{anchor:"transformers.QDQBertForMultipleChoice.forward.example",$$slots:{default:[Qm]},$$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/v4.32.0/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/v4.32.0/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/v4.32.0/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/v4.32.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1582",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/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:[Bm]},$$scope:{ctx:B}}}),_t=new he({props:{anchor:"transformers.QDQBertForTokenClassification.forward.example",$$slots:{default:[jm]},$$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/v4.32.0/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/v4.32.0/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/v4.32.0/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/v4.32.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1659",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/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:[Jm]},$$scope:{ctx:B}}}),Mt=new he({props:{anchor:"transformers.QDQBertForQuestionAnswering.forward.example",$$slots:{default:[$m]},$$scope:{ctx:B}}}),{c(){d=n("meta"),y=p(),g=n("h1"),m=n("a"),b=n("span"),M(l.$$.fragment),u=p(),j=n("span"),Nr=r("QDQBERT"),ya=p(),me=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.`),va=p(),tn=n("p"),Lr=r("Tips:"),ka=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("."),Qa=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),ui=p(),es=n("span"),mi=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"),vi=r(" defining how the tensor should be quantized. Refer to "),It=n("a"),ki=r(`Pytorch
Quantization Toolkit userguide`),Qi=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(),us=n("li"),ln=n("a"),Ai=r("Question answering task guide"),Si=p(),ms=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 "),un=n("a"),dl=r("PretrainedConfig"),cl=r(` and can be used to control the model outputs. Read the
documentation from `),mn=n("a"),pl=r("PretrainedConfig"),hl=r(" for more information."),ul=p(),M(Le.$$.fragment),Na=p(),we=n("h2"),He=n("a"),ys=n("span"),M(Ht.$$.fragment),ml=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"),vl=r("This model is also a PyTorch "),eo=n("a"),kl=r("torch.nn.Module"),Ql=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 `),vs=n("code"),Cl=r("True"),ql=r(". To be used in a Seq2Seq model, the model needs to initialized with both "),ks=n("code"),Wl=r("is_decoder"),Dl=r(` argument and
`),Qs=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(),ve=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(),ke=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.`),ud=p(),P=n("div"),M(po.$$.fragment),md=p(),Qe=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"),vd=r("QDQBertForMaskedLM"),Aa=p(),C=n("div"),M(uo.$$.fragment),kd=p(),mo=n("p"),Qd=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 "),vo=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(ko.$$.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(Qo.$$.fragment),uc=p(),Rs=n("span"),mc=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 "),vn=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.)`),vc=p(),$o=n("p"),kc=r("This model is also a PyTorch "),zo=n("a"),Qc=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 "),kn=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 "),Qn=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(ut.$$.fragment),op=p(),M(mt.$$.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"),up=r("torch.nn.Module"),mp=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),vp=p(),M(_t.$$.fragment),tr=p(),We=n("h2"),bt=n("a"),Ks=n("span"),M(Vo.$$.fragment),kp=p(),ea=n("span"),Qp=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=cm('[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);m=s(Ho,"A",{id:!0,class:!0,href:!0});var sa=a(m);b=s(sa,"SPAN",{});var aa=a(b);T(l.$$.fragment,aa),aa.forEach(o),sa.forEach(o),u=h(Ho),j=s(Ho,"SPAN",{});var ra=a(j);Nr=i(ra,"QDQBERT"),ra.forEach(o),Ho.forEach(o),ya=h(t),me=s(t,"H2",{class:!0});var Yo=a(me);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 ua=a(Xn);Pr=i(ua,`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.`),ua.forEach(o),ha.forEach(o),va=h(t),tn=s(t,"P",{});var ma=a(tn);Lr=i(ma,"Tips:"),ma.forEach(o),ka=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),Qa=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),ui=h(ir),es=s(ir,"SPAN",{});var sh=a(es);mi=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),vi=i(ee," defining how the tensor should be quantized. Refer to "),It=s(ee,"A",{href:!0,rel:!0});var dh=a(It);ki=i(dh,`Pytorch
Quantization Toolkit userguide`),dh.forEach(o),Qi=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 uh=a(as);T(Zt.$$.fragment,uh),uh.forEach(o),hh.forEach(o),zi=h(dr),rs=s(dr,"SPAN",{});var mh=a(rs);Ui=i(mh,"Calibration"),mh.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 vh=a(cs);Ni=i(vh,"Documentation resources"),vh.forEach(o),pr.forEach(o),Ia=h(t),E=s(t,"UL",{});var te=a(E);ps=s(te,"LI",{});var kh=a(ps);an=s(kh,"A",{href:!0});var Qh=a(an);Ri=i(Qh,"Text classification task guide"),Qh.forEach(o),kh.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),us=s(te,"LI",{});var Jh=a(us);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),ms=s(te,"LI",{});var zh=a(ms);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 "),un=s(Fn,"A",{href:!0});var Nh=a(un);dl=i(Nh,"PretrainedConfig"),Nh.forEach(o),cl=i(Fn,` and can be used to control the model outputs. Read the
documentation from `),mn=s(Fn,"A",{href:!0});var Rh=a(mn);pl=i(Rh,"PretrainedConfig"),Rh.forEach(o),hl=i(Fn," for more information."),Fn.forEach(o),ul=h(Tt),T(Le.$$.fragment,Tt),Tt.forEach(o),Na=h(t),we=s(t,"H2",{class:!0});var ur=a(we);He=s(ur,"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),ml=h(ur),Ms=s(ur,"SPAN",{});var Xh=a(Ms);fl=i(Xh,"QDQBertModel"),Xh.forEach(o),ur.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 mr=a(Ot);yl=i(mr,"This model inherits from "),fn=s(mr,"A",{href:!0});var Sh=a(fn);Ml=i(Sh,"PreTrainedModel"),Sh.forEach(o),Tl=i(mr,`. 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.)`),mr.forEach(o),wl=h(R),Kt=s(R,"P",{});var fr=a(Kt);vl=i(fr,"This model is also a PyTorch "),eo=s(fr,"A",{href:!0,rel:!0});var Ph=a(eo);kl=i(Ph,"torch.nn.Module"),Ph.forEach(o),Ql=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 `),vs=s(G,"CODE",{});var Yh=a(vs);Cl=i(Yh,"True"),Yh.forEach(o),ql=i(G,". To be used in a Seq2Seq model, the model needs to initialized with both "),ks=s(G,"CODE",{});var Oh=a(ks);Wl=i(Oh,"is_decoder"),Oh.forEach(o),Dl=i(G,` argument and
`),Qs=s(G,"CODE",{});var Kh=a(Qs);Il=i(Kh,"add_cross_attention"),Kh.forEach(o),xl=i(G," set to "),Bs=s(G,"CODE",{});var eu=a(Bs);Zl=i(eu,"True"),eu.forEach(o),Nl=i(G,"; an "),js=s(G,"CODE",{});var tu=a(js);Rl=i(tu,"encoder_hidden_states"),tu.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),ve=s(wt,"P",{});var Cn=a(ve);Al=i(Cn,"The "),gn=s(Cn,"A",{href:!0});var ou=a(gn);Sl=i(ou,"QDQBertModel"),ou.forEach(o),Pl=i(Cn," forward method, overrides the "),Js=s(Cn,"CODE",{});var nu=a(Js);Ll=i(nu,"__call__"),nu.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),ke=s(t,"H2",{class:!0});var _r=a(ke);Ke=s(_r,"A",{id:!0,class:!0,href:!0});var su=a(Ke);$s=s(su,"SPAN",{});var au=a($s);T(so.$$.fragment,au),au.forEach(o),su.forEach(o),Kl=h(_r),zs=s(_r,"SPAN",{});var ru=a(zs);ed=i(ru,"QDQBertLMHeadModel"),ru.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 iu=a(Us);nd=i(iu,"language modeling"),iu.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 lu=a(_n);id=i(lu,"PreTrainedModel"),lu.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 du=a(co);pd=i(du,"torch.nn.Module"),du.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),ud=h(se),P=s(se,"DIV",{class:!0});var vt=a(P);T(po.$$.fragment,vt),md=h(vt),Qe=s(vt,"P",{});var qn=a(Qe);fd=i(qn,"The "),bn=s(qn,"A",{href:!0});var cu=a(bn);gd=i(cu,"QDQBertLMHeadModel"),cu.forEach(o),_d=i(qn," forward method, overrides the "),Es=s(qn,"CODE",{});var pu=a(Es);bd=i(pu,"__call__"),pu.forEach(o),yd=i(qn," special method."),qn.forEach(o),Md=h(vt),T(et.$$.fragment,vt),Td=h(vt),T(tt.$$.fragment,vt),vt.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 hu=a(ot);Fs=s(hu,"SPAN",{});var uu=a(Fs);T(ho.$$.fragment,uu),uu.forEach(o),hu.forEach(o),wd=h(Tr),Cs=s(Tr,"SPAN",{});var mu=a(Cs);vd=i(mu,"QDQBertForMaskedLM"),mu.forEach(o),Tr.forEach(o),Aa=h(t),C=s(t,"DIV",{class:!0});var ae=a(C);T(uo.$$.fragment,ae),kd=h(ae),mo=s(ae,"P",{});var wr=a(mo);Qd=i(wr,"QDQBERT Model with a "),qs=s(wr,"CODE",{});var fu=a(qs);Bd=i(fu,"language modeling"),fu.forEach(o),jd=i(wr," head on top."),wr.forEach(o),Jd=h(ae),fo=s(ae,"P",{});var vr=a(fo);$d=i(vr,"This model inherits from "),yn=s(vr,"A",{href:!0});var gu=a(yn);zd=i(gu,"PreTrainedModel"),gu.forEach(o),Ud=i(vr,`. 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.)`),vr.forEach(o),Ed=h(ae),go=s(ae,"P",{});var kr=a(go);Fd=i(kr,"This model is also a PyTorch "),_o=s(kr,"A",{href:!0,rel:!0});var _u=a(_o);Cd=i(_u,"torch.nn.Module"),_u.forEach(o),qd=i(kr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),kr.forEach(o),Wd=h(ae),L=s(ae,"DIV",{class:!0});var kt=a(L);T(bo.$$.fragment,kt),Dd=h(kt),je=s(kt,"P",{});var Wn=a(je);Id=i(Wn,"The "),Mn=s(Wn,"A",{href:!0});var bu=a(Mn);xd=i(bu,"QDQBertForMaskedLM"),bu.forEach(o),Zd=i(Wn," forward method, overrides the "),Ws=s(Wn,"CODE",{});var yu=a(Ws);Nd=i(yu,"__call__"),yu.forEach(o),Rd=i(Wn," special method."),Wn.forEach(o),Gd=h(kt),T(nt.$$.fragment,kt),Vd=h(kt),T(st.$$.fragment,kt),kt.forEach(o),ae.forEach(o),Sa=h(t),Je=s(t,"H2",{class:!0});var Qr=a(Je);at=s(Qr,"A",{id:!0,class:!0,href:!0});var Mu=a(at);Ds=s(Mu,"SPAN",{});var Tu=a(Ds);T(yo.$$.fragment,Tu),Tu.forEach(o),Mu.forEach(o),Xd=h(Qr),Is=s(Qr,"SPAN",{});var wu=a(Is);Ad=i(wu,"QDQBertForSequenceClassification"),wu.forEach(o),Qr.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 vu=a(xs);Pd=i(vu,`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.`),vu.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 ku=a(Tn);Yd=i(ku,"PreTrainedModel"),ku.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 "),vo=s(jr,"A",{href:!0,rel:!0});var Qu=a(vo);tc=i(Qu,"torch.nn.Module"),Qu.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(ko.$$.fragment,ie),sc=h(ie),$e=s(ie,"P",{});var Dn=a($e);ac=i(Dn,"The "),wn=s(Dn,"A",{href:!0});var Bu=a(wn);rc=i(Bu,"QDQBertForSequenceClassification"),Bu.forEach(o),ic=i(Dn," forward method, overrides the "),Zs=s(Dn,"CODE",{});var ju=a(Zs);lc=i(ju,"__call__"),ju.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 Ju=a(dt);Ns=s(Ju,"SPAN",{});var $u=a(Ns);T(Qo.$$.fragment,$u),$u.forEach(o),Ju.forEach(o),uc=h(Jr),Rs=s(Jr,"SPAN",{});var zu=a(Rs);mc=i(zu,"QDQBertForNextSentencePrediction"),zu.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 Uu=a(Gs);_c=i(Uu,"next sentence prediction (classification)"),Uu.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 "),vn=s(zr,"A",{href:!0});var Eu=a(vn);Tc=i(Eu,"PreTrainedModel"),Eu.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),vc=h(le),$o=s(le,"P",{});var Ur=a($o);kc=i(Ur,"This model is also a PyTorch "),zo=s(Ur,"A",{href:!0,rel:!0});var Fu=a(zo);Qc=i(Fu,"torch.nn.Module"),Fu.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 Qt=a(H);T(Uo.$$.fragment,Qt),Jc=h(Qt),Ue=s(Qt,"P",{});var In=a(Ue);$c=i(In,"The "),kn=s(In,"A",{href:!0});var Cu=a(kn);zc=i(Cu,"QDQBertForNextSentencePrediction"),Cu.forEach(o),Uc=i(In," forward method, overrides the "),Vs=s(In,"CODE",{});var qu=a(Vs);Ec=i(qu,"__call__"),qu.forEach(o),Fc=i(In," special method."),In.forEach(o),Cc=h(Qt),T(ct.$$.fragment,Qt),qc=h(Qt),T(pt.$$.fragment,Qt),Qt.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 Wu=a(ht);Xs=s(Wu,"SPAN",{});var Du=a(Xs);T(Eo.$$.fragment,Du),Du.forEach(o),Wu.forEach(o),Wc=h(Er),As=s(Er,"SPAN",{});var Iu=a(As);Dc=i(Iu,"QDQBertForMultipleChoice"),Iu.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 xu=a(Ss);xc=i(xu,`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.`),xu.forEach(o),Zc=h(de),Co=s(de,"P",{});var Fr=a(Co);Nc=i(Fr,"This model inherits from "),Qn=s(Fr,"A",{href:!0});var Zu=a(Qn);Rc=i(Zu,"PreTrainedModel"),Zu.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 Nu=a(Wo);Ac=i(Nu,"torch.nn.Module"),Nu.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 Ru=a(Bn);Yc=i(Ru,"QDQBertForMultipleChoice"),Ru.forEach(o),Oc=i(xn," forward method, overrides the "),Ps=s(xn,"CODE",{});var Gu=a(Ps);Kc=i(Gu,"__call__"),Gu.forEach(o),ep=i(xn," special method."),xn.forEach(o),tp=h(Bt),T(ut.$$.fragment,Bt),op=h(Bt),T(mt.$$.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 Vu=a(ft);Ls=s(Vu,"SPAN",{});var Xu=a(Ls);T(Io.$$.fragment,Xu),Xu.forEach(o),Vu.forEach(o),np=h(qr),Hs=s(qr,"SPAN",{});var Au=a(Hs);sp=i(Au,"QDQBertForTokenClassification"),Au.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 Su=a(Ys);rp=i(Su,`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.`),Su.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 Pu=a(jn);dp=i(Pu,"PreTrainedModel"),Pu.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 Lu=a(Ro);up=i(Lu,"torch.nn.Module"),Lu.forEach(o),mp=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 Hu=a(Jn);bp=i(Hu,"QDQBertForTokenClassification"),Hu.forEach(o),yp=i(Zn," forward method, overrides the "),Os=s(Zn,"CODE",{});var Yu=a(Os);Mp=i(Yu,"__call__"),Yu.forEach(o),Tp=i(Zn," special method."),Zn.forEach(o),wp=h(jt),T(gt.$$.fragment,jt),vp=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 Ou=a(bt);Ks=s(Ou,"SPAN",{});var Ku=a(Ks);T(Vo.$$.fragment,Ku),Ku.forEach(o),Ou.forEach(o),kp=h(Ir),ea=s(Ir,"SPAN",{});var em=a(ea);Qp=i(em,"QDQBertForQuestionAnswering"),em.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 tm=a(ta);Jp=i(tm,"span start logits"),tm.forEach(o),$p=i(Nn," and "),oa=s(Nn,"CODE",{});var om=a(oa);zp=i(om,"span end logits"),om.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 nm=a($n);Cp=i(nm,"PreTrainedModel"),nm.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 sm=a(Po);Ip=i(sm,"torch.nn.Module"),sm.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 am=a(zn);Gp=i(am,"QDQBertForQuestionAnswering"),am.forEach(o),Vp=i(Rn," forward method, overrides the "),na=s(Rn,"CODE",{});var rm=a(na);Xp=i(rm,"__call__"),rm.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(Um)),c(m,"id","qdqbert"),c(m,"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(m,"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(me,"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/v4.32.0/en/model_doc/qdqbert#transformers.QDQBertModel"),c(Lt,"href","https://huggingface.co/bert-base-uncased"),c(Lt,"rel","nofollow"),c(un,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(mn,"href","/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/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(ke,"class","relative group"),c(_n,"href","/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/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/v4.32.0/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/v4.32.0/en/main_classes/model#transformers.PreTrainedModel"),c(vo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(vo,"rel","nofollow"),c(wn,"href","/docs/transformers/v4.32.0/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(vn,"href","/docs/transformers/v4.32.0/en/main_classes/model#transformers.PreTrainedModel"),c(zo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(zo,"rel","nofollow"),c(kn,"href","/docs/transformers/v4.32.0/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(Qn,"href","/docs/transformers/v4.32.0/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/v4.32.0/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/v4.32.0/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/v4.32.0/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/v4.32.0/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/v4.32.0/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,m),e(m,b),w(l,b,null),e(g,u),e(g,j),e(j,Nr),_(t,ya,f),_(t,me,f),e(me,xe),e(xe,Gn),w(zt,Gn,null),e(me,Rr),e(me,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,va,f),_(t,tn,f),e(tn,Lr),_(t,ka,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,Qa,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,ui),e(fe,es),e(es,mi),_(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,vi),e(U,It),e(It,ki),e(U,Qi),_(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,us),e(us,ln),e(ln,Ai),e(E,Si),e(E,ms),e(ms,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,un),e(un,dl),e(Te,cl),e(Te,mn),e(mn,pl),e(Te,hl),e(V,ul),w(Le,V,null),_(t,Na,f),_(t,we,f),e(we,He),e(He,ys),w(Ht,ys,null),e(we,ml),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,vl),e(Kt,eo),e(eo,kl),e(Kt,Ql),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($,vs),e(vs,Cl),e($,ql),e($,ks),e(ks,Wl),e($,Dl),e($,Qs),e(Qs,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,ve),e(ve,Al),e(ve,gn),e(gn,Sl),e(ve,Pl),e(ve,Js),e(Js,Ll),e(ve,Hl),e(S,Yl),w(Ye,S,null),e(S,Ol),w(Oe,S,null),_(t,Ga,f),_(t,ke,f),e(ke,Ke),e(Ke,$s),w(so,$s,null),e(ke,Kl),e(ke,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,ud),e(F,P),w(po,P,null),e(P,md),e(P,Qe),e(Qe,fd),e(Qe,bn),e(bn,gd),e(Qe,_d),e(Qe,Es),e(Es,bd),e(Qe,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,vd),_(t,Aa,f),_(t,C,f),w(uo,C,null),e(C,kd),e(C,mo),e(mo,Qd),e(mo,qs),e(qs,Bd),e(mo,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,vo),e(vo,tc),e(wo,oc),e(q,nc),e(q,N),w(ko,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(Qo,Ns,null),e(ze,uc),e(ze,Rs),e(Rs,mc),_(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,vn),e(vn,Tc),e(Jo,wc),e(W,vc),e(W,$o),e($o,kc),e($o,zo),e(zo,Qc),e($o,Bc),e(W,jc),e(W,H),w(Uo,H,null),e(H,Jc),e(H,Ue),e(Ue,$c),e(Ue,kn),e(kn,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,Qn),e(Qn,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(ut,Y,null),e(Y,op),w(mt,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,up),e(No,mp),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,vp),w(_t,O,null),_(t,tr,f),_(t,We,f),e(We,bt),e(bt,Ks),w(Vo,Ks,null),e(We,kp),e(We,ea),e(ea,Qp),_(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 ua={};f&2&&(ua.$$scope={dirty:f,ctx:t}),ut.$set(ua);const ma={};f&2&&(ma.$$scope={dirty:f,ctx:t}),mt.$set(ma);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||(v(l.$$.fragment,t),v(zt.$$.fragment,t),v(Wt.$$.fragment,t),v(xt.$$.fragment,t),v(Zt.$$.fragment,t),v(Nt.$$.fragment,t),v(Rt.$$.fragment,t),v(Xt.$$.fragment,t),v(At.$$.fragment,t),v(St.$$.fragment,t),v(Pt.$$.fragment,t),v(Le.$$.fragment,t),v(Ht.$$.fragment,t),v(Yt.$$.fragment,t),v(no.$$.fragment,t),v(Ye.$$.fragment,t),v(Oe.$$.fragment,t),v(so.$$.fragment,t),v(ao.$$.fragment,t),v(po.$$.fragment,t),v(et.$$.fragment,t),v(tt.$$.fragment,t),v(ho.$$.fragment,t),v(uo.$$.fragment,t),v(bo.$$.fragment,t),v(nt.$$.fragment,t),v(st.$$.fragment,t),v(yo.$$.fragment,t),v(Mo.$$.fragment,t),v(ko.$$.fragment,t),v(rt.$$.fragment,t),v(it.$$.fragment,t),v(lt.$$.fragment,t),v(Qo.$$.fragment,t),v(Bo.$$.fragment,t),v(Uo.$$.fragment,t),v(ct.$$.fragment,t),v(pt.$$.fragment,t),v(Eo.$$.fragment,t),v(Fo.$$.fragment,t),v(Do.$$.fragment,t),v(ut.$$.fragment,t),v(mt.$$.fragment,t),v(Io.$$.fragment,t),v(xo.$$.fragment,t),v(Go.$$.fragment,t),v(gt.$$.fragment,t),v(_t.$$.fragment,t),v(Vo.$$.fragment,t),v(Xo.$$.fragment,t),v(Lo.$$.fragment,t),v(yt.$$.fragment,t),v(Mt.$$.fragment,t),nr=!0)},o(t){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(uo.$$.fragment,t),k(bo.$$.fragment,t),k(nt.$$.fragment,t),k(st.$$.fragment,t),k(yo.$$.fragment,t),k(Mo.$$.fragment,t),k(ko.$$.fragment,t),k(rt.$$.fragment,t),k(it.$$.fragment,t),k(lt.$$.fragment,t),k(Qo.$$.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(ut.$$.fragment,t),k(mt.$$.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=!1},d(t){o(d),t&&o(y),t&&o(g),Q(l),t&&o(ya),t&&o(me),Q(zt),t&&o(Ma),t&&o(Ze),t&&o(Ta),t&&o(Ko),t&&o(wa),t&&o(en),t&&o(va),t&&o(tn),t&&o(ka),t&&o(A),t&&o(Qa),t&&o(Re),t&&o(Ba),t&&o(fe),Q(Wt),t&&o(ja),t&&o(U),t&&o(Ja),t&&o(Ve),t&&o($a),t&&o(nn),t&&o(za),Q(xt,t),t&&o(Ua),t&&o(ge),Q(Zt),t&&o(Ea),t&&o(sn),t&&o(Fa),Q(Nt,t),t&&o(Ca),t&&o(_e),Q(Rt),t&&o(qa),t&&o(ne),t&&o(Wa),Q(Xt,t),t&&o(Da),t&&o(be),Q(At),t&&o(Ia),t&&o(E),t&&o(xa),t&&o(ye),Q(St),t&&o(Za),t&&o(V),Q(Pt),Q(Le),t&&o(Na),t&&o(we),Q(Ht),t&&o(Ra),t&&o(J),Q(Yt),Q(no),Q(Ye),Q(Oe),t&&o(Ga),t&&o(ke),Q(so),t&&o(Va),t&&o(F),Q(ao),Q(po),Q(et),Q(tt),t&&o(Xa),t&&o(Be),Q(ho),t&&o(Aa),t&&o(C),Q(uo),Q(bo),Q(nt),Q(st),t&&o(Sa),t&&o(Je),Q(yo),t&&o(Pa),t&&o(q),Q(Mo),Q(ko),Q(rt),Q(it),Q(lt),t&&o(La),t&&o(ze),Q(Qo),t&&o(Ha),t&&o(W),Q(Bo),Q(Uo),Q(ct),Q(pt),t&&o(Ya),t&&o(Ee),Q(Eo),t&&o(Oa),t&&o(D),Q(Fo),Q(Do),Q(ut),Q(mt),t&&o(Ka),t&&o(Ce),Q(Io),t&&o(er),t&&o(I),Q(xo),Q(Go),Q(gt),Q(_t),t&&o(tr),t&&o(We),Q(Vo),t&&o(or),t&&o(x),Q(Xo),Q(Lo),Q(yt),Q(Mt)}}}const Um={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 Em(B){return pm(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xm extends im{constructor(d){super();lm(this,d,Em,zm,dm,{})}}export{xm as default,Um as metadata};
