import{S as im,i as lm,s as dm,e as n,k as p,w as k,t as r,M as cm,c as s,d as o,m as h,a,x as Q,h as i,b as c,G as e,g as _,y as w,q as T,o as y,B as $,v as pm,L as ue}from"../../chunks/vendor-hf-doc-builder.js";import{T as Mt}from"../../chunks/Tip-hf-doc-builder.js";import{D as B}from"../../chunks/Docstring-hf-doc-builder.js";import{C as R}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as O}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as he}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function hm(q){let d,v,g,m,b;return m=new R({props:{code:`from transformers import QDQBertModel, QDQBertConfig

# Initializing a QDQBERT bert-base-uncased style configuration
configuration = QDQBertConfig()

# Initializing a model from the bert-base-uncased style configuration
model = QDQBertModel(configuration)

# Accessing the model configuration
configuration = model.config`,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"),v=r("Examples:"),g=p(),k(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);v=i(u,"Examples:"),u.forEach(o),g=h(l),Q(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,v),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(T(m.$$.fragment,l),b=!0)},o(l){y(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),$(m,l)}}}function um(q){let d,v,g,m,b;return{c(){d=n("p"),v=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);v=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var D=a(g);m=i(D,"Module"),D.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,v),e(d,g),e(g,m),e(d,b)},d(l){l&&o(d)}}}function mm(q){let d,v,g,m,b;return m=new R({props:{code:`from transformers import AutoTokenizer, QDQBertModel
import torch

tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
model = QDQBertModel.from_pretrained("bert-base-uncased")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state`,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"),v=r("Example:"),g=p(),k(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);v=i(u,"Example:"),u.forEach(o),g=h(l),Q(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,v),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(T(m.$$.fragment,l),b=!0)},o(l){y(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),$(m,l)}}}function fm(q){let d,v,g,m,b;return{c(){d=n("p"),v=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);v=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var D=a(g);m=i(D,"Module"),D.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,v),e(d,g),e(g,m),e(d,b)},d(l){l&&o(d)}}}function gm(q){let d,v,g,m,b;return m=new R({props:{code:`from transformers import AutoTokenizer, QDQBertLMHeadModel, QDQBertConfig
import torch

tokenizer = AutoTokenizer.from_pretrained("bert-base-cased")
config = QDQBertConfig.from_pretrained("bert-base-cased")
config.is_decoder = True
model = QDQBertLMHeadModel.from_pretrained("bert-base-cased", config=config)

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs)

prediction_logits = outputs.logits`,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"),v=r("Example:"),g=p(),k(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);v=i(u,"Example:"),u.forEach(o),g=h(l),Q(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,v),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(T(m.$$.fragment,l),b=!0)},o(l){y(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),$(m,l)}}}function _m(q){let d,v,g,m,b;return{c(){d=n("p"),v=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);v=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var D=a(g);m=i(D,"Module"),D.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,v),e(d,g),e(g,m),e(d,b)},d(l){l&&o(d)}}}function bm(q){let d,v,g,m,b;return m=new R({props:{code:`from transformers import AutoTokenizer, QDQBertForMaskedLM
import torch

tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
model = QDQBertForMaskedLM.from_pretrained("bert-base-uncased")

inputs = tokenizer("The capital of France is [MASK].", return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits

# retrieve index of [MASK]
mask_token_index = (inputs.input_ids == tokenizer.mask_token_id)[0].nonzero(as_tuple=True)[0]

predicted_token_id = logits[0, mask_token_index].argmax(axis=-1)

labels = tokenizer("The capital of France is Paris.", return_tensors="pt")["input_ids"]
# mask labels of non-[MASK] tokens
labels = torch.where(inputs.input_ids == tokenizer.mask_token_id, labels, -100)

outputs = model(**inputs, labels=labels)`,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"),v=r("Example:"),g=p(),k(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);v=i(u,"Example:"),u.forEach(o),g=h(l),Q(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,v),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(T(m.$$.fragment,l),b=!0)},o(l){y(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),$(m,l)}}}function vm(q){let d,v,g,m,b;return{c(){d=n("p"),v=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);v=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var D=a(g);m=i(D,"Module"),D.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,v),e(d,g),e(g,m),e(d,b)},d(l){l&&o(d)}}}function km(q){let d,v,g,m,b;return m=new R({props:{code:`import torch
from transformers import AutoTokenizer, QDQBertForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
model = QDQBertForSequenceClassification.from_pretrained("bert-base-uncased")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits

predicted_class_id = logits.argmax().item()

# To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`
num_labels = len(model.config.id2label)
model = QDQBertForSequenceClassification.from_pretrained("bert-base-uncased", num_labels=num_labels)

labels = torch.tensor([1])
loss = model(**inputs, labels=labels).loss`,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"),v=r("Example of single-label classification:"),g=p(),k(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);v=i(u,"Example of single-label classification:"),u.forEach(o),g=h(l),Q(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,v),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(T(m.$$.fragment,l),b=!0)},o(l){y(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),$(m,l)}}}function Qm(q){let d,v,g,m,b;return m=new R({props:{code:`import torch
from transformers import AutoTokenizer, QDQBertForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
model = QDQBertForSequenceClassification.from_pretrained("bert-base-uncased", problem_type="multi_label_classification")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")

with torch.no_grad():
    logits = model(**inputs).logits

predicted_class_ids = torch.arange(0, logits.shape[-1])[torch.sigmoid(logits).squeeze(dim=0) > 0.5]

# To train a model on \`num_labels\` classes, you can pass \`num_labels=num_labels\` to \`.from_pretrained(...)\`
num_labels = len(model.config.id2label)
model = QDQBertForSequenceClassification.from_pretrained(
    "bert-base-uncased", num_labels=num_labels, problem_type="multi_label_classification"
)

labels = torch.sum(
    torch.nn.functional.one_hot(predicted_class_ids[None, :].clone(), num_classes=num_labels), dim=1
).to(torch.float)
loss = model(**inputs, labels=labels).loss`,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"),v=r("Example of multi-label classification:"),g=p(),k(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);v=i(u,"Example of multi-label classification:"),u.forEach(o),g=h(l),Q(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,v),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(T(m.$$.fragment,l),b=!0)},o(l){y(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),$(m,l)}}}function wm(q){let d,v,g,m,b;return{c(){d=n("p"),v=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);v=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var D=a(g);m=i(D,"Module"),D.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,v),e(d,g),e(g,m),e(d,b)},d(l){l&&o(d)}}}function Tm(q){let d,v,g,m,b;return m=new R({props:{code:`from transformers import AutoTokenizer, QDQBertForNextSentencePrediction
import torch

tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
model = QDQBertForNextSentencePrediction.from_pretrained("bert-base-uncased")

prompt = "In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced."
next_sentence = "The sky is blue due to the shorter wavelength of blue light."
encoding = tokenizer(prompt, next_sentence, return_tensors="pt")

outputs = model(**encoding, labels=torch.LongTensor([1]))
logits = outputs.logits
assert logits[0, 0] < logits[0, 1]  # next sentence was random`,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"),v=r("Example:"),g=p(),k(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);v=i(u,"Example:"),u.forEach(o),g=h(l),Q(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,v),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(T(m.$$.fragment,l),b=!0)},o(l){y(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),$(m,l)}}}function ym(q){let d,v,g,m,b;return{c(){d=n("p"),v=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);v=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var D=a(g);m=i(D,"Module"),D.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,v),e(d,g),e(g,m),e(d,b)},d(l){l&&o(d)}}}function $m(q){let d,v,g,m,b;return m=new R({props:{code:`from transformers import AutoTokenizer, QDQBertForMultipleChoice
import torch

tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
model = QDQBertForMultipleChoice.from_pretrained("bert-base-uncased")

prompt = "In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced."
choice0 = "It is eaten with a fork and a knife."
choice1 = "It is eaten while held in the hand."
labels = torch.tensor(0).unsqueeze(0)  # choice0 is correct (according to Wikipedia ;)), batch size 1

encoding = tokenizer([prompt, prompt], [choice0, choice1], return_tensors="pt", padding=True)
outputs = model(**{k: v.unsqueeze(0) for k, v in encoding.items()}, labels=labels)  # batch size is 1

# the linear classifier still needs to be trained
loss = outputs.loss
logits = outputs.logits`,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"),v=r("Example:"),g=p(),k(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);v=i(u,"Example:"),u.forEach(o),g=h(l),Q(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,v),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(T(m.$$.fragment,l),b=!0)},o(l){y(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),$(m,l)}}}function qm(q){let d,v,g,m,b;return{c(){d=n("p"),v=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);v=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var D=a(g);m=i(D,"Module"),D.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,v),e(d,g),e(g,m),e(d,b)},d(l){l&&o(d)}}}function Dm(q){let d,v,g,m,b;return m=new R({props:{code:`from transformers import AutoTokenizer, QDQBertForTokenClassification
import torch

tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
model = QDQBertForTokenClassification.from_pretrained("bert-base-uncased")

inputs = tokenizer(
    "HuggingFace is a company based in Paris and New York", add_special_tokens=False, return_tensors="pt"
)

with torch.no_grad():
    logits = model(**inputs).logits

predicted_token_class_ids = logits.argmax(-1)

# Note that tokens are classified rather then input words which means that
# there might be more predicted token classes than words.
# Multiple token classes might account for the same word
predicted_tokens_classes = [model.config.id2label[t.item()] for t in predicted_token_class_ids[0]]

labels = predicted_token_class_ids
loss = model(**inputs, labels=labels).loss`,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"),v=r("Example:"),g=p(),k(m.$$.fragment)},l(l){d=s(l,"P",{});var u=a(d);v=i(u,"Example:"),u.forEach(o),g=h(l),Q(m.$$.fragment,l)},m(l,u){_(l,d,u),e(d,v),_(l,g,u),w(m,l,u),b=!0},p:ue,i(l){b||(T(m.$$.fragment,l),b=!0)},o(l){y(m.$$.fragment,l),b=!1},d(l){l&&o(d),l&&o(g),$(m,l)}}}function zm(q){let d,v,g,m,b;return{c(){d=n("p"),v=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);v=i(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var D=a(g);m=i(D,"Module"),D.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,v),e(d,g),e(g,m),e(d,b)},d(l){l&&o(d)}}}function Mm(q){let d,v,g,m,b;return m=new R({props:{code:`from transformers import AutoTokenizer, QDQBertForQuestionAnswering
import torch

tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased")
model = QDQBertForQuestionAnswering.from_pretrained("bert-base-uncased")

question, text = "Who was Jim Henson?", "Jim Henson was a nice puppet"

inputs = tokenizer(question, text, return_tensors="pt")
with torch.no_grad():
    outputs = model(**inputs)

answer_start_index = outputs.start_logits.argmax()
answer_end_index = outputs.end_logits.argmax()

predict_answer_tokens = inputs.input_ids[0, answer_start_index : answer_end_index + 1]

# target is "nice puppet"
target_start_index = torch.tensor([14])
target_end_index = torch.tensor([15])

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

# The default tensor quantizer is set to use Max calibration method
input_desc = QuantDescriptor(num_bits=8, calib_method="max")
# The default tensor quantizer is set to be per-channel quantization for weights
weight_desc = QuantDescriptor(num_bits=8, axis=((0,)))
quant_nn.QuantLinear.set_default_quant_desc_input(input_desc)
quant_nn.QuantLinear.set_default_quant_desc_weight(weight_desc)`,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)`}}),Ot=new O({}),St=new R({props:{code:`# Find the TensorQuantizer and enable calibration
for name, module in model.named_modules():
    if name.endswith("_input_quantizer"):
        module.enable_calib()
        module.disable_quant()  # Use full precision data to calibrate

# Feeding data samples
model(x)
# ...

# Finalize calibration
for name, module in model.named_modules():
    if name.endswith("_input_quantizer"):
        module.load_calib_amax()
        module.enable_quant()

# If running on GPU, it needs to call .cuda() again because new tensors will be created by calibration process
model.cuda()

# Keep running the quantized model
# ...`,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>`}}),It=new O({}),Rt=new R({props:{code:`from pytorch_quantization.nn import TensorQuantizer

TensorQuantizer.use_fb_fake_quant = True

# Load the calibrated model
...
# ONNX export
torch.onnx.export(...)`,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(...)`}}),Ut=new O({}),Vt=new O({}),Xt=new B({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.29.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.29.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.29.0/src/transformers/models/qdqbert/configuration_qdqbert.py#L29"}}),Je=new he({props:{anchor:"transformers.QDQBertConfig.example",$$slots:{default:[hm]},$$scope:{ctx:q}}}),Kt=new O({}),Gt=new B({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.29.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.29.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.29.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L834"}}),no=new B({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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.29.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.29.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L874",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions"
>transformers.modeling_outputs.BaseModelOutputWithPoolingAndCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ge=new Mt({props:{$$slots:{default:[um]},$$scope:{ctx:q}}}),Ye=new he({props:{anchor:"transformers.QDQBertModel.forward.example",$$slots:{default:[mm]},$$scope:{ctx:q}}}),so=new O({}),ao=new B({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.29.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.29.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.29.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1014"}}),po=new B({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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.29.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.29.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1036",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_outputs.CausalLMOutputWithCrossAttentions"
>transformers.modeling_outputs.CausalLMOutputWithCrossAttentions</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),et=new Mt({props:{$$slots:{default:[fm]},$$scope:{ctx:q}}}),tt=new he({props:{anchor:"transformers.QDQBertLMHeadModel.forward.example",$$slots:{default:[gm]},$$scope:{ctx:q}}}),ho=new O({}),uo=new B({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.29.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.29.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.29.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1167"}}),bo=new B({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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.29.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.29.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1192",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),nt=new Mt({props:{$$slots:{default:[_m]},$$scope:{ctx:q}}}),st=new he({props:{anchor:"transformers.QDQBertForMaskedLM.forward.example",$$slots:{default:[bm]},$$scope:{ctx:q}}}),vo=new O({}),ko=new B({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.29.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.29.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.29.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1382"}}),yo=new B({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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.29.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.29.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1394",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),rt=new Mt({props:{$$slots:{default:[vm]},$$scope:{ctx:q}}}),it=new he({props:{anchor:"transformers.QDQBertForSequenceClassification.forward.example",$$slots:{default:[km]},$$scope:{ctx:q}}}),lt=new he({props:{anchor:"transformers.QDQBertForSequenceClassification.forward.example-2",$$slots:{default:[Qm]},$$scope:{ctx:q}}}),$o=new O({}),qo=new B({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.29.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.29.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.29.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1278"}}),xo=new B({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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.29.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.29.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1288",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_outputs.NextSentencePredictorOutput"
>transformers.modeling_outputs.NextSentencePredictorOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ct=new Mt({props:{$$slots:{default:[wm]},$$scope:{ctx:q}}}),pt=new he({props:{anchor:"transformers.QDQBertForNextSentencePrediction.forward.example",$$slots:{default:[Tm]},$$scope:{ctx:q}}}),Fo=new O({}),Eo=new B({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.29.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.29.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.29.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1479"}}),Ao=new B({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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.29.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.29.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1490",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_outputs.MultipleChoiceModelOutput"
>transformers.modeling_outputs.MultipleChoiceModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ut=new Mt({props:{$$slots:{default:[ym]},$$scope:{ctx:q}}}),mt=new he({props:{anchor:"transformers.QDQBertForMultipleChoice.forward.example",$$slots:{default:[$m]},$$scope:{ctx:q}}}),Lo=new O({}),No=new B({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.29.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.29.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.29.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1570"}}),Wo=new B({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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.29.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.29.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1584",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),gt=new Mt({props:{$$slots:{default:[qm]},$$scope:{ctx:q}}}),_t=new he({props:{anchor:"transformers.QDQBertForTokenClassification.forward.example",$$slots:{default:[Dm]},$$scope:{ctx:q}}}),Ho=new O({}),Ro=new B({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.29.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.29.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.29.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1650"}}),Jo=new B({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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.29.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.29.0/src/transformers/models/qdqbert/modeling_qdqbert.py#L1663",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),vt=new Mt({props:{$$slots:{default:[zm]},$$scope:{ctx:q}}}),kt=new he({props:{anchor:"transformers.QDQBertForQuestionAnswering.forward.example",$$slots:{default:[Mm]},$$scope:{ctx:q}}}),{c(){d=n("meta"),v=p(),g=n("h1"),m=n("a"),b=n("span"),k(l.$$.fragment),u=p(),D=n("span"),Sr=r("QDQBERT"),va=p(),me=n("h2"),Ne=n("a"),Wn=n("span"),k(Bt.$$.fragment),Ir=p(),Hn=n("span"),Wr=r("Overview"),ka=p(),Oe=n("p"),Hr=r("The QDQBERT model can be referenced in "),xt=n("a"),Rr=r(`Integer Quantization for Deep Learning Inference: Principles and Empirical
Evaluation`),Ur=r(` by Hao Wu, Patrick Judd, Xiaojie Zhang, Mikhail Isaev and Paulius
Micikevicius.`),Qa=p(),Zo=n("p"),Vr=r("The abstract from the paper is the following:"),wa=p(),en=n("p"),Rn=n("em"),Xr=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.`),Ta=p(),tn=n("p"),Jr=r("Tips:"),ya=p(),U=n("ul"),Un=n("li"),Vn=n("p"),Kr=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.`),Gr=p(),Xn=n("li"),Se=n("p"),Yr=r("QDQBERT requires the dependency of "),Ft=n("a"),Zr=r("Pytorch Quantization Toolkit"),ei=r(". To install "),Jn=n("code"),ti=r("pip install pytorch-quantization --extra-index-url https://pypi.ngc.nvidia.com"),oi=p(),Kn=n("li"),Et=n("p"),ni=r("QDQBERT model can be loaded from any checkpoint of HuggingFace BERT model (for example "),Gn=n("em"),si=r("bert-base-uncased"),ai=r(`), and
perform Quantization Aware Training/Post Training Quantization.`),ri=p(),Yn=n("li"),jt=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("."),$a=p(),Ie=n("p"),ci=r("This model was contributed by "),Pt=n("a"),pi=r("shangz"),hi=r("."),qa=p(),fe=n("h3"),We=n("a"),Zn=n("span"),k(Ct.$$.fragment),ui=p(),es=n("span"),mi=r("Set default quantizers"),Da=p(),x=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 "),At=n("a"),bi=r("Pytorch Quantization Toolkit"),vi=r(". "),os=n("code"),ki=r("TensorQuantizer"),Qi=r(` is the module
for quantizing tensors, with `),ns=n("code"),wi=r("QuantDescriptor"),Ti=r(" defining how the tensor should be quantized. Refer to "),Lt=n("a"),yi=r(`Pytorch
Quantization Toolkit userguide`),$i=r(" for more details."),za=p(),He=n("p"),qi=r("Before creating QDQBERT model, one has to set the default "),ss=n("code"),Di=r("QuantDescriptor"),zi=r(" defining default tensor quantizers."),Ma=p(),nn=n("p"),Mi=r("Example:"),Ba=p(),k(Nt.$$.fragment),xa=p(),ge=n("h3"),Re=n("a"),as=n("span"),k(Ot.$$.fragment),Bi=p(),rs=n("span"),xi=r("Calibration"),Fa=p(),sn=n("p"),Fi=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:`),Ea=p(),k(St.$$.fragment),ja=p(),_e=n("h3"),Ue=n("a"),is=n("span"),k(It.$$.fragment),Ei=p(),ls=n("span"),ji=r("Export to ONNX"),Pa=p(),ne=n("p"),Pi=r("The goal of exporting to ONNX is to deploy inference by "),Wt=n("a"),Ci=r("TensorRT"),Ai=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 `),Ht=n("a"),Li=r("torch.onnx"),Ni=r(". Example:"),Ca=p(),k(Rt.$$.fragment),Aa=p(),be=n("h2"),Ve=n("a"),ds=n("span"),k(Ut.$$.fragment),Oi=p(),cs=n("span"),Si=r("Documentation resources"),La=p(),F=n("ul"),ps=n("li"),an=n("a"),Ii=r("Text classification task guide"),Wi=p(),hs=n("li"),rn=n("a"),Hi=r("Token classification task guide"),Ri=p(),us=n("li"),ln=n("a"),Ui=r("Question answering task guide"),Vi=p(),ms=n("li"),dn=n("a"),Xi=r("Causal language modeling task guide"),Ji=p(),fs=n("li"),cn=n("a"),Ki=r("Masked language modeling task guide"),Gi=p(),gs=n("li"),pn=n("a"),Yi=r("Multiple choice task guide"),Na=p(),ve=n("h2"),Xe=n("a"),_s=n("span"),k(Vt.$$.fragment),Zi=p(),bs=n("span"),el=r("QDQBertConfig"),Oa=p(),H=n("div"),k(Xt.$$.fragment),tl=p(),ke=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
`),Jt=n("a"),al=r("bert-base-uncased"),rl=r(" architecture."),il=p(),Qe=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(),k(Je.$$.fragment),Sa=p(),we=n("h2"),Ke=n("a"),vs=n("span"),k(Kt.$$.fragment),ml=p(),ks=n("span"),fl=r("QDQBertModel"),Ia=p(),z=n("div"),k(Gt.$$.fragment),gl=p(),Qs=n("p"),_l=r("The bare QDQBERT Model transformer outputting raw hidden-states without any specific head on top."),bl=p(),Yt=n("p"),vl=r("This model inherits from "),fn=n("a"),kl=r("PreTrainedModel"),Ql=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(),Zt=n("p"),Tl=r("This model is also a PyTorch "),eo=n("a"),yl=r("torch.nn.Module"),$l=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ql=p(),to=n("p"),Dl=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"),zl=r(`Attention is
all you need`),Ml=r(` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),Bl=p(),M=n("p"),xl=r("To behave as an decoder the model needs to be initialized with the "),ws=n("code"),Fl=r("is_decoder"),El=r(` argument of the configuration set
to `),Ts=n("code"),jl=r("True"),Pl=r(". To be used in a Seq2Seq model, the model needs to initialized with both "),ys=n("code"),Cl=r("is_decoder"),Al=r(` argument and
`),$s=n("code"),Ll=r("add_cross_attention"),Nl=r(" set to "),qs=n("code"),Ol=r("True"),Sl=r("; an "),Ds=n("code"),Il=r("encoder_hidden_states"),Wl=r(" is then expected as an input to the forward pass."),Hl=p(),V=n("div"),k(no.$$.fragment),Rl=p(),Te=n("p"),Ul=r("The "),gn=n("a"),Vl=r("QDQBertModel"),Xl=r(" forward method, overrides the "),zs=n("code"),Jl=r("__call__"),Kl=r(" special method."),Gl=p(),k(Ge.$$.fragment),Yl=p(),k(Ye.$$.fragment),Wa=p(),ye=n("h2"),Ze=n("a"),Ms=n("span"),k(so.$$.fragment),Zl=p(),Bs=n("span"),ed=r("QDQBertLMHeadModel"),Ha=p(),E=n("div"),k(ao.$$.fragment),td=p(),ro=n("p"),od=r("QDQBERT Model with a "),xs=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(),X=n("div"),k(po.$$.fragment),md=p(),$e=n("p"),fd=r("The "),bn=n("a"),gd=r("QDQBertLMHeadModel"),_d=r(" forward method, overrides the "),Fs=n("code"),bd=r("__call__"),vd=r(" special method."),kd=p(),k(et.$$.fragment),Qd=p(),k(tt.$$.fragment),Ra=p(),qe=n("h2"),ot=n("a"),Es=n("span"),k(ho.$$.fragment),wd=p(),js=n("span"),Td=r("QDQBertForMaskedLM"),Ua=p(),j=n("div"),k(uo.$$.fragment),yd=p(),mo=n("p"),$d=r("QDQBERT Model with a "),Ps=n("code"),qd=r("language modeling"),Dd=r(" head on top."),zd=p(),fo=n("p"),Md=r("This model inherits from "),vn=n("a"),Bd=r("PreTrainedModel"),xd=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.)`),Fd=p(),go=n("p"),Ed=r("This model is also a PyTorch "),_o=n("a"),jd=r("torch.nn.Module"),Pd=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Cd=p(),J=n("div"),k(bo.$$.fragment),Ad=p(),De=n("p"),Ld=r("The "),kn=n("a"),Nd=r("QDQBertForMaskedLM"),Od=r(" forward method, overrides the "),Cs=n("code"),Sd=r("__call__"),Id=r(" special method."),Wd=p(),k(nt.$$.fragment),Hd=p(),k(st.$$.fragment),Va=p(),ze=n("h2"),at=n("a"),As=n("span"),k(vo.$$.fragment),Rd=p(),Ls=n("span"),Ud=r("QDQBertForSequenceClassification"),Xa=p(),P=n("div"),k(ko.$$.fragment),Vd=p(),Ns=n("p"),Xd=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.`),Jd=p(),Qo=n("p"),Kd=r("This model inherits from "),Qn=n("a"),Gd=r("PreTrainedModel"),Yd=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.)`),Zd=p(),wo=n("p"),ec=r("This model is also a PyTorch "),To=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(),S=n("div"),k(yo.$$.fragment),sc=p(),Me=n("p"),ac=r("The "),wn=n("a"),rc=r("QDQBertForSequenceClassification"),ic=r(" forward method, overrides the "),Os=n("code"),lc=r("__call__"),dc=r(" special method."),cc=p(),k(rt.$$.fragment),pc=p(),k(it.$$.fragment),hc=p(),k(lt.$$.fragment),Ja=p(),Be=n("h2"),dt=n("a"),Ss=n("span"),k($o.$$.fragment),uc=p(),Is=n("span"),mc=r("QDQBertForNextSentencePrediction"),Ka=p(),C=n("div"),k(qo.$$.fragment),fc=p(),Do=n("p"),gc=r("Bert Model with a "),Ws=n("code"),_c=r("next sentence prediction (classification)"),bc=r(" head on top."),vc=p(),zo=n("p"),kc=r("This model inherits from "),Tn=n("a"),Qc=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.)`),Tc=p(),Mo=n("p"),yc=r("This model is also a PyTorch "),Bo=n("a"),$c=r("torch.nn.Module"),qc=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Dc=p(),K=n("div"),k(xo.$$.fragment),zc=p(),xe=n("p"),Mc=r("The "),yn=n("a"),Bc=r("QDQBertForNextSentencePrediction"),xc=r(" forward method, overrides the "),Hs=n("code"),Fc=r("__call__"),Ec=r(" special method."),jc=p(),k(ct.$$.fragment),Pc=p(),k(pt.$$.fragment),Ga=p(),Fe=n("h2"),ht=n("a"),Rs=n("span"),k(Fo.$$.fragment),Cc=p(),Us=n("span"),Ac=r("QDQBertForMultipleChoice"),Ya=p(),A=n("div"),k(Eo.$$.fragment),Lc=p(),Vs=n("p"),Nc=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.`),Oc=p(),jo=n("p"),Sc=r("This model inherits from "),$n=n("a"),Ic=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.)`),Hc=p(),Po=n("p"),Rc=r("This model is also a PyTorch "),Co=n("a"),Uc=r("torch.nn.Module"),Vc=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Xc=p(),G=n("div"),k(Ao.$$.fragment),Jc=p(),Ee=n("p"),Kc=r("The "),qn=n("a"),Gc=r("QDQBertForMultipleChoice"),Yc=r(" forward method, overrides the "),Xs=n("code"),Zc=r("__call__"),ep=r(" special method."),tp=p(),k(ut.$$.fragment),op=p(),k(mt.$$.fragment),Za=p(),je=n("h2"),ft=n("a"),Js=n("span"),k(Lo.$$.fragment),np=p(),Ks=n("span"),sp=r("QDQBertForTokenClassification"),er=p(),L=n("div"),k(No.$$.fragment),ap=p(),Gs=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(),Oo=n("p"),lp=r("This model inherits from "),Dn=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(),So=n("p"),hp=r("This model is also a PyTorch "),Io=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(),Y=n("div"),k(Wo.$$.fragment),gp=p(),Pe=n("p"),_p=r("The "),zn=n("a"),bp=r("QDQBertForTokenClassification"),vp=r(" forward method, overrides the "),Ys=n("code"),kp=r("__call__"),Qp=r(" special method."),wp=p(),k(gt.$$.fragment),Tp=p(),k(_t.$$.fragment),tr=p(),Ce=n("h2"),bt=n("a"),Zs=n("span"),k(Ho.$$.fragment),yp=p(),ea=n("span"),$p=r("QDQBertForQuestionAnswering"),or=p(),N=n("div"),k(Ro.$$.fragment),qp=p(),Ae=n("p"),Dp=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"),zp=r("span start logits"),Mp=r(" and "),oa=n("code"),Bp=r("span end logits"),xp=r(")."),Fp=p(),Uo=n("p"),Ep=r("This model inherits from "),Mn=n("a"),jp=r("PreTrainedModel"),Pp=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.)`),Cp=p(),Vo=n("p"),Ap=r("This model is also a PyTorch "),Xo=n("a"),Lp=r("torch.nn.Module"),Np=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Op=p(),Z=n("div"),k(Jo.$$.fragment),Sp=p(),Le=n("p"),Ip=r("The "),Bn=n("a"),Wp=r("QDQBertForQuestionAnswering"),Hp=r(" forward method, overrides the "),na=n("code"),Rp=r("__call__"),Up=r(" special method."),Vp=p(),k(vt.$$.fragment),Xp=p(),k(kt.$$.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),v=h(t),g=s(t,"H1",{class:!0});var Ko=a(g);m=s(Ko,"A",{id:!0,class:!0,href:!0});var sa=a(m);b=s(sa,"SPAN",{});var aa=a(b);Q(l.$$.fragment,aa),aa.forEach(o),sa.forEach(o),u=h(Ko),D=s(Ko,"SPAN",{});var ra=a(D);Sr=i(ra,"QDQBERT"),ra.forEach(o),Ko.forEach(o),va=h(t),me=s(t,"H2",{class:!0});var Go=a(me);Ne=s(Go,"A",{id:!0,class:!0,href:!0});var ia=a(Ne);Wn=s(ia,"SPAN",{});var la=a(Wn);Q(Bt.$$.fragment,la),la.forEach(o),ia.forEach(o),Ir=h(Go),Hn=s(Go,"SPAN",{});var da=a(Hn);Wr=i(da,"Overview"),da.forEach(o),Go.forEach(o),ka=h(t),Oe=s(t,"P",{});var Yo=a(Oe);Hr=i(Yo,"The QDQBERT model can be referenced in "),xt=s(Yo,"A",{href:!0,rel:!0});var ca=a(xt);Rr=i(ca,`Integer Quantization for Deep Learning Inference: Principles and Empirical
Evaluation`),ca.forEach(o),Ur=i(Yo,` by Hao Wu, Patrick Judd, Xiaojie Zhang, Mikhail Isaev and Paulius
Micikevicius.`),Yo.forEach(o),Qa=h(t),Zo=s(t,"P",{});var pa=a(Zo);Vr=i(pa,"The abstract from the paper is the following:"),pa.forEach(o),wa=h(t),en=s(t,"P",{});var ha=a(en);Rn=s(ha,"EM",{});var ua=a(Rn);Xr=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),Ta=h(t),tn=s(t,"P",{});var ma=a(tn);Jr=i(ma,"Tips:"),ma.forEach(o),ya=h(t),U=s(t,"UL",{});var oe=a(U);Un=s(oe,"LI",{});var fa=a(Un);Vn=s(fa,"P",{});var ga=a(Vn);Kr=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),Gr=h(oe),Xn=s(oe,"LI",{});var _a=a(Xn);Se=s(_a,"P",{});var ba=a(Se);Yr=i(ba,"QDQBERT requires the dependency of "),Ft=s(ba,"A",{href:!0,rel:!0});var Jp=a(Ft);Zr=i(Jp,"Pytorch Quantization Toolkit"),Jp.forEach(o),ei=i(ba,". To install "),Jn=s(ba,"CODE",{});var Kp=a(Jn);ti=i(Kp,"pip install pytorch-quantization --extra-index-url https://pypi.ngc.nvidia.com"),Kp.forEach(o),ba.forEach(o),_a.forEach(o),oi=h(oe),Kn=s(oe,"LI",{});var Gp=a(Kn);Et=s(Gp,"P",{});var sr=a(Et);ni=i(sr,"QDQBERT model can be loaded from any checkpoint of HuggingFace BERT model (for example "),Gn=s(sr,"EM",{});var Yp=a(Gn);si=i(Yp,"bert-base-uncased"),Yp.forEach(o),ai=i(sr,`), and
perform Quantization Aware Training/Post Training Quantization.`),sr.forEach(o),Gp.forEach(o),ri=h(oe),Yn=s(oe,"LI",{});var Zp=a(Yn);jt=s(Zp,"P",{});var ar=a(jt);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),Zp.forEach(o),oe.forEach(o),$a=h(t),Ie=s(t,"P",{});var rr=a(Ie);ci=i(rr,"This model was contributed by "),Pt=s(rr,"A",{href:!0,rel:!0});var th=a(Pt);pi=i(th,"shangz"),th.forEach(o),hi=i(rr,"."),rr.forEach(o),qa=h(t),fe=s(t,"H3",{class:!0});var ir=a(fe);We=s(ir,"A",{id:!0,class:!0,href:!0});var oh=a(We);Zn=s(oh,"SPAN",{});var nh=a(Zn);Q(Ct.$$.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),Da=h(t),x=s(t,"P",{});var ee=a(x);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 "),At=s(ee,"A",{href:!0,rel:!0});var rh=a(At);bi=i(rh,"Pytorch Quantization Toolkit"),rh.forEach(o),vi=i(ee,". "),os=s(ee,"CODE",{});var ih=a(os);ki=i(ih,"TensorQuantizer"),ih.forEach(o),Qi=i(ee,` is the module
for quantizing tensors, with `),ns=s(ee,"CODE",{});var lh=a(ns);wi=i(lh,"QuantDescriptor"),lh.forEach(o),Ti=i(ee," defining how the tensor should be quantized. Refer to "),Lt=s(ee,"A",{href:!0,rel:!0});var dh=a(Lt);yi=i(dh,`Pytorch
Quantization Toolkit userguide`),dh.forEach(o),$i=i(ee," for more details."),ee.forEach(o),za=h(t),He=s(t,"P",{});var lr=a(He);qi=i(lr,"Before creating QDQBERT model, one has to set the default "),ss=s(lr,"CODE",{});var ch=a(ss);Di=i(ch,"QuantDescriptor"),ch.forEach(o),zi=i(lr," defining default tensor quantizers."),lr.forEach(o),Ma=h(t),nn=s(t,"P",{});var ph=a(nn);Mi=i(ph,"Example:"),ph.forEach(o),Ba=h(t),Q(Nt.$$.fragment,t),xa=h(t),ge=s(t,"H3",{class:!0});var dr=a(ge);Re=s(dr,"A",{id:!0,class:!0,href:!0});var hh=a(Re);as=s(hh,"SPAN",{});var uh=a(as);Q(Ot.$$.fragment,uh),uh.forEach(o),hh.forEach(o),Bi=h(dr),rs=s(dr,"SPAN",{});var mh=a(rs);xi=i(mh,"Calibration"),mh.forEach(o),dr.forEach(o),Fa=h(t),sn=s(t,"P",{});var fh=a(sn);Fi=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),Ea=h(t),Q(St.$$.fragment,t),ja=h(t),_e=s(t,"H3",{class:!0});var cr=a(_e);Ue=s(cr,"A",{id:!0,class:!0,href:!0});var gh=a(Ue);is=s(gh,"SPAN",{});var _h=a(is);Q(It.$$.fragment,_h),_h.forEach(o),gh.forEach(o),Ei=h(cr),ls=s(cr,"SPAN",{});var bh=a(ls);ji=i(bh,"Export to ONNX"),bh.forEach(o),cr.forEach(o),Pa=h(t),ne=s(t,"P",{});var xn=a(ne);Pi=i(xn,"The goal of exporting to ONNX is to deploy inference by "),Wt=s(xn,"A",{href:!0,rel:!0});var vh=a(Wt);Ci=i(vh,"TensorRT"),vh.forEach(o),Ai=i(xn,`. 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 `),Ht=s(xn,"A",{href:!0,rel:!0});var kh=a(Ht);Li=i(kh,"torch.onnx"),kh.forEach(o),Ni=i(xn,". Example:"),xn.forEach(o),Ca=h(t),Q(Rt.$$.fragment,t),Aa=h(t),be=s(t,"H2",{class:!0});var pr=a(be);Ve=s(pr,"A",{id:!0,class:!0,href:!0});var Qh=a(Ve);ds=s(Qh,"SPAN",{});var wh=a(ds);Q(Ut.$$.fragment,wh),wh.forEach(o),Qh.forEach(o),Oi=h(pr),cs=s(pr,"SPAN",{});var Th=a(cs);Si=i(Th,"Documentation resources"),Th.forEach(o),pr.forEach(o),La=h(t),F=s(t,"UL",{});var te=a(F);ps=s(te,"LI",{});var yh=a(ps);an=s(yh,"A",{href:!0});var $h=a(an);Ii=i($h,"Text classification task guide"),$h.forEach(o),yh.forEach(o),Wi=h(te),hs=s(te,"LI",{});var qh=a(hs);rn=s(qh,"A",{href:!0});var Dh=a(rn);Hi=i(Dh,"Token classification task guide"),Dh.forEach(o),qh.forEach(o),Ri=h(te),us=s(te,"LI",{});var zh=a(us);ln=s(zh,"A",{href:!0});var Mh=a(ln);Ui=i(Mh,"Question answering task guide"),Mh.forEach(o),zh.forEach(o),Vi=h(te),ms=s(te,"LI",{});var Bh=a(ms);dn=s(Bh,"A",{href:!0});var xh=a(dn);Xi=i(xh,"Causal language modeling task guide"),xh.forEach(o),Bh.forEach(o),Ji=h(te),fs=s(te,"LI",{});var Fh=a(fs);cn=s(Fh,"A",{href:!0});var Eh=a(cn);Ki=i(Eh,"Masked language modeling task guide"),Eh.forEach(o),Fh.forEach(o),Gi=h(te),gs=s(te,"LI",{});var jh=a(gs);pn=s(jh,"A",{href:!0});var Ph=a(pn);Yi=i(Ph,"Multiple choice task guide"),Ph.forEach(o),jh.forEach(o),te.forEach(o),Na=h(t),ve=s(t,"H2",{class:!0});var hr=a(ve);Xe=s(hr,"A",{id:!0,class:!0,href:!0});var Ch=a(Xe);_s=s(Ch,"SPAN",{});var Ah=a(_s);Q(Vt.$$.fragment,Ah),Ah.forEach(o),Ch.forEach(o),Zi=h(hr),bs=s(hr,"SPAN",{});var Lh=a(bs);el=i(Lh,"QDQBertConfig"),Lh.forEach(o),hr.forEach(o),Oa=h(t),H=s(t,"DIV",{class:!0});var Qt=a(H);Q(Xt.$$.fragment,Qt),tl=h(Qt),ke=s(Qt,"P",{});var Fn=a(ke);ol=i(Fn,"This is the configuration class to store the configuration of a "),hn=s(Fn,"A",{href:!0});var Nh=a(hn);nl=i(Nh,"QDQBertModel"),Nh.forEach(o),sl=i(Fn,`. 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
`),Jt=s(Fn,"A",{href:!0,rel:!0});var Oh=a(Jt);al=i(Oh,"bert-base-uncased"),Oh.forEach(o),rl=i(Fn," architecture."),Fn.forEach(o),il=h(Qt),Qe=s(Qt,"P",{});var En=a(Qe);ll=i(En,"Configuration objects inherit from "),un=s(En,"A",{href:!0});var Sh=a(un);dl=i(Sh,"PretrainedConfig"),Sh.forEach(o),cl=i(En,` and can be used to control the model outputs. Read the
documentation from `),mn=s(En,"A",{href:!0});var Ih=a(mn);pl=i(Ih,"PretrainedConfig"),Ih.forEach(o),hl=i(En," for more information."),En.forEach(o),ul=h(Qt),Q(Je.$$.fragment,Qt),Qt.forEach(o),Sa=h(t),we=s(t,"H2",{class:!0});var ur=a(we);Ke=s(ur,"A",{id:!0,class:!0,href:!0});var Wh=a(Ke);vs=s(Wh,"SPAN",{});var Hh=a(vs);Q(Kt.$$.fragment,Hh),Hh.forEach(o),Wh.forEach(o),ml=h(ur),ks=s(ur,"SPAN",{});var Rh=a(ks);fl=i(Rh,"QDQBertModel"),Rh.forEach(o),ur.forEach(o),Ia=h(t),z=s(t,"DIV",{class:!0});var I=a(z);Q(Gt.$$.fragment,I),gl=h(I),Qs=s(I,"P",{});var Uh=a(Qs);_l=i(Uh,"The bare QDQBERT Model transformer outputting raw hidden-states without any specific head on top."),Uh.forEach(o),bl=h(I),Yt=s(I,"P",{});var mr=a(Yt);vl=i(mr,"This model inherits from "),fn=s(mr,"A",{href:!0});var Vh=a(fn);kl=i(Vh,"PreTrainedModel"),Vh.forEach(o),Ql=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(I),Zt=s(I,"P",{});var fr=a(Zt);Tl=i(fr,"This model is also a PyTorch "),eo=s(fr,"A",{href:!0,rel:!0});var Xh=a(eo);yl=i(Xh,"torch.nn.Module"),Xh.forEach(o),$l=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),ql=h(I),to=s(I,"P",{});var gr=a(to);Dl=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 Jh=a(oo);zl=i(Jh,`Attention is
all you need`),Jh.forEach(o),Ml=i(gr,` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),gr.forEach(o),Bl=h(I),M=s(I,"P",{});var W=a(M);xl=i(W,"To behave as an decoder the model needs to be initialized with the "),ws=s(W,"CODE",{});var Kh=a(ws);Fl=i(Kh,"is_decoder"),Kh.forEach(o),El=i(W,` argument of the configuration set
to `),Ts=s(W,"CODE",{});var Gh=a(Ts);jl=i(Gh,"True"),Gh.forEach(o),Pl=i(W,". To be used in a Seq2Seq model, the model needs to initialized with both "),ys=s(W,"CODE",{});var Yh=a(ys);Cl=i(Yh,"is_decoder"),Yh.forEach(o),Al=i(W,` argument and
`),$s=s(W,"CODE",{});var Zh=a($s);Ll=i(Zh,"add_cross_attention"),Zh.forEach(o),Nl=i(W," set to "),qs=s(W,"CODE",{});var eu=a(qs);Ol=i(eu,"True"),eu.forEach(o),Sl=i(W,"; an "),Ds=s(W,"CODE",{});var tu=a(Ds);Il=i(tu,"encoder_hidden_states"),tu.forEach(o),Wl=i(W," is then expected as an input to the forward pass."),W.forEach(o),Hl=h(I),V=s(I,"DIV",{class:!0});var wt=a(V);Q(no.$$.fragment,wt),Rl=h(wt),Te=s(wt,"P",{});var jn=a(Te);Ul=i(jn,"The "),gn=s(jn,"A",{href:!0});var ou=a(gn);Vl=i(ou,"QDQBertModel"),ou.forEach(o),Xl=i(jn," forward method, overrides the "),zs=s(jn,"CODE",{});var nu=a(zs);Jl=i(nu,"__call__"),nu.forEach(o),Kl=i(jn," special method."),jn.forEach(o),Gl=h(wt),Q(Ge.$$.fragment,wt),Yl=h(wt),Q(Ye.$$.fragment,wt),wt.forEach(o),I.forEach(o),Wa=h(t),ye=s(t,"H2",{class:!0});var _r=a(ye);Ze=s(_r,"A",{id:!0,class:!0,href:!0});var su=a(Ze);Ms=s(su,"SPAN",{});var au=a(Ms);Q(so.$$.fragment,au),au.forEach(o),su.forEach(o),Zl=h(_r),Bs=s(_r,"SPAN",{});var ru=a(Bs);ed=i(ru,"QDQBertLMHeadModel"),ru.forEach(o),_r.forEach(o),Ha=h(t),E=s(t,"DIV",{class:!0});var se=a(E);Q(ao.$$.fragment,se),td=h(se),ro=s(se,"P",{});var br=a(ro);od=i(br,"QDQBERT Model with a "),xs=s(br,"CODE",{});var iu=a(xs);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 vr=a(io);rd=i(vr,"This model inherits from "),_n=s(vr,"A",{href:!0});var lu=a(_n);id=i(lu,"PreTrainedModel"),lu.forEach(o),ld=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),dd=h(se),lo=s(se,"P",{});var kr=a(lo);cd=i(kr,"This model is also a PyTorch "),co=s(kr,"A",{href:!0,rel:!0});var du=a(co);pd=i(du,"torch.nn.Module"),du.forEach(o),hd=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),ud=h(se),X=s(se,"DIV",{class:!0});var Tt=a(X);Q(po.$$.fragment,Tt),md=h(Tt),$e=s(Tt,"P",{});var Pn=a($e);fd=i(Pn,"The "),bn=s(Pn,"A",{href:!0});var cu=a(bn);gd=i(cu,"QDQBertLMHeadModel"),cu.forEach(o),_d=i(Pn," forward method, overrides the "),Fs=s(Pn,"CODE",{});var pu=a(Fs);bd=i(pu,"__call__"),pu.forEach(o),vd=i(Pn," special method."),Pn.forEach(o),kd=h(Tt),Q(et.$$.fragment,Tt),Qd=h(Tt),Q(tt.$$.fragment,Tt),Tt.forEach(o),se.forEach(o),Ra=h(t),qe=s(t,"H2",{class:!0});var Qr=a(qe);ot=s(Qr,"A",{id:!0,class:!0,href:!0});var hu=a(ot);Es=s(hu,"SPAN",{});var uu=a(Es);Q(ho.$$.fragment,uu),uu.forEach(o),hu.forEach(o),wd=h(Qr),js=s(Qr,"SPAN",{});var mu=a(js);Td=i(mu,"QDQBertForMaskedLM"),mu.forEach(o),Qr.forEach(o),Ua=h(t),j=s(t,"DIV",{class:!0});var ae=a(j);Q(uo.$$.fragment,ae),yd=h(ae),mo=s(ae,"P",{});var wr=a(mo);$d=i(wr,"QDQBERT Model with a "),Ps=s(wr,"CODE",{});var fu=a(Ps);qd=i(fu,"language modeling"),fu.forEach(o),Dd=i(wr," head on top."),wr.forEach(o),zd=h(ae),fo=s(ae,"P",{});var Tr=a(fo);Md=i(Tr,"This model inherits from "),vn=s(Tr,"A",{href:!0});var gu=a(vn);Bd=i(gu,"PreTrainedModel"),gu.forEach(o),xd=i(Tr,`. 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.)`),Tr.forEach(o),Fd=h(ae),go=s(ae,"P",{});var yr=a(go);Ed=i(yr,"This model is also a PyTorch "),_o=s(yr,"A",{href:!0,rel:!0});var _u=a(_o);jd=i(_u,"torch.nn.Module"),_u.forEach(o),Pd=i(yr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),yr.forEach(o),Cd=h(ae),J=s(ae,"DIV",{class:!0});var yt=a(J);Q(bo.$$.fragment,yt),Ad=h(yt),De=s(yt,"P",{});var Cn=a(De);Ld=i(Cn,"The "),kn=s(Cn,"A",{href:!0});var bu=a(kn);Nd=i(bu,"QDQBertForMaskedLM"),bu.forEach(o),Od=i(Cn," forward method, overrides the "),Cs=s(Cn,"CODE",{});var vu=a(Cs);Sd=i(vu,"__call__"),vu.forEach(o),Id=i(Cn," special method."),Cn.forEach(o),Wd=h(yt),Q(nt.$$.fragment,yt),Hd=h(yt),Q(st.$$.fragment,yt),yt.forEach(o),ae.forEach(o),Va=h(t),ze=s(t,"H2",{class:!0});var $r=a(ze);at=s($r,"A",{id:!0,class:!0,href:!0});var ku=a(at);As=s(ku,"SPAN",{});var Qu=a(As);Q(vo.$$.fragment,Qu),Qu.forEach(o),ku.forEach(o),Rd=h($r),Ls=s($r,"SPAN",{});var wu=a(Ls);Ud=i(wu,"QDQBertForSequenceClassification"),wu.forEach(o),$r.forEach(o),Xa=h(t),P=s(t,"DIV",{class:!0});var re=a(P);Q(ko.$$.fragment,re),Vd=h(re),Ns=s(re,"P",{});var Tu=a(Ns);Xd=i(Tu,`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.`),Tu.forEach(o),Jd=h(re),Qo=s(re,"P",{});var qr=a(Qo);Kd=i(qr,"This model inherits from "),Qn=s(qr,"A",{href:!0});var yu=a(Qn);Gd=i(yu,"PreTrainedModel"),yu.forEach(o),Yd=i(qr,`. 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.)`),qr.forEach(o),Zd=h(re),wo=s(re,"P",{});var Dr=a(wo);ec=i(Dr,"This model is also a PyTorch "),To=s(Dr,"A",{href:!0,rel:!0});var $u=a(To);tc=i($u,"torch.nn.Module"),$u.forEach(o),oc=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),nc=h(re),S=s(re,"DIV",{class:!0});var ie=a(S);Q(yo.$$.fragment,ie),sc=h(ie),Me=s(ie,"P",{});var An=a(Me);ac=i(An,"The "),wn=s(An,"A",{href:!0});var qu=a(wn);rc=i(qu,"QDQBertForSequenceClassification"),qu.forEach(o),ic=i(An," forward method, overrides the "),Os=s(An,"CODE",{});var Du=a(Os);lc=i(Du,"__call__"),Du.forEach(o),dc=i(An," special method."),An.forEach(o),cc=h(ie),Q(rt.$$.fragment,ie),pc=h(ie),Q(it.$$.fragment,ie),hc=h(ie),Q(lt.$$.fragment,ie),ie.forEach(o),re.forEach(o),Ja=h(t),Be=s(t,"H2",{class:!0});var zr=a(Be);dt=s(zr,"A",{id:!0,class:!0,href:!0});var zu=a(dt);Ss=s(zu,"SPAN",{});var Mu=a(Ss);Q($o.$$.fragment,Mu),Mu.forEach(o),zu.forEach(o),uc=h(zr),Is=s(zr,"SPAN",{});var Bu=a(Is);mc=i(Bu,"QDQBertForNextSentencePrediction"),Bu.forEach(o),zr.forEach(o),Ka=h(t),C=s(t,"DIV",{class:!0});var le=a(C);Q(qo.$$.fragment,le),fc=h(le),Do=s(le,"P",{});var Mr=a(Do);gc=i(Mr,"Bert Model with a "),Ws=s(Mr,"CODE",{});var xu=a(Ws);_c=i(xu,"next sentence prediction (classification)"),xu.forEach(o),bc=i(Mr," head on top."),Mr.forEach(o),vc=h(le),zo=s(le,"P",{});var Br=a(zo);kc=i(Br,"This model inherits from "),Tn=s(Br,"A",{href:!0});var Fu=a(Tn);Qc=i(Fu,"PreTrainedModel"),Fu.forEach(o),wc=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),Tc=h(le),Mo=s(le,"P",{});var xr=a(Mo);yc=i(xr,"This model is also a PyTorch "),Bo=s(xr,"A",{href:!0,rel:!0});var Eu=a(Bo);$c=i(Eu,"torch.nn.Module"),Eu.forEach(o),qc=i(xr,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),xr.forEach(o),Dc=h(le),K=s(le,"DIV",{class:!0});var $t=a(K);Q(xo.$$.fragment,$t),zc=h($t),xe=s($t,"P",{});var Ln=a(xe);Mc=i(Ln,"The "),yn=s(Ln,"A",{href:!0});var ju=a(yn);Bc=i(ju,"QDQBertForNextSentencePrediction"),ju.forEach(o),xc=i(Ln," forward method, overrides the "),Hs=s(Ln,"CODE",{});var Pu=a(Hs);Fc=i(Pu,"__call__"),Pu.forEach(o),Ec=i(Ln," special method."),Ln.forEach(o),jc=h($t),Q(ct.$$.fragment,$t),Pc=h($t),Q(pt.$$.fragment,$t),$t.forEach(o),le.forEach(o),Ga=h(t),Fe=s(t,"H2",{class:!0});var Fr=a(Fe);ht=s(Fr,"A",{id:!0,class:!0,href:!0});var Cu=a(ht);Rs=s(Cu,"SPAN",{});var Au=a(Rs);Q(Fo.$$.fragment,Au),Au.forEach(o),Cu.forEach(o),Cc=h(Fr),Us=s(Fr,"SPAN",{});var Lu=a(Us);Ac=i(Lu,"QDQBertForMultipleChoice"),Lu.forEach(o),Fr.forEach(o),Ya=h(t),A=s(t,"DIV",{class:!0});var de=a(A);Q(Eo.$$.fragment,de),Lc=h(de),Vs=s(de,"P",{});var Nu=a(Vs);Nc=i(Nu,`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.`),Nu.forEach(o),Oc=h(de),jo=s(de,"P",{});var Er=a(jo);Sc=i(Er,"This model inherits from "),$n=s(Er,"A",{href:!0});var Ou=a($n);Ic=i(Ou,"PreTrainedModel"),Ou.forEach(o),Wc=i(Er,`. 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.)`),Er.forEach(o),Hc=h(de),Po=s(de,"P",{});var jr=a(Po);Rc=i(jr,"This model is also a PyTorch "),Co=s(jr,"A",{href:!0,rel:!0});var Su=a(Co);Uc=i(Su,"torch.nn.Module"),Su.forEach(o),Vc=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),Xc=h(de),G=s(de,"DIV",{class:!0});var qt=a(G);Q(Ao.$$.fragment,qt),Jc=h(qt),Ee=s(qt,"P",{});var Nn=a(Ee);Kc=i(Nn,"The "),qn=s(Nn,"A",{href:!0});var Iu=a(qn);Gc=i(Iu,"QDQBertForMultipleChoice"),Iu.forEach(o),Yc=i(Nn," forward method, overrides the "),Xs=s(Nn,"CODE",{});var Wu=a(Xs);Zc=i(Wu,"__call__"),Wu.forEach(o),ep=i(Nn," special method."),Nn.forEach(o),tp=h(qt),Q(ut.$$.fragment,qt),op=h(qt),Q(mt.$$.fragment,qt),qt.forEach(o),de.forEach(o),Za=h(t),je=s(t,"H2",{class:!0});var Pr=a(je);ft=s(Pr,"A",{id:!0,class:!0,href:!0});var Hu=a(ft);Js=s(Hu,"SPAN",{});var Ru=a(Js);Q(Lo.$$.fragment,Ru),Ru.forEach(o),Hu.forEach(o),np=h(Pr),Ks=s(Pr,"SPAN",{});var Uu=a(Ks);sp=i(Uu,"QDQBertForTokenClassification"),Uu.forEach(o),Pr.forEach(o),er=h(t),L=s(t,"DIV",{class:!0});var ce=a(L);Q(No.$$.fragment,ce),ap=h(ce),Gs=s(ce,"P",{});var Vu=a(Gs);rp=i(Vu,`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.`),Vu.forEach(o),ip=h(ce),Oo=s(ce,"P",{});var Cr=a(Oo);lp=i(Cr,"This model inherits from "),Dn=s(Cr,"A",{href:!0});var Xu=a(Dn);dp=i(Xu,"PreTrainedModel"),Xu.forEach(o),cp=i(Cr,`. 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.)`),Cr.forEach(o),pp=h(ce),So=s(ce,"P",{});var Ar=a(So);hp=i(Ar,"This model is also a PyTorch "),Io=s(Ar,"A",{href:!0,rel:!0});var Ju=a(Io);up=i(Ju,"torch.nn.Module"),Ju.forEach(o),mp=i(Ar,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ar.forEach(o),fp=h(ce),Y=s(ce,"DIV",{class:!0});var Dt=a(Y);Q(Wo.$$.fragment,Dt),gp=h(Dt),Pe=s(Dt,"P",{});var On=a(Pe);_p=i(On,"The "),zn=s(On,"A",{href:!0});var Ku=a(zn);bp=i(Ku,"QDQBertForTokenClassification"),Ku.forEach(o),vp=i(On," forward method, overrides the "),Ys=s(On,"CODE",{});var Gu=a(Ys);kp=i(Gu,"__call__"),Gu.forEach(o),Qp=i(On," special method."),On.forEach(o),wp=h(Dt),Q(gt.$$.fragment,Dt),Tp=h(Dt),Q(_t.$$.fragment,Dt),Dt.forEach(o),ce.forEach(o),tr=h(t),Ce=s(t,"H2",{class:!0});var Lr=a(Ce);bt=s(Lr,"A",{id:!0,class:!0,href:!0});var Yu=a(bt);Zs=s(Yu,"SPAN",{});var Zu=a(Zs);Q(Ho.$$.fragment,Zu),Zu.forEach(o),Yu.forEach(o),yp=h(Lr),ea=s(Lr,"SPAN",{});var em=a(ea);$p=i(em,"QDQBertForQuestionAnswering"),em.forEach(o),Lr.forEach(o),or=h(t),N=s(t,"DIV",{class:!0});var pe=a(N);Q(Ro.$$.fragment,pe),qp=h(pe),Ae=s(pe,"P",{});var Sn=a(Ae);Dp=i(Sn,`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(Sn,"CODE",{});var tm=a(ta);zp=i(tm,"span start logits"),tm.forEach(o),Mp=i(Sn," and "),oa=s(Sn,"CODE",{});var om=a(oa);Bp=i(om,"span end logits"),om.forEach(o),xp=i(Sn,")."),Sn.forEach(o),Fp=h(pe),Uo=s(pe,"P",{});var Nr=a(Uo);Ep=i(Nr,"This model inherits from "),Mn=s(Nr,"A",{href:!0});var nm=a(Mn);jp=i(nm,"PreTrainedModel"),nm.forEach(o),Pp=i(Nr,`. 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.)`),Nr.forEach(o),Cp=h(pe),Vo=s(pe,"P",{});var Or=a(Vo);Ap=i(Or,"This model is also a PyTorch "),Xo=s(Or,"A",{href:!0,rel:!0});var sm=a(Xo);Lp=i(sm,"torch.nn.Module"),sm.forEach(o),Np=i(Or,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Or.forEach(o),Op=h(pe),Z=s(pe,"DIV",{class:!0});var zt=a(Z);Q(Jo.$$.fragment,zt),Sp=h(zt),Le=s(zt,"P",{});var In=a(Le);Ip=i(In,"The "),Bn=s(In,"A",{href:!0});var am=a(Bn);Wp=i(am,"QDQBertForQuestionAnswering"),am.forEach(o),Hp=i(In," forward method, overrides the "),na=s(In,"CODE",{});var rm=a(na);Rp=i(rm,"__call__"),rm.forEach(o),Up=i(In," special method."),In.forEach(o),Vp=h(zt),Q(vt.$$.fragment,zt),Xp=h(zt),Q(kt.$$.fragment,zt),zt.forEach(o),pe.forEach(o),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify(xm)),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(Ne,"id","overview"),c(Ne,"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(Ne,"href","#overview"),c(me,"class","relative group"),c(xt,"href","https://arxiv.org/abs/2004.09602"),c(xt,"rel","nofollow"),c(Ft,"href","https://github.com/NVIDIA/TensorRT/tree/master/tools/pytorch-quantization"),c(Ft,"rel","nofollow"),c(on,"href","examples/research_projects/quantization-qdqbert/"),c(Pt,"href","https://huggingface.co/shangz"),c(Pt,"rel","nofollow"),c(We,"id","set-default-quantizers"),c(We,"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(We,"href","#set-default-quantizers"),c(fe,"class","relative group"),c(At,"href","https://github.com/NVIDIA/TensorRT/tree/master/tools/pytorch-quantization"),c(At,"rel","nofollow"),c(Lt,"href","https://docs.nvidia.com/deeplearning/tensorrt/pytorch-quantization-toolkit/docs/userguide.html"),c(Lt,"rel","nofollow"),c(Re,"id","calibration"),c(Re,"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(Re,"href","#calibration"),c(ge,"class","relative group"),c(Ue,"id","export-to-onnx"),c(Ue,"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(Ue,"href","#export-to-onnx"),c(_e,"class","relative group"),c(Wt,"href","https://developer.nvidia.com/tensorrt"),c(Wt,"rel","nofollow"),c(Ht,"href","https://pytorch.org/docs/stable/onnx.html"),c(Ht,"rel","nofollow"),c(Ve,"id","documentation-resources"),c(Ve,"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(Ve,"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(Xe,"id","transformers.QDQBertConfig"),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","#transformers.QDQBertConfig"),c(ve,"class","relative group"),c(hn,"href","/docs/transformers/v4.29.0/en/model_doc/qdqbert#transformers.QDQBertModel"),c(Jt,"href","https://huggingface.co/bert-base-uncased"),c(Jt,"rel","nofollow"),c(un,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),c(mn,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),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(Ke,"id","transformers.QDQBertModel"),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.QDQBertModel"),c(we,"class","relative group"),c(fn,"href","/docs/transformers/v4.29.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.29.0/en/model_doc/qdqbert#transformers.QDQBertModel"),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(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(Ze,"id","transformers.QDQBertLMHeadModel"),c(Ze,"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(Ze,"href","#transformers.QDQBertLMHeadModel"),c(ye,"class","relative group"),c(_n,"href","/docs/transformers/v4.29.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.29.0/en/model_doc/qdqbert#transformers.QDQBertLMHeadModel"),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"),c(E,"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(qe,"class","relative group"),c(vn,"href","/docs/transformers/v4.29.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(kn,"href","/docs/transformers/v4.29.0/en/model_doc/qdqbert#transformers.QDQBertForMaskedLM"),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(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(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(ze,"class","relative group"),c(Qn,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),c(To,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(To,"rel","nofollow"),c(wn,"href","/docs/transformers/v4.29.0/en/model_doc/qdqbert#transformers.QDQBertForSequenceClassification"),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(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(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(Be,"class","relative group"),c(Tn,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),c(Bo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Bo,"rel","nofollow"),c(yn,"href","/docs/transformers/v4.29.0/en/model_doc/qdqbert#transformers.QDQBertForNextSentencePrediction"),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(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(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(Fe,"class","relative group"),c($n,"href","/docs/transformers/v4.29.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(qn,"href","/docs/transformers/v4.29.0/en/model_doc/qdqbert#transformers.QDQBertForMultipleChoice"),c(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(A,"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(je,"class","relative group"),c(Dn,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),c(Io,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Io,"rel","nofollow"),c(zn,"href","/docs/transformers/v4.29.0/en/model_doc/qdqbert#transformers.QDQBertForTokenClassification"),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(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(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(Ce,"class","relative group"),c(Mn,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),c(Xo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Xo,"rel","nofollow"),c(Bn,"href","/docs/transformers/v4.29.0/en/model_doc/qdqbert#transformers.QDQBertForQuestionAnswering"),c(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),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")},m(t,f){e(document.head,d),_(t,v,f),_(t,g,f),e(g,m),e(m,b),w(l,b,null),e(g,u),e(g,D),e(D,Sr),_(t,va,f),_(t,me,f),e(me,Ne),e(Ne,Wn),w(Bt,Wn,null),e(me,Ir),e(me,Hn),e(Hn,Wr),_(t,ka,f),_(t,Oe,f),e(Oe,Hr),e(Oe,xt),e(xt,Rr),e(Oe,Ur),_(t,Qa,f),_(t,Zo,f),e(Zo,Vr),_(t,wa,f),_(t,en,f),e(en,Rn),e(Rn,Xr),_(t,Ta,f),_(t,tn,f),e(tn,Jr),_(t,ya,f),_(t,U,f),e(U,Un),e(Un,Vn),e(Vn,Kr),e(U,Gr),e(U,Xn),e(Xn,Se),e(Se,Yr),e(Se,Ft),e(Ft,Zr),e(Se,ei),e(Se,Jn),e(Jn,ti),e(U,oi),e(U,Kn),e(Kn,Et),e(Et,ni),e(Et,Gn),e(Gn,si),e(Et,ai),e(U,ri),e(U,Yn),e(Yn,jt),e(jt,ii),e(jt,on),e(on,li),e(jt,di),_(t,$a,f),_(t,Ie,f),e(Ie,ci),e(Ie,Pt),e(Pt,pi),e(Ie,hi),_(t,qa,f),_(t,fe,f),e(fe,We),e(We,Zn),w(Ct,Zn,null),e(fe,ui),e(fe,es),e(es,mi),_(t,Da,f),_(t,x,f),e(x,fi),e(x,ts),e(ts,gi),e(x,_i),e(x,At),e(At,bi),e(x,vi),e(x,os),e(os,ki),e(x,Qi),e(x,ns),e(ns,wi),e(x,Ti),e(x,Lt),e(Lt,yi),e(x,$i),_(t,za,f),_(t,He,f),e(He,qi),e(He,ss),e(ss,Di),e(He,zi),_(t,Ma,f),_(t,nn,f),e(nn,Mi),_(t,Ba,f),w(Nt,t,f),_(t,xa,f),_(t,ge,f),e(ge,Re),e(Re,as),w(Ot,as,null),e(ge,Bi),e(ge,rs),e(rs,xi),_(t,Fa,f),_(t,sn,f),e(sn,Fi),_(t,Ea,f),w(St,t,f),_(t,ja,f),_(t,_e,f),e(_e,Ue),e(Ue,is),w(It,is,null),e(_e,Ei),e(_e,ls),e(ls,ji),_(t,Pa,f),_(t,ne,f),e(ne,Pi),e(ne,Wt),e(Wt,Ci),e(ne,Ai),e(ne,Ht),e(Ht,Li),e(ne,Ni),_(t,Ca,f),w(Rt,t,f),_(t,Aa,f),_(t,be,f),e(be,Ve),e(Ve,ds),w(Ut,ds,null),e(be,Oi),e(be,cs),e(cs,Si),_(t,La,f),_(t,F,f),e(F,ps),e(ps,an),e(an,Ii),e(F,Wi),e(F,hs),e(hs,rn),e(rn,Hi),e(F,Ri),e(F,us),e(us,ln),e(ln,Ui),e(F,Vi),e(F,ms),e(ms,dn),e(dn,Xi),e(F,Ji),e(F,fs),e(fs,cn),e(cn,Ki),e(F,Gi),e(F,gs),e(gs,pn),e(pn,Yi),_(t,Na,f),_(t,ve,f),e(ve,Xe),e(Xe,_s),w(Vt,_s,null),e(ve,Zi),e(ve,bs),e(bs,el),_(t,Oa,f),_(t,H,f),w(Xt,H,null),e(H,tl),e(H,ke),e(ke,ol),e(ke,hn),e(hn,nl),e(ke,sl),e(ke,Jt),e(Jt,al),e(ke,rl),e(H,il),e(H,Qe),e(Qe,ll),e(Qe,un),e(un,dl),e(Qe,cl),e(Qe,mn),e(mn,pl),e(Qe,hl),e(H,ul),w(Je,H,null),_(t,Sa,f),_(t,we,f),e(we,Ke),e(Ke,vs),w(Kt,vs,null),e(we,ml),e(we,ks),e(ks,fl),_(t,Ia,f),_(t,z,f),w(Gt,z,null),e(z,gl),e(z,Qs),e(Qs,_l),e(z,bl),e(z,Yt),e(Yt,vl),e(Yt,fn),e(fn,kl),e(Yt,Ql),e(z,wl),e(z,Zt),e(Zt,Tl),e(Zt,eo),e(eo,yl),e(Zt,$l),e(z,ql),e(z,to),e(to,Dl),e(to,oo),e(oo,zl),e(to,Ml),e(z,Bl),e(z,M),e(M,xl),e(M,ws),e(ws,Fl),e(M,El),e(M,Ts),e(Ts,jl),e(M,Pl),e(M,ys),e(ys,Cl),e(M,Al),e(M,$s),e($s,Ll),e(M,Nl),e(M,qs),e(qs,Ol),e(M,Sl),e(M,Ds),e(Ds,Il),e(M,Wl),e(z,Hl),e(z,V),w(no,V,null),e(V,Rl),e(V,Te),e(Te,Ul),e(Te,gn),e(gn,Vl),e(Te,Xl),e(Te,zs),e(zs,Jl),e(Te,Kl),e(V,Gl),w(Ge,V,null),e(V,Yl),w(Ye,V,null),_(t,Wa,f),_(t,ye,f),e(ye,Ze),e(Ze,Ms),w(so,Ms,null),e(ye,Zl),e(ye,Bs),e(Bs,ed),_(t,Ha,f),_(t,E,f),w(ao,E,null),e(E,td),e(E,ro),e(ro,od),e(ro,xs),e(xs,nd),e(ro,sd),e(E,ad),e(E,io),e(io,rd),e(io,_n),e(_n,id),e(io,ld),e(E,dd),e(E,lo),e(lo,cd),e(lo,co),e(co,pd),e(lo,hd),e(E,ud),e(E,X),w(po,X,null),e(X,md),e(X,$e),e($e,fd),e($e,bn),e(bn,gd),e($e,_d),e($e,Fs),e(Fs,bd),e($e,vd),e(X,kd),w(et,X,null),e(X,Qd),w(tt,X,null),_(t,Ra,f),_(t,qe,f),e(qe,ot),e(ot,Es),w(ho,Es,null),e(qe,wd),e(qe,js),e(js,Td),_(t,Ua,f),_(t,j,f),w(uo,j,null),e(j,yd),e(j,mo),e(mo,$d),e(mo,Ps),e(Ps,qd),e(mo,Dd),e(j,zd),e(j,fo),e(fo,Md),e(fo,vn),e(vn,Bd),e(fo,xd),e(j,Fd),e(j,go),e(go,Ed),e(go,_o),e(_o,jd),e(go,Pd),e(j,Cd),e(j,J),w(bo,J,null),e(J,Ad),e(J,De),e(De,Ld),e(De,kn),e(kn,Nd),e(De,Od),e(De,Cs),e(Cs,Sd),e(De,Id),e(J,Wd),w(nt,J,null),e(J,Hd),w(st,J,null),_(t,Va,f),_(t,ze,f),e(ze,at),e(at,As),w(vo,As,null),e(ze,Rd),e(ze,Ls),e(Ls,Ud),_(t,Xa,f),_(t,P,f),w(ko,P,null),e(P,Vd),e(P,Ns),e(Ns,Xd),e(P,Jd),e(P,Qo),e(Qo,Kd),e(Qo,Qn),e(Qn,Gd),e(Qo,Yd),e(P,Zd),e(P,wo),e(wo,ec),e(wo,To),e(To,tc),e(wo,oc),e(P,nc),e(P,S),w(yo,S,null),e(S,sc),e(S,Me),e(Me,ac),e(Me,wn),e(wn,rc),e(Me,ic),e(Me,Os),e(Os,lc),e(Me,dc),e(S,cc),w(rt,S,null),e(S,pc),w(it,S,null),e(S,hc),w(lt,S,null),_(t,Ja,f),_(t,Be,f),e(Be,dt),e(dt,Ss),w($o,Ss,null),e(Be,uc),e(Be,Is),e(Is,mc),_(t,Ka,f),_(t,C,f),w(qo,C,null),e(C,fc),e(C,Do),e(Do,gc),e(Do,Ws),e(Ws,_c),e(Do,bc),e(C,vc),e(C,zo),e(zo,kc),e(zo,Tn),e(Tn,Qc),e(zo,wc),e(C,Tc),e(C,Mo),e(Mo,yc),e(Mo,Bo),e(Bo,$c),e(Mo,qc),e(C,Dc),e(C,K),w(xo,K,null),e(K,zc),e(K,xe),e(xe,Mc),e(xe,yn),e(yn,Bc),e(xe,xc),e(xe,Hs),e(Hs,Fc),e(xe,Ec),e(K,jc),w(ct,K,null),e(K,Pc),w(pt,K,null),_(t,Ga,f),_(t,Fe,f),e(Fe,ht),e(ht,Rs),w(Fo,Rs,null),e(Fe,Cc),e(Fe,Us),e(Us,Ac),_(t,Ya,f),_(t,A,f),w(Eo,A,null),e(A,Lc),e(A,Vs),e(Vs,Nc),e(A,Oc),e(A,jo),e(jo,Sc),e(jo,$n),e($n,Ic),e(jo,Wc),e(A,Hc),e(A,Po),e(Po,Rc),e(Po,Co),e(Co,Uc),e(Po,Vc),e(A,Xc),e(A,G),w(Ao,G,null),e(G,Jc),e(G,Ee),e(Ee,Kc),e(Ee,qn),e(qn,Gc),e(Ee,Yc),e(Ee,Xs),e(Xs,Zc),e(Ee,ep),e(G,tp),w(ut,G,null),e(G,op),w(mt,G,null),_(t,Za,f),_(t,je,f),e(je,ft),e(ft,Js),w(Lo,Js,null),e(je,np),e(je,Ks),e(Ks,sp),_(t,er,f),_(t,L,f),w(No,L,null),e(L,ap),e(L,Gs),e(Gs,rp),e(L,ip),e(L,Oo),e(Oo,lp),e(Oo,Dn),e(Dn,dp),e(Oo,cp),e(L,pp),e(L,So),e(So,hp),e(So,Io),e(Io,up),e(So,mp),e(L,fp),e(L,Y),w(Wo,Y,null),e(Y,gp),e(Y,Pe),e(Pe,_p),e(Pe,zn),e(zn,bp),e(Pe,vp),e(Pe,Ys),e(Ys,kp),e(Pe,Qp),e(Y,wp),w(gt,Y,null),e(Y,Tp),w(_t,Y,null),_(t,tr,f),_(t,Ce,f),e(Ce,bt),e(bt,Zs),w(Ho,Zs,null),e(Ce,yp),e(Ce,ea),e(ea,$p),_(t,or,f),_(t,N,f),w(Ro,N,null),e(N,qp),e(N,Ae),e(Ae,Dp),e(Ae,ta),e(ta,zp),e(Ae,Mp),e(Ae,oa),e(oa,Bp),e(Ae,xp),e(N,Fp),e(N,Uo),e(Uo,Ep),e(Uo,Mn),e(Mn,jp),e(Uo,Pp),e(N,Cp),e(N,Vo),e(Vo,Ap),e(Vo,Xo),e(Xo,Lp),e(Vo,Np),e(N,Op),e(N,Z),w(Jo,Z,null),e(Z,Sp),e(Z,Le),e(Le,Ip),e(Le,Bn),e(Bn,Wp),e(Le,Hp),e(Le,na),e(na,Rp),e(Le,Up),e(Z,Vp),w(vt,Z,null),e(Z,Xp),w(kt,Z,null),nr=!0},p(t,[f]){const Ko={};f&2&&(Ko.$$scope={dirty:f,ctx:t}),Je.$set(Ko);const sa={};f&2&&(sa.$$scope={dirty:f,ctx:t}),Ge.$set(sa);const aa={};f&2&&(aa.$$scope={dirty:f,ctx:t}),Ye.$set(aa);const ra={};f&2&&(ra.$$scope={dirty:f,ctx:t}),et.$set(ra);const Go={};f&2&&(Go.$$scope={dirty:f,ctx:t}),tt.$set(Go);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 Yo={};f&2&&(Yo.$$scope={dirty:f,ctx:t}),it.$set(Yo);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}),vt.$set(ga);const _a={};f&2&&(_a.$$scope={dirty:f,ctx:t}),kt.$set(_a)},i(t){nr||(T(l.$$.fragment,t),T(Bt.$$.fragment,t),T(Ct.$$.fragment,t),T(Nt.$$.fragment,t),T(Ot.$$.fragment,t),T(St.$$.fragment,t),T(It.$$.fragment,t),T(Rt.$$.fragment,t),T(Ut.$$.fragment,t),T(Vt.$$.fragment,t),T(Xt.$$.fragment,t),T(Je.$$.fragment,t),T(Kt.$$.fragment,t),T(Gt.$$.fragment,t),T(no.$$.fragment,t),T(Ge.$$.fragment,t),T(Ye.$$.fragment,t),T(so.$$.fragment,t),T(ao.$$.fragment,t),T(po.$$.fragment,t),T(et.$$.fragment,t),T(tt.$$.fragment,t),T(ho.$$.fragment,t),T(uo.$$.fragment,t),T(bo.$$.fragment,t),T(nt.$$.fragment,t),T(st.$$.fragment,t),T(vo.$$.fragment,t),T(ko.$$.fragment,t),T(yo.$$.fragment,t),T(rt.$$.fragment,t),T(it.$$.fragment,t),T(lt.$$.fragment,t),T($o.$$.fragment,t),T(qo.$$.fragment,t),T(xo.$$.fragment,t),T(ct.$$.fragment,t),T(pt.$$.fragment,t),T(Fo.$$.fragment,t),T(Eo.$$.fragment,t),T(Ao.$$.fragment,t),T(ut.$$.fragment,t),T(mt.$$.fragment,t),T(Lo.$$.fragment,t),T(No.$$.fragment,t),T(Wo.$$.fragment,t),T(gt.$$.fragment,t),T(_t.$$.fragment,t),T(Ho.$$.fragment,t),T(Ro.$$.fragment,t),T(Jo.$$.fragment,t),T(vt.$$.fragment,t),T(kt.$$.fragment,t),nr=!0)},o(t){y(l.$$.fragment,t),y(Bt.$$.fragment,t),y(Ct.$$.fragment,t),y(Nt.$$.fragment,t),y(Ot.$$.fragment,t),y(St.$$.fragment,t),y(It.$$.fragment,t),y(Rt.$$.fragment,t),y(Ut.$$.fragment,t),y(Vt.$$.fragment,t),y(Xt.$$.fragment,t),y(Je.$$.fragment,t),y(Kt.$$.fragment,t),y(Gt.$$.fragment,t),y(no.$$.fragment,t),y(Ge.$$.fragment,t),y(Ye.$$.fragment,t),y(so.$$.fragment,t),y(ao.$$.fragment,t),y(po.$$.fragment,t),y(et.$$.fragment,t),y(tt.$$.fragment,t),y(ho.$$.fragment,t),y(uo.$$.fragment,t),y(bo.$$.fragment,t),y(nt.$$.fragment,t),y(st.$$.fragment,t),y(vo.$$.fragment,t),y(ko.$$.fragment,t),y(yo.$$.fragment,t),y(rt.$$.fragment,t),y(it.$$.fragment,t),y(lt.$$.fragment,t),y($o.$$.fragment,t),y(qo.$$.fragment,t),y(xo.$$.fragment,t),y(ct.$$.fragment,t),y(pt.$$.fragment,t),y(Fo.$$.fragment,t),y(Eo.$$.fragment,t),y(Ao.$$.fragment,t),y(ut.$$.fragment,t),y(mt.$$.fragment,t),y(Lo.$$.fragment,t),y(No.$$.fragment,t),y(Wo.$$.fragment,t),y(gt.$$.fragment,t),y(_t.$$.fragment,t),y(Ho.$$.fragment,t),y(Ro.$$.fragment,t),y(Jo.$$.fragment,t),y(vt.$$.fragment,t),y(kt.$$.fragment,t),nr=!1},d(t){o(d),t&&o(v),t&&o(g),$(l),t&&o(va),t&&o(me),$(Bt),t&&o(ka),t&&o(Oe),t&&o(Qa),t&&o(Zo),t&&o(wa),t&&o(en),t&&o(Ta),t&&o(tn),t&&o(ya),t&&o(U),t&&o($a),t&&o(Ie),t&&o(qa),t&&o(fe),$(Ct),t&&o(Da),t&&o(x),t&&o(za),t&&o(He),t&&o(Ma),t&&o(nn),t&&o(Ba),$(Nt,t),t&&o(xa),t&&o(ge),$(Ot),t&&o(Fa),t&&o(sn),t&&o(Ea),$(St,t),t&&o(ja),t&&o(_e),$(It),t&&o(Pa),t&&o(ne),t&&o(Ca),$(Rt,t),t&&o(Aa),t&&o(be),$(Ut),t&&o(La),t&&o(F),t&&o(Na),t&&o(ve),$(Vt),t&&o(Oa),t&&o(H),$(Xt),$(Je),t&&o(Sa),t&&o(we),$(Kt),t&&o(Ia),t&&o(z),$(Gt),$(no),$(Ge),$(Ye),t&&o(Wa),t&&o(ye),$(so),t&&o(Ha),t&&o(E),$(ao),$(po),$(et),$(tt),t&&o(Ra),t&&o(qe),$(ho),t&&o(Ua),t&&o(j),$(uo),$(bo),$(nt),$(st),t&&o(Va),t&&o(ze),$(vo),t&&o(Xa),t&&o(P),$(ko),$(yo),$(rt),$(it),$(lt),t&&o(Ja),t&&o(Be),$($o),t&&o(Ka),t&&o(C),$(qo),$(xo),$(ct),$(pt),t&&o(Ga),t&&o(Fe),$(Fo),t&&o(Ya),t&&o(A),$(Eo),$(Ao),$(ut),$(mt),t&&o(Za),t&&o(je),$(Lo),t&&o(er),t&&o(L),$(No),$(Wo),$(gt),$(_t),t&&o(tr),t&&o(Ce),$(Ho),t&&o(or),t&&o(N),$(Ro),$(Jo),$(vt),$(kt)}}}const xm={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 Fm(q){return pm(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Nm extends im{constructor(d){super();lm(this,d,Fm,Bm,dm,{})}}export{Nm as default,xm as metadata};
