import{S as Ed,i as zd,s as xd,e as o,k as d,w as b,t as i,M as jd,c as s,d as t,m as p,a,x as w,h as l,b as h,G as e,g as _,y as C,q as $,o as y,B as T,v as Fd,L as Ce}from"../../chunks/vendor-hf-doc-builder.js";import{T as rs}from"../../chunks/Tip-hf-doc-builder.js";import{D as j}from"../../chunks/Docstring-hf-doc-builder.js";import{C as J}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as R}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as we}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Ad(q){let c,v,g,m,k;return m=new J({props:{code:`from transformers import CanineConfig, CanineModel

# Initializing a CANINE google/canine-s style configuration
configuration = CanineConfig()

# Initializing a model (with random weights) from the google/canine-s style configuration
model = CanineModel(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> CanineConfig, CanineModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a CANINE google/canine-s style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = CanineConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the google/canine-s style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CanineModel(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(){c=o("p"),v=i("Example:"),g=d(),b(m.$$.fragment)},l(r){c=s(r,"P",{});var u=a(c);v=l(u,"Example:"),u.forEach(t),g=p(r),w(m.$$.fragment,r)},m(r,u){_(r,c,u),e(c,v),_(r,g,u),C(m,r,u),k=!0},p:Ce,i(r){k||($(m.$$.fragment,r),k=!0)},o(r){y(m.$$.fragment,r),k=!1},d(r){r&&t(c),r&&t(g),T(m,r)}}}function Md(q){let c,v,g,m,k;return m=new J({props:{code:`0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
| first sequence    | second sequence |`,highlighted:`0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1 1
| first sequence    | second sequence |`}}),{c(){c=o("p"),v=i("sequence pair mask has the following format:"),g=d(),b(m.$$.fragment)},l(r){c=s(r,"P",{});var u=a(c);v=l(u,"sequence pair mask has the following format:"),u.forEach(t),g=p(r),w(m.$$.fragment,r)},m(r,u){_(r,c,u),e(c,v),_(r,g,u),C(m,r,u),k=!0},p:Ce,i(r){k||($(m.$$.fragment,r),k=!0)},o(r){y(m.$$.fragment,r),k=!1},d(r){r&&t(c),r&&t(g),T(m,r)}}}function Pd(q){let c,v,g,m,k;return{c(){c=o("p"),v=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=o("code"),m=i("Module"),k=i(`
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(r){c=s(r,"P",{});var u=a(c);v=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var E=a(g);m=l(E,"Module"),E.forEach(t),k=l(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(t)},m(r,u){_(r,c,u),e(c,v),e(c,g),e(g,m),e(c,k)},d(r){r&&t(c)}}}function Nd(q){let c,v,g,m,k;return m=new J({props:{code:`from transformers import AutoTokenizer, CanineModel
import torch

tokenizer = AutoTokenizer.from_pretrained("google/canine-s")
model = CanineModel.from_pretrained("google/canine-s")

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, CanineModel
<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;google/canine-s&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CanineModel.from_pretrained(<span class="hljs-string">&quot;google/canine-s&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(){c=o("p"),v=i("Example:"),g=d(),b(m.$$.fragment)},l(r){c=s(r,"P",{});var u=a(c);v=l(u,"Example:"),u.forEach(t),g=p(r),w(m.$$.fragment,r)},m(r,u){_(r,c,u),e(c,v),_(r,g,u),C(m,r,u),k=!0},p:Ce,i(r){k||($(m.$$.fragment,r),k=!0)},o(r){y(m.$$.fragment,r),k=!1},d(r){r&&t(c),r&&t(g),T(m,r)}}}function Id(q){let c,v,g,m,k;return{c(){c=o("p"),v=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=o("code"),m=i("Module"),k=i(`
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(r){c=s(r,"P",{});var u=a(c);v=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var E=a(g);m=l(E,"Module"),E.forEach(t),k=l(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(t)},m(r,u){_(r,c,u),e(c,v),e(c,g),e(g,m),e(c,k)},d(r){r&&t(c)}}}function Od(q){let c,v,g,m,k;return m=new J({props:{code:`import torch
from transformers import AutoTokenizer, CanineForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("google/canine-s")
model = CanineForSequenceClassification.from_pretrained("google/canine-s")

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 = CanineForSequenceClassification.from_pretrained("google/canine-s", 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, CanineForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/canine-s&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CanineForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;google/canine-s&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 = CanineForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;google/canine-s&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(){c=o("p"),v=i("Example of single-label classification:"),g=d(),b(m.$$.fragment)},l(r){c=s(r,"P",{});var u=a(c);v=l(u,"Example of single-label classification:"),u.forEach(t),g=p(r),w(m.$$.fragment,r)},m(r,u){_(r,c,u),e(c,v),_(r,g,u),C(m,r,u),k=!0},p:Ce,i(r){k||($(m.$$.fragment,r),k=!0)},o(r){y(m.$$.fragment,r),k=!1},d(r){r&&t(c),r&&t(g),T(m,r)}}}function Sd(q){let c,v,g,m,k;return m=new J({props:{code:`import torch
from transformers import AutoTokenizer, CanineForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("google/canine-s")
model = CanineForSequenceClassification.from_pretrained("google/canine-s", 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 = CanineForSequenceClassification.from_pretrained(
    "google/canine-s", 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, CanineForSequenceClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/canine-s&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CanineForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;google/canine-s&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 = CanineForSequenceClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;google/canine-s&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(){c=o("p"),v=i("Example of multi-label classification:"),g=d(),b(m.$$.fragment)},l(r){c=s(r,"P",{});var u=a(c);v=l(u,"Example of multi-label classification:"),u.forEach(t),g=p(r),w(m.$$.fragment,r)},m(r,u){_(r,c,u),e(c,v),_(r,g,u),C(m,r,u),k=!0},p:Ce,i(r){k||($(m.$$.fragment,r),k=!0)},o(r){y(m.$$.fragment,r),k=!1},d(r){r&&t(c),r&&t(g),T(m,r)}}}function Ld(q){let c,v,g,m,k;return{c(){c=o("p"),v=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=o("code"),m=i("Module"),k=i(`
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(r){c=s(r,"P",{});var u=a(c);v=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var E=a(g);m=l(E,"Module"),E.forEach(t),k=l(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(t)},m(r,u){_(r,c,u),e(c,v),e(c,g),e(g,m),e(c,k)},d(r){r&&t(c)}}}function Dd(q){let c,v,g,m,k;return m=new J({props:{code:`from transformers import AutoTokenizer, CanineForMultipleChoice
import torch

tokenizer = AutoTokenizer.from_pretrained("google/canine-s")
model = CanineForMultipleChoice.from_pretrained("google/canine-s")

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, CanineForMultipleChoice
<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;google/canine-s&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CanineForMultipleChoice.from_pretrained(<span class="hljs-string">&quot;google/canine-s&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(){c=o("p"),v=i("Example:"),g=d(),b(m.$$.fragment)},l(r){c=s(r,"P",{});var u=a(c);v=l(u,"Example:"),u.forEach(t),g=p(r),w(m.$$.fragment,r)},m(r,u){_(r,c,u),e(c,v),_(r,g,u),C(m,r,u),k=!0},p:Ce,i(r){k||($(m.$$.fragment,r),k=!0)},o(r){y(m.$$.fragment,r),k=!1},d(r){r&&t(c),r&&t(g),T(m,r)}}}function Wd(q){let c,v,g,m,k;return{c(){c=o("p"),v=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=o("code"),m=i("Module"),k=i(`
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(r){c=s(r,"P",{});var u=a(c);v=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var E=a(g);m=l(E,"Module"),E.forEach(t),k=l(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(t)},m(r,u){_(r,c,u),e(c,v),e(c,g),e(g,m),e(c,k)},d(r){r&&t(c)}}}function Qd(q){let c,v,g,m,k;return m=new J({props:{code:`from transformers import AutoTokenizer, CanineForTokenClassification
import torch

tokenizer = AutoTokenizer.from_pretrained("google/canine-s")
model = CanineForTokenClassification.from_pretrained("google/canine-s")

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]]
predicted_tokens_classes`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, CanineForTokenClassification
<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;google/canine-s&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CanineForTokenClassification.from_pretrained(<span class="hljs-string">&quot;google/canine-s&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>predicted_tokens_classes`}}),{c(){c=o("p"),v=i("Example:"),g=d(),b(m.$$.fragment)},l(r){c=s(r,"P",{});var u=a(c);v=l(u,"Example:"),u.forEach(t),g=p(r),w(m.$$.fragment,r)},m(r,u){_(r,c,u),e(c,v),_(r,g,u),C(m,r,u),k=!0},p:Ce,i(r){k||($(m.$$.fragment,r),k=!0)},o(r){y(m.$$.fragment,r),k=!1},d(r){r&&t(c),r&&t(g),T(m,r)}}}function Hd(q){let c,v;return c=new J({props:{code:`labels = predicted_token_class_ids
loss = model(**inputs, labels=labels).loss
round(loss.item(), 2)`,highlighted:`<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
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">2</span>)`}}),{c(){b(c.$$.fragment)},l(g){w(c.$$.fragment,g)},m(g,m){C(c,g,m),v=!0},p:Ce,i(g){v||($(c.$$.fragment,g),v=!0)},o(g){y(c.$$.fragment,g),v=!1},d(g){T(c,g)}}}function Bd(q){let c,v,g,m,k;return{c(){c=o("p"),v=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=o("code"),m=i("Module"),k=i(`
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(r){c=s(r,"P",{});var u=a(c);v=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var E=a(g);m=l(E,"Module"),E.forEach(t),k=l(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(t)},m(r,u){_(r,c,u),e(c,v),e(c,g),e(g,m),e(c,k)},d(r){r&&t(c)}}}function Ud(q){let c,v,g,m,k;return m=new J({props:{code:`from transformers import AutoTokenizer, CanineForQuestionAnswering
import torch

tokenizer = AutoTokenizer.from_pretrained("Splend1dchan/canine-c-squad")
model = CanineForQuestionAnswering.from_pretrained("Splend1dchan/canine-c-squad")

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]
tokenizer.decode(predict_answer_tokens, skip_special_tokens=True)

# 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
round(loss.item(), 2)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, CanineForQuestionAnswering
<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;Splend1dchan/canine-c-squad&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = CanineForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;Splend1dchan/canine-c-squad&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>tokenizer.decode(predict_answer_tokens, skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-string">&#x27;nice puppet&#x27;</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
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">round</span>(loss.item(), <span class="hljs-number">2</span>)
<span class="hljs-number">8.81</span>`}}),{c(){c=o("p"),v=i("Example:"),g=d(),b(m.$$.fragment)},l(r){c=s(r,"P",{});var u=a(c);v=l(u,"Example:"),u.forEach(t),g=p(r),w(m.$$.fragment,r)},m(r,u){_(r,c,u),e(c,v),_(r,g,u),C(m,r,u),k=!0},p:Ce,i(r){k||($(m.$$.fragment,r),k=!0)},o(r){y(m.$$.fragment,r),k=!1},d(r){r&&t(c),r&&t(g),T(m,r)}}}function Rd(q){let c,v,g,m,k,r,u,E,aa,is,ee,$e,Ut,ln,ra,Rt,ia,ls,ye,la,cn,ca,da,cs,rt,pa,ds,it,Vt,ha,ps,lt,ma,hs,x,Jt,Gt,ua,fa,Yt,dn,ga,ct,_a,ka,va,Xt,Kt,ba,wa,Zt,eo,Ca,$a,no,dt,pn,ya,Ta,qa,to,pt,hn,Ea,za,ms,G,xa,mn,ja,Fa,un,Aa,Ma,us,ne,Te,oo,fn,Pa,so,Na,fs,ht,Ia,gs,gn,_s,mt,Oa,ks,_n,vs,te,qe,ao,kn,Sa,ro,La,bs,D,io,ut,Da,Wa,lo,ft,Qa,Ha,co,gt,Ba,Ua,po,_t,Ra,ws,oe,Ee,ho,vn,Va,mo,Ja,Cs,se,bn,Ga,P,Ya,kt,Xa,Ka,vt,Za,er,uo,nr,tr,fo,or,sr,$s,ae,ze,go,wn,ar,_o,rr,ys,N,Cn,ir,re,lr,bt,cr,dr,$n,pr,hr,mr,ie,ur,wt,fr,gr,Ct,_r,kr,vr,xe,Ts,le,je,ko,yn,br,vo,wr,qs,z,Tn,Cr,bo,$r,yr,Fe,$t,Tr,qr,yt,Er,zr,xr,qn,jr,Tt,Fr,Ar,Mr,Y,En,Pr,wo,Nr,Ir,zn,qt,Or,Co,Sr,Lr,Et,Dr,$o,Wr,Qr,Ae,xn,Hr,jn,Br,yo,Ur,Rr,Vr,W,Fn,Jr,To,Gr,Yr,Me,Xr,ce,Kr,qo,Zr,ei,Eo,ni,ti,Es,de,Pe,zo,An,oi,xo,si,zs,V,Mn,ai,Pn,ri,Nn,ii,li,ci,Q,In,di,pe,pi,zt,hi,mi,jo,ui,fi,gi,Ne,_i,Ie,xs,he,Oe,Fo,On,ki,Ao,vi,js,I,Sn,bi,Mo,wi,Ci,Ln,$i,Dn,yi,Ti,qi,F,Wn,Ei,me,zi,xt,xi,ji,Po,Fi,Ai,Mi,Se,Pi,Le,Ni,De,Fs,ue,We,No,Qn,Ii,Io,Oi,As,O,Hn,Si,Oo,Li,Di,Bn,Wi,Un,Qi,Hi,Bi,H,Rn,Ui,fe,Ri,jt,Vi,Ji,So,Gi,Yi,Xi,Qe,Ki,He,Ms,ge,Be,Lo,Vn,Zi,Do,el,Ps,S,Jn,nl,Wo,tl,ol,Gn,sl,Yn,al,rl,il,A,Xn,ll,_e,cl,Ft,dl,pl,Qo,hl,ml,ul,Ue,fl,Re,gl,Ve,Ns,ke,Je,Ho,Kn,_l,Bo,kl,Is,L,Zn,vl,ve,bl,Uo,wl,Cl,Ro,$l,yl,Tl,et,ql,nt,El,zl,xl,B,tt,jl,be,Fl,At,Al,Ml,Vo,Pl,Nl,Il,Ge,Ol,Ye,Os;return r=new R({}),ln=new R({}),fn=new R({}),gn=new J({props:{code:`from transformers import CanineModel
import torch

model = CanineModel.from_pretrained("google/canine-c")  # model pre-trained with autoregressive character loss

text = "hello world"
# use Python's built-in ord() function to turn each character into its unicode code point id
input_ids = torch.tensor([[ord(char) for char in text]])

outputs = model(input_ids)  # forward pass
pooled_output = outputs.pooler_output
sequence_output = 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> CanineModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>model = CanineModel.from_pretrained(<span class="hljs-string">&quot;google/canine-c&quot;</span>)  <span class="hljs-comment"># model pre-trained with autoregressive character loss</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;hello world&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># use Python&#x27;s built-in ord() function to turn each character into its unicode code point id</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = torch.tensor([[<span class="hljs-built_in">ord</span>(char) <span class="hljs-keyword">for</span> char <span class="hljs-keyword">in</span> text]])

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids)  <span class="hljs-comment"># forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pooled_output = outputs.pooler_output
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence_output = outputs.last_hidden_state`}}),_n=new J({props:{code:`from transformers import CanineTokenizer, CanineModel

model = CanineModel.from_pretrained("google/canine-c")
tokenizer = CanineTokenizer.from_pretrained("google/canine-c")

inputs = ["Life is like a box of chocolates.", "You never know what you gonna get."]
encoding = tokenizer(inputs, padding="longest", truncation=True, return_tensors="pt")

outputs = model(**encoding)  # forward pass
pooled_output = outputs.pooler_output
sequence_output = 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> CanineTokenizer, CanineModel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = CanineModel.from_pretrained(<span class="hljs-string">&quot;google/canine-c&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = CanineTokenizer.from_pretrained(<span class="hljs-string">&quot;google/canine-c&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = [<span class="hljs-string">&quot;Life is like a box of chocolates.&quot;</span>, <span class="hljs-string">&quot;You never know what you gonna get.&quot;</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>encoding = tokenizer(inputs, padding=<span class="hljs-string">&quot;longest&quot;</span>, truncation=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**encoding)  <span class="hljs-comment"># forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pooled_output = outputs.pooler_output
<span class="hljs-meta">&gt;&gt;&gt; </span>sequence_output = outputs.last_hidden_state`}}),kn=new R({}),vn=new R({}),bn=new j({props:{name:"class transformers.models.canine.modeling_canine.CanineModelOutputWithPooling",anchor:"transformers.models.canine.modeling_canine.CanineModelOutputWithPooling",parameters:[{name:"last_hidden_state",val:": FloatTensor = None"},{name:"pooler_output",val:": FloatTensor = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.canine.modeling_canine.CanineModelOutputWithPooling.last_hidden_state",description:`<strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) &#x2014;
Sequence of hidden-states at the output of the last layer of the model (i.e. the output of the final
shallow Transformer encoder).`,name:"last_hidden_state"},{anchor:"transformers.models.canine.modeling_canine.CanineModelOutputWithPooling.pooler_output",description:`<strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) &#x2014;
Hidden-state of the first token of the sequence (classification token) at the last layer of the deep
Transformer encoder, further processed by a Linear layer and a Tanh activation function. The Linear layer
weights are trained from the next sentence prediction (classification) objective during pretraining.`,name:"pooler_output"},{anchor:"transformers.models.canine.modeling_canine.CanineModelOutputWithPooling.hidden_states",description:`<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>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for the input to each encoder + one for the output of each layer of each
encoder) of shape <code>(batch_size, sequence_length, hidden_size)</code> and <code>(batch_size, sequence_length // config.downsampling_rate, hidden_size)</code>. Hidden-states of the model at the output of each layer plus the
initial input to each Transformer encoder. The hidden states of the shallow encoders have length
<code>sequence_length</code>, but the hidden states of the deep encoder have length <code>sequence_length</code> //
<code>config.downsampling_rate</code>.`,name:"hidden_states"},{anchor:"transformers.models.canine.modeling_canine.CanineModelOutputWithPooling.attentions",description:`<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>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer) of the 3 Transformer encoders of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code> and <code>(batch_size, num_heads, sequence_length // config.downsampling_rate, sequence_length // config.downsampling_rate)</code>. Attentions weights after the
attention softmax, used to compute the weighted average in the self-attention heads.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/canine/modeling_canine.py#L66"}}),wn=new R({}),Cn=new j({props:{name:"class transformers.CanineConfig",anchor:"transformers.CanineConfig",parameters:[{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:" = 16384"},{name:"type_vocab_size",val:" = 16"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"pad_token_id",val:" = 0"},{name:"bos_token_id",val:" = 57344"},{name:"eos_token_id",val:" = 57345"},{name:"downsampling_rate",val:" = 4"},{name:"upsampling_kernel_size",val:" = 4"},{name:"num_hash_functions",val:" = 8"},{name:"num_hash_buckets",val:" = 16384"},{name:"local_transformer_stride",val:" = 128"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CanineConfig.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.CanineConfig.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 deep Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.CanineConfig.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 encoders.`,name:"num_attention_heads"},{anchor:"transformers.CanineConfig.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 encoders.`,name:"intermediate_size"},{anchor:"transformers.CanineConfig.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.CanineConfig.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, encoders, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.CanineConfig.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.CanineConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 16384) &#x2014;
The maximum sequence length that this model might ever be used with.`,name:"max_position_embeddings"},{anchor:"transformers.CanineConfig.type_vocab_size",description:`<strong>type_vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
The vocabulary size of the <code>token_type_ids</code> passed when calling <a href="/docs/transformers/v4.29.0/en/model_doc/canine#transformers.CanineModel">CanineModel</a>.`,name:"type_vocab_size"},{anchor:"transformers.CanineConfig.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.CanineConfig.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.CanineConfig.downsampling_rate",description:`<strong>downsampling_rate</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The rate at which to downsample the original character sequence length before applying the deep Transformer
encoder.`,name:"downsampling_rate"},{anchor:"transformers.CanineConfig.upsampling_kernel_size",description:`<strong>upsampling_kernel_size</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
The kernel size (i.e. the number of characters in each window) of the convolutional projection layer when
projecting back from <code>hidden_size</code>*2 to <code>hidden_size</code>.`,name:"upsampling_kernel_size"},{anchor:"transformers.CanineConfig.num_hash_functions",description:`<strong>num_hash_functions</strong> (<code>int</code>, <em>optional</em>, defaults to 8) &#x2014;
The number of hash functions to use. Each hash function has its own embedding matrix.`,name:"num_hash_functions"},{anchor:"transformers.CanineConfig.num_hash_buckets",description:`<strong>num_hash_buckets</strong> (<code>int</code>, <em>optional</em>, defaults to 16384) &#x2014;
The number of hash buckets to use.`,name:"num_hash_buckets"},{anchor:"transformers.CanineConfig.local_transformer_stride",description:`<strong>local_transformer_stride</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
The stride of the local attention of the first shallow Transformer encoder. Defaults to 128 for good
TPU/XLA memory alignment.`,name:"local_transformer_stride"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/canine/configuration_canine.py#L29"}}),xe=new we({props:{anchor:"transformers.CanineConfig.example",$$slots:{default:[Ad]},$$scope:{ctx:q}}}),yn=new R({}),Tn=new j({props:{name:"class transformers.CanineTokenizer",anchor:"transformers.CanineTokenizer",parameters:[{name:"bos_token",val:" = '\\ue000'"},{name:"eos_token",val:" = '\\ue001'"},{name:"sep_token",val:" = '\\ue001'"},{name:"cls_token",val:" = '\\ue000'"},{name:"pad_token",val:" = '\\x00'"},{name:"mask_token",val:" = '\\ue003'"},{name:"add_prefix_space",val:" = False"},{name:"model_max_length",val:" = 2048"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.CanineTokenizer.model_max_length",description:`<strong>model_max_length</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) &#x2014;
The maximum sentence length the model accepts.`,name:"model_max_length"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/canine/tokenization_canine.py#L63"}}),En=new j({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.CanineTokenizer.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.CanineTokenizer.build_inputs_with_special_tokens.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs to which the special tokens will be added.`,name:"token_ids_0"},{anchor:"transformers.CanineTokenizer.build_inputs_with_special_tokens.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/canine/tokenization_canine.py#L155",returnDescription:`
<p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),xn=new j({props:{name:"get_special_tokens_mask",anchor:"transformers.CanineTokenizer.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"},{name:"already_has_special_tokens",val:": bool = False"}],parametersDescription:[{anchor:"transformers.CanineTokenizer.get_special_tokens_mask.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.CanineTokenizer.get_special_tokens_mask.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"},{anchor:"transformers.CanineTokenizer.get_special_tokens_mask.already_has_special_tokens",description:`<strong>already_has_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the token list is already formatted with special tokens for the model.`,name:"already_has_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/canine/tokenization_canine.py#L182",returnDescription:`
<p>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Fn=new j({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.CanineTokenizer.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.CanineTokenizer.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.CanineTokenizer.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/canine/tokenization_canine.py#L210",returnDescription:`
<p>List of <a href="../glossary#token-type-ids">token type IDs</a> according to the given sequence(s).</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Me=new we({props:{anchor:"transformers.CanineTokenizer.create_token_type_ids_from_sequences.example",$$slots:{default:[Md]},$$scope:{ctx:q}}}),An=new R({}),Mn=new j({props:{name:"class transformers.CanineModel",anchor:"transformers.CanineModel",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:" = True"}],parametersDescription:[{anchor:"transformers.CanineModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/canine#transformers.CanineConfig">CanineConfig</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/canine/modeling_canine.py#L991"}}),In=new j({props:{name:"forward",anchor:"transformers.CanineModel.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:"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.CanineModel.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.CanineModel.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.CanineModel.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.CanineModel.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.CanineModel.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.CanineModel.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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.CanineModel.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.CanineModel.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.CanineModel.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"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/canine/modeling_canine.py#L1099",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/model_doc/canine#transformers.models.canine.modeling_canine.CanineModelOutputWithPooling"
>transformers.models.canine.modeling_canine.CanineModelOutputWithPooling</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/canine#transformers.CanineConfig"
>CanineConfig</a>) and inputs.</p>
<ul>
<li><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 (i.e. the output of the final
shallow Transformer encoder).</li>
<li><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Hidden-state of the first token of the sequence (classification token) at the last layer of the deep
Transformer encoder, further processed by a Linear layer and a Tanh activation function. The Linear layer
weights are trained from the next sentence prediction (classification) objective during pretraining.</li>
<li><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 input to each encoder + one for the output of each layer of each
encoder) of shape <code>(batch_size, sequence_length, hidden_size)</code> and <code>(batch_size, sequence_length // config.downsampling_rate, hidden_size)</code>. Hidden-states of the model at the output of each layer plus the
initial input to each Transformer encoder. The hidden states of the shallow encoders have length
<code>sequence_length</code>, but the hidden states of the deep encoder have length <code>sequence_length</code> //
<code>config.downsampling_rate</code>.</li>
<li><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 the 3 Transformer encoders of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code> and <code>(batch_size, num_heads, sequence_length // config.downsampling_rate, sequence_length // config.downsampling_rate)</code>. Attentions weights after the
attention softmax, used to compute the weighted average in the self-attention heads.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/model_doc/canine#transformers.models.canine.modeling_canine.CanineModelOutputWithPooling"
>transformers.models.canine.modeling_canine.CanineModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ne=new rs({props:{$$slots:{default:[Pd]},$$scope:{ctx:q}}}),Ie=new we({props:{anchor:"transformers.CanineModel.forward.example",$$slots:{default:[Nd]},$$scope:{ctx:q}}}),On=new R({}),Sn=new j({props:{name:"class transformers.CanineForSequenceClassification",anchor:"transformers.CanineForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.CanineForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/canine#transformers.CanineConfig">CanineConfig</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/canine/modeling_canine.py#L1268"}}),Wn=new j({props:{name:"forward",anchor:"transformers.CanineForSequenceClassification.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.CanineForSequenceClassification.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.CanineForSequenceClassification.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.CanineForSequenceClassification.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.CanineForSequenceClassification.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.CanineForSequenceClassification.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.CanineForSequenceClassification.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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.CanineForSequenceClassification.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.CanineForSequenceClassification.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.CanineForSequenceClassification.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.CanineForSequenceClassification.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/canine/modeling_canine.py#L1280",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/canine#transformers.CanineConfig"
>CanineConfig</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>
`}}),Se=new rs({props:{$$slots:{default:[Id]},$$scope:{ctx:q}}}),Le=new we({props:{anchor:"transformers.CanineForSequenceClassification.forward.example",$$slots:{default:[Od]},$$scope:{ctx:q}}}),De=new we({props:{anchor:"transformers.CanineForSequenceClassification.forward.example-2",$$slots:{default:[Sd]},$$scope:{ctx:q}}}),Qn=new R({}),Hn=new j({props:{name:"class transformers.CanineForMultipleChoice",anchor:"transformers.CanineForMultipleChoice",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.CanineForMultipleChoice.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/canine#transformers.CanineConfig">CanineConfig</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/canine/modeling_canine.py#L1365"}}),Rn=new j({props:{name:"forward",anchor:"transformers.CanineForMultipleChoice.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.CanineForMultipleChoice.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.CanineForMultipleChoice.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.CanineForMultipleChoice.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.CanineForMultipleChoice.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.CanineForMultipleChoice.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.CanineForMultipleChoice.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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.CanineForMultipleChoice.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.CanineForMultipleChoice.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.CanineForMultipleChoice.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.CanineForMultipleChoice.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/canine/modeling_canine.py#L1376",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/canine#transformers.CanineConfig"
>CanineConfig</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>
`}}),Qe=new rs({props:{$$slots:{default:[Ld]},$$scope:{ctx:q}}}),He=new we({props:{anchor:"transformers.CanineForMultipleChoice.forward.example",$$slots:{default:[Dd]},$$scope:{ctx:q}}}),Vn=new R({}),Jn=new j({props:{name:"class transformers.CanineForTokenClassification",anchor:"transformers.CanineForTokenClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.CanineForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/canine#transformers.CanineConfig">CanineConfig</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/canine/modeling_canine.py#L1456"}}),Xn=new j({props:{name:"forward",anchor:"transformers.CanineForTokenClassification.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.CanineForTokenClassification.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.CanineForTokenClassification.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.CanineForTokenClassification.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.CanineForTokenClassification.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.CanineForTokenClassification.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.CanineForTokenClassification.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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.CanineForTokenClassification.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.CanineForTokenClassification.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.CanineForTokenClassification.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.CanineForTokenClassification.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/canine/modeling_canine.py#L1468",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/canine#transformers.CanineConfig"
>CanineConfig</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>
`}}),Ue=new rs({props:{$$slots:{default:[Wd]},$$scope:{ctx:q}}}),Re=new we({props:{anchor:"transformers.CanineForTokenClassification.forward.example",$$slots:{default:[Qd]},$$scope:{ctx:q}}}),Ve=new we({props:{anchor:"transformers.CanineForTokenClassification.forward.example-2",$$slots:{default:[Hd]},$$scope:{ctx:q}}}),Kn=new R({}),Zn=new j({props:{name:"class transformers.CanineForQuestionAnswering",anchor:"transformers.CanineForQuestionAnswering",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.CanineForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/canine#transformers.CanineConfig">CanineConfig</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/canine/modeling_canine.py#L1562"}}),tt=new j({props:{name:"forward",anchor:"transformers.CanineForQuestionAnswering.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.CanineForQuestionAnswering.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.CanineForQuestionAnswering.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.CanineForQuestionAnswering.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.CanineForQuestionAnswering.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.CanineForQuestionAnswering.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.CanineForQuestionAnswering.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 <em>input_ids</em> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.CanineForQuestionAnswering.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.CanineForQuestionAnswering.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.CanineForQuestionAnswering.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.CanineForQuestionAnswering.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.CanineForQuestionAnswering.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/canine/modeling_canine.py#L1573",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/canine#transformers.CanineConfig"
>CanineConfig</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>
`}}),Ge=new rs({props:{$$slots:{default:[Bd]},$$scope:{ctx:q}}}),Ye=new we({props:{anchor:"transformers.CanineForQuestionAnswering.forward.example",$$slots:{default:[Ud]},$$scope:{ctx:q}}}),{c(){c=o("meta"),v=d(),g=o("h1"),m=o("a"),k=o("span"),b(r.$$.fragment),u=d(),E=o("span"),aa=i("CANINE"),is=d(),ee=o("h2"),$e=o("a"),Ut=o("span"),b(ln.$$.fragment),ra=d(),Rt=o("span"),ia=i("Overview"),ls=d(),ye=o("p"),la=i("The CANINE model was proposed in "),cn=o("a"),ca=i(`CANINE: Pre-training an Efficient Tokenization-Free Encoder for Language
Representation`),da=i(` by Jonathan H. Clark, Dan Garrette, Iulia Turc, John Wieting. It\u2019s
among the first papers that trains a Transformer without using an explicit tokenization step (such as Byte Pair
Encoding (BPE), WordPiece or SentencePiece). Instead, the model is trained directly at a Unicode character-level.
Training at a character-level inevitably comes with a longer sequence length, which CANINE solves with an efficient
downsampling strategy, before applying a deep Transformer encoder.`),cs=d(),rt=o("p"),pa=i("The abstract from the paper is the following:"),ds=d(),it=o("p"),Vt=o("em"),ha=i(`Pipelined NLP systems have largely been superseded by end-to-end neural modeling, yet nearly all commonly-used models
still require an explicit tokenization step. While recent tokenization approaches based on data-derived subword
lexicons are less brittle than manually engineered tokenizers, these techniques are not equally suited to all
languages, and the use of any fixed vocabulary may limit a model\u2019s ability to adapt. In this paper, we present CANINE,
a neural encoder that operates directly on character sequences, without explicit tokenization or vocabulary, and a
pre-training strategy that operates either directly on characters or optionally uses subwords as a soft inductive bias.
To use its finer-grained input effectively and efficiently, CANINE combines downsampling, which reduces the input
sequence length, with a deep transformer stack, which encodes context. CANINE outperforms a comparable mBERT model by
2.8 F1 on TyDi QA, a challenging multilingual benchmark, despite having 28% fewer model parameters.`),ps=d(),lt=o("p"),ma=i("Tips:"),hs=d(),x=o("ul"),Jt=o("li"),Gt=o("p"),ua=i(`CANINE uses no less than 3 Transformer encoders internally: 2 \u201Cshallow\u201D encoders (which only consist of a single
layer) and 1 \u201Cdeep\u201D encoder (which is a regular BERT encoder). First, a \u201Cshallow\u201D encoder is used to contextualize
the character embeddings, using local attention. Next, after downsampling, a \u201Cdeep\u201D encoder is applied. Finally,
after upsampling, a \u201Cshallow\u201D encoder is used to create the final character embeddings. Details regarding up- and
downsampling can be found in the paper.`),fa=d(),Yt=o("li"),dn=o("p"),ga=i("CANINE uses a max sequence length of 2048 characters by default. One can use "),ct=o("a"),_a=i("CanineTokenizer"),ka=i(`
to prepare text for the model.`),va=d(),Xt=o("li"),Kt=o("p"),ba=i(`Classification can be done by placing a linear layer on top of the final hidden state of the special [CLS] token
(which has a predefined Unicode code point). For token classification tasks however, the downsampled sequence of
tokens needs to be upsampled again to match the length of the original character sequence (which is 2048). The
details for this can be found in the paper.`),wa=d(),Zt=o("li"),eo=o("p"),Ca=i("Models:"),$a=d(),no=o("li"),dt=o("p"),pn=o("a"),ya=i("google/canine-c"),Ta=i(`: Pre-trained with autoregressive character loss,
12-layer, 768-hidden, 12-heads, 121M parameters (size ~500 MB).`),qa=d(),to=o("li"),pt=o("p"),hn=o("a"),Ea=i("google/canine-s"),za=i(`: Pre-trained with subword loss, 12-layer,
768-hidden, 12-heads, 121M parameters (size ~500 MB).`),ms=d(),G=o("p"),xa=i("This model was contributed by "),mn=o("a"),ja=i("nielsr"),Fa=i(". The original code can be found "),un=o("a"),Aa=i("here"),Ma=i("."),us=d(),ne=o("h3"),Te=o("a"),oo=o("span"),b(fn.$$.fragment),Pa=d(),so=o("span"),Na=i("Example"),fs=d(),ht=o("p"),Ia=i("CANINE works on raw characters, so it can be used without a tokenizer:"),gs=d(),b(gn.$$.fragment),_s=d(),mt=o("p"),Oa=i(`For batched inference and training, it is however recommended to make use of the tokenizer (to pad/truncate all
sequences to the same length):`),ks=d(),b(_n.$$.fragment),vs=d(),te=o("h2"),qe=o("a"),ao=o("span"),b(kn.$$.fragment),Sa=d(),ro=o("span"),La=i("Documentation resources"),bs=d(),D=o("ul"),io=o("li"),ut=o("a"),Da=i("Text classification task guide"),Wa=d(),lo=o("li"),ft=o("a"),Qa=i("Token classification task guide"),Ha=d(),co=o("li"),gt=o("a"),Ba=i("Question answering task guide"),Ua=d(),po=o("li"),_t=o("a"),Ra=i("Multiple choice task guide"),ws=d(),oe=o("h2"),Ee=o("a"),ho=o("span"),b(vn.$$.fragment),Va=d(),mo=o("span"),Ja=i("CANINE specific outputs"),Cs=d(),se=o("div"),b(bn.$$.fragment),Ga=d(),P=o("p"),Ya=i("Output type of "),kt=o("a"),Xa=i("CanineModel"),Ka=i(". Based on "),vt=o("a"),Za=i("BaseModelOutputWithPooling"),er=i(`, but with slightly
different `),uo=o("code"),nr=i("hidden_states"),tr=i(" and "),fo=o("code"),or=i("attentions"),sr=i(`, as these also include the hidden states and attentions of the shallow
Transformer encoders.`),$s=d(),ae=o("h2"),ze=o("a"),go=o("span"),b(wn.$$.fragment),ar=d(),_o=o("span"),rr=i("CanineConfig"),ys=d(),N=o("div"),b(Cn.$$.fragment),ir=d(),re=o("p"),lr=i("This is the configuration class to store the configuration of a "),bt=o("a"),cr=i("CanineModel"),dr=i(`. It is used to instantiate an
CANINE 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 CANINE
`),$n=o("a"),pr=i("google/canine-s"),hr=i(" architecture."),mr=d(),ie=o("p"),ur=i("Configuration objects inherit from "),wt=o("a"),fr=i("PretrainedConfig"),gr=i(` and can be used to control the model outputs. Read the
documentation from `),Ct=o("a"),_r=i("PretrainedConfig"),kr=i(" for more information."),vr=d(),b(xe.$$.fragment),Ts=d(),le=o("h2"),je=o("a"),ko=o("span"),b(yn.$$.fragment),br=d(),vo=o("span"),wr=i("CanineTokenizer"),qs=d(),z=o("div"),b(Tn.$$.fragment),Cr=d(),bo=o("p"),$r=i(`Construct a CANINE tokenizer (i.e. a character splitter). It turns text into a sequence of characters, and then
converts each character into its Unicode code point.`),yr=d(),Fe=o("p"),$t=o("a"),Tr=i("CanineTokenizer"),qr=i(" inherits from "),yt=o("a"),Er=i("PreTrainedTokenizer"),zr=i("."),xr=d(),qn=o("p"),jr=i("Refer to superclass "),Tt=o("a"),Fr=i("PreTrainedTokenizer"),Ar=i(" for usage examples and documentation concerning parameters."),Mr=d(),Y=o("div"),b(En.$$.fragment),Pr=d(),wo=o("p"),Nr=i(`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A CANINE sequence has the following format:`),Ir=d(),zn=o("ul"),qt=o("li"),Or=i("single sequence: "),Co=o("code"),Sr=i("[CLS] X [SEP]"),Lr=d(),Et=o("li"),Dr=i("pair of sequences: "),$o=o("code"),Wr=i("[CLS] A [SEP] B [SEP]"),Qr=d(),Ae=o("div"),b(xn.$$.fragment),Hr=d(),jn=o("p"),Br=i(`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),yo=o("code"),Ur=i("prepare_for_model"),Rr=i(" method."),Vr=d(),W=o("div"),b(Fn.$$.fragment),Jr=d(),To=o("p"),Gr=i("Create a mask from the two sequences passed to be used in a sequence-pair classification task. A CANINE"),Yr=d(),b(Me.$$.fragment),Xr=d(),ce=o("p"),Kr=i("If "),qo=o("code"),Zr=i("token_ids_1"),ei=i(" is "),Eo=o("code"),ni=i("None"),ti=i(", this method only returns the first portion of the mask (0s)."),Es=d(),de=o("h2"),Pe=o("a"),zo=o("span"),b(An.$$.fragment),oi=d(),xo=o("span"),si=i("CanineModel"),zs=d(),V=o("div"),b(Mn.$$.fragment),ai=d(),Pn=o("p"),ri=i(`The bare CANINE Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Nn=o("a"),ii=i("torch.nn.Module"),li=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ci=d(),Q=o("div"),b(In.$$.fragment),di=d(),pe=o("p"),pi=i("The "),zt=o("a"),hi=i("CanineModel"),mi=i(" forward method, overrides the "),jo=o("code"),ui=i("__call__"),fi=i(" special method."),gi=d(),b(Ne.$$.fragment),_i=d(),b(Ie.$$.fragment),xs=d(),he=o("h2"),Oe=o("a"),Fo=o("span"),b(On.$$.fragment),ki=d(),Ao=o("span"),vi=i("CanineForSequenceClassification"),js=d(),I=o("div"),b(Sn.$$.fragment),bi=d(),Mo=o("p"),wi=i(`CANINE Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled
output) e.g. for GLUE tasks.`),Ci=d(),Ln=o("p"),$i=i("This model is a PyTorch "),Dn=o("a"),yi=i("torch.nn.Module"),Ti=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),qi=d(),F=o("div"),b(Wn.$$.fragment),Ei=d(),me=o("p"),zi=i("The "),xt=o("a"),xi=i("CanineForSequenceClassification"),ji=i(" forward method, overrides the "),Po=o("code"),Fi=i("__call__"),Ai=i(" special method."),Mi=d(),b(Se.$$.fragment),Pi=d(),b(Le.$$.fragment),Ni=d(),b(De.$$.fragment),Fs=d(),ue=o("h2"),We=o("a"),No=o("span"),b(Qn.$$.fragment),Ii=d(),Io=o("span"),Oi=i("CanineForMultipleChoice"),As=d(),O=o("div"),b(Hn.$$.fragment),Si=d(),Oo=o("p"),Li=i(`CANINE 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.`),Di=d(),Bn=o("p"),Wi=i("This model is a PyTorch "),Un=o("a"),Qi=i("torch.nn.Module"),Hi=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Bi=d(),H=o("div"),b(Rn.$$.fragment),Ui=d(),fe=o("p"),Ri=i("The "),jt=o("a"),Vi=i("CanineForMultipleChoice"),Ji=i(" forward method, overrides the "),So=o("code"),Gi=i("__call__"),Yi=i(" special method."),Xi=d(),b(Qe.$$.fragment),Ki=d(),b(He.$$.fragment),Ms=d(),ge=o("h2"),Be=o("a"),Lo=o("span"),b(Vn.$$.fragment),Zi=d(),Do=o("span"),el=i("CanineForTokenClassification"),Ps=d(),S=o("div"),b(Jn.$$.fragment),nl=d(),Wo=o("p"),tl=i(`CANINE 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.`),ol=d(),Gn=o("p"),sl=i("This model is a PyTorch "),Yn=o("a"),al=i("torch.nn.Module"),rl=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),il=d(),A=o("div"),b(Xn.$$.fragment),ll=d(),_e=o("p"),cl=i("The "),Ft=o("a"),dl=i("CanineForTokenClassification"),pl=i(" forward method, overrides the "),Qo=o("code"),hl=i("__call__"),ml=i(" special method."),ul=d(),b(Ue.$$.fragment),fl=d(),b(Re.$$.fragment),gl=d(),b(Ve.$$.fragment),Ns=d(),ke=o("h2"),Je=o("a"),Ho=o("span"),b(Kn.$$.fragment),_l=d(),Bo=o("span"),kl=i("CanineForQuestionAnswering"),Is=d(),L=o("div"),b(Zn.$$.fragment),vl=d(),ve=o("p"),bl=i(`CANINE 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 `),Uo=o("code"),wl=i("span start logits"),Cl=i(" and "),Ro=o("code"),$l=i("span end logits"),yl=i(")."),Tl=d(),et=o("p"),ql=i("This model is a PyTorch "),nt=o("a"),El=i("torch.nn.Module"),zl=i(` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),xl=d(),B=o("div"),b(tt.$$.fragment),jl=d(),be=o("p"),Fl=i("The "),At=o("a"),Al=i("CanineForQuestionAnswering"),Ml=i(" forward method, overrides the "),Vo=o("code"),Pl=i("__call__"),Nl=i(" special method."),Il=d(),b(Ge.$$.fragment),Ol=d(),b(Ye.$$.fragment),this.h()},l(n){const f=jd('[data-svelte="svelte-1phssyn"]',document.head);c=s(f,"META",{name:!0,content:!0}),f.forEach(t),v=p(n),g=s(n,"H1",{class:!0});var ot=a(g);m=s(ot,"A",{id:!0,class:!0,href:!0});var Jo=a(m);k=s(Jo,"SPAN",{});var Go=a(k);w(r.$$.fragment,Go),Go.forEach(t),Jo.forEach(t),u=p(ot),E=s(ot,"SPAN",{});var Yo=a(E);aa=l(Yo,"CANINE"),Yo.forEach(t),ot.forEach(t),is=p(n),ee=s(n,"H2",{class:!0});var st=a(ee);$e=s(st,"A",{id:!0,class:!0,href:!0});var Xo=a($e);Ut=s(Xo,"SPAN",{});var Ko=a(Ut);w(ln.$$.fragment,Ko),Ko.forEach(t),Xo.forEach(t),ra=p(st),Rt=s(st,"SPAN",{});var Zo=a(Rt);ia=l(Zo,"Overview"),Zo.forEach(t),st.forEach(t),ls=p(n),ye=s(n,"P",{});var at=a(ye);la=l(at,"The CANINE model was proposed in "),cn=s(at,"A",{href:!0,rel:!0});var es=a(cn);ca=l(es,`CANINE: Pre-training an Efficient Tokenization-Free Encoder for Language
Representation`),es.forEach(t),da=l(at,` by Jonathan H. Clark, Dan Garrette, Iulia Turc, John Wieting. It\u2019s
among the first papers that trains a Transformer without using an explicit tokenization step (such as Byte Pair
Encoding (BPE), WordPiece or SentencePiece). Instead, the model is trained directly at a Unicode character-level.
Training at a character-level inevitably comes with a longer sequence length, which CANINE solves with an efficient
downsampling strategy, before applying a deep Transformer encoder.`),at.forEach(t),cs=p(n),rt=s(n,"P",{});var ns=a(rt);pa=l(ns,"The abstract from the paper is the following:"),ns.forEach(t),ds=p(n),it=s(n,"P",{});var ts=a(it);Vt=s(ts,"EM",{});var os=a(Vt);ha=l(os,`Pipelined NLP systems have largely been superseded by end-to-end neural modeling, yet nearly all commonly-used models
still require an explicit tokenization step. While recent tokenization approaches based on data-derived subword
lexicons are less brittle than manually engineered tokenizers, these techniques are not equally suited to all
languages, and the use of any fixed vocabulary may limit a model\u2019s ability to adapt. In this paper, we present CANINE,
a neural encoder that operates directly on character sequences, without explicit tokenization or vocabulary, and a
pre-training strategy that operates either directly on characters or optionally uses subwords as a soft inductive bias.
To use its finer-grained input effectively and efficiently, CANINE combines downsampling, which reduces the input
sequence length, with a deep transformer stack, which encodes context. CANINE outperforms a comparable mBERT model by
2.8 F1 on TyDi QA, a challenging multilingual benchmark, despite having 28% fewer model parameters.`),os.forEach(t),ts.forEach(t),ps=p(n),lt=s(n,"P",{});var ss=a(lt);ma=l(ss,"Tips:"),ss.forEach(t),hs=p(n),x=s(n,"UL",{});var U=a(x);Jt=s(U,"LI",{});var Ql=a(Jt);Gt=s(Ql,"P",{});var Hl=a(Gt);ua=l(Hl,`CANINE uses no less than 3 Transformer encoders internally: 2 \u201Cshallow\u201D encoders (which only consist of a single
layer) and 1 \u201Cdeep\u201D encoder (which is a regular BERT encoder). First, a \u201Cshallow\u201D encoder is used to contextualize
the character embeddings, using local attention. Next, after downsampling, a \u201Cdeep\u201D encoder is applied. Finally,
after upsampling, a \u201Cshallow\u201D encoder is used to create the final character embeddings. Details regarding up- and
downsampling can be found in the paper.`),Hl.forEach(t),Ql.forEach(t),fa=p(U),Yt=s(U,"LI",{});var Bl=a(Yt);dn=s(Bl,"P",{});var Ss=a(dn);ga=l(Ss,"CANINE uses a max sequence length of 2048 characters by default. One can use "),ct=s(Ss,"A",{href:!0});var Ul=a(ct);_a=l(Ul,"CanineTokenizer"),Ul.forEach(t),ka=l(Ss,`
to prepare text for the model.`),Ss.forEach(t),Bl.forEach(t),va=p(U),Xt=s(U,"LI",{});var Rl=a(Xt);Kt=s(Rl,"P",{});var Vl=a(Kt);ba=l(Vl,`Classification can be done by placing a linear layer on top of the final hidden state of the special [CLS] token
(which has a predefined Unicode code point). For token classification tasks however, the downsampled sequence of
tokens needs to be upsampled again to match the length of the original character sequence (which is 2048). The
details for this can be found in the paper.`),Vl.forEach(t),Rl.forEach(t),wa=p(U),Zt=s(U,"LI",{});var Jl=a(Zt);eo=s(Jl,"P",{});var Gl=a(eo);Ca=l(Gl,"Models:"),Gl.forEach(t),Jl.forEach(t),$a=p(U),no=s(U,"LI",{});var Yl=a(no);dt=s(Yl,"P",{});var Sl=a(dt);pn=s(Sl,"A",{href:!0,rel:!0});var Xl=a(pn);ya=l(Xl,"google/canine-c"),Xl.forEach(t),Ta=l(Sl,`: Pre-trained with autoregressive character loss,
12-layer, 768-hidden, 12-heads, 121M parameters (size ~500 MB).`),Sl.forEach(t),Yl.forEach(t),qa=p(U),to=s(U,"LI",{});var Kl=a(to);pt=s(Kl,"P",{});var Ll=a(pt);hn=s(Ll,"A",{href:!0,rel:!0});var Zl=a(hn);Ea=l(Zl,"google/canine-s"),Zl.forEach(t),za=l(Ll,`: Pre-trained with subword loss, 12-layer,
768-hidden, 12-heads, 121M parameters (size ~500 MB).`),Ll.forEach(t),Kl.forEach(t),U.forEach(t),ms=p(n),G=s(n,"P",{});var Mt=a(G);xa=l(Mt,"This model was contributed by "),mn=s(Mt,"A",{href:!0,rel:!0});var ec=a(mn);ja=l(ec,"nielsr"),ec.forEach(t),Fa=l(Mt,". The original code can be found "),un=s(Mt,"A",{href:!0,rel:!0});var nc=a(un);Aa=l(nc,"here"),nc.forEach(t),Ma=l(Mt,"."),Mt.forEach(t),us=p(n),ne=s(n,"H3",{class:!0});var Ls=a(ne);Te=s(Ls,"A",{id:!0,class:!0,href:!0});var tc=a(Te);oo=s(tc,"SPAN",{});var oc=a(oo);w(fn.$$.fragment,oc),oc.forEach(t),tc.forEach(t),Pa=p(Ls),so=s(Ls,"SPAN",{});var sc=a(so);Na=l(sc,"Example"),sc.forEach(t),Ls.forEach(t),fs=p(n),ht=s(n,"P",{});var ac=a(ht);Ia=l(ac,"CANINE works on raw characters, so it can be used without a tokenizer:"),ac.forEach(t),gs=p(n),w(gn.$$.fragment,n),_s=p(n),mt=s(n,"P",{});var rc=a(mt);Oa=l(rc,`For batched inference and training, it is however recommended to make use of the tokenizer (to pad/truncate all
sequences to the same length):`),rc.forEach(t),ks=p(n),w(_n.$$.fragment,n),vs=p(n),te=s(n,"H2",{class:!0});var Ds=a(te);qe=s(Ds,"A",{id:!0,class:!0,href:!0});var ic=a(qe);ao=s(ic,"SPAN",{});var lc=a(ao);w(kn.$$.fragment,lc),lc.forEach(t),ic.forEach(t),Sa=p(Ds),ro=s(Ds,"SPAN",{});var cc=a(ro);La=l(cc,"Documentation resources"),cc.forEach(t),Ds.forEach(t),bs=p(n),D=s(n,"UL",{});var Xe=a(D);io=s(Xe,"LI",{});var dc=a(io);ut=s(dc,"A",{href:!0});var pc=a(ut);Da=l(pc,"Text classification task guide"),pc.forEach(t),dc.forEach(t),Wa=p(Xe),lo=s(Xe,"LI",{});var hc=a(lo);ft=s(hc,"A",{href:!0});var mc=a(ft);Qa=l(mc,"Token classification task guide"),mc.forEach(t),hc.forEach(t),Ha=p(Xe),co=s(Xe,"LI",{});var uc=a(co);gt=s(uc,"A",{href:!0});var fc=a(gt);Ba=l(fc,"Question answering task guide"),fc.forEach(t),uc.forEach(t),Ua=p(Xe),po=s(Xe,"LI",{});var gc=a(po);_t=s(gc,"A",{href:!0});var _c=a(_t);Ra=l(_c,"Multiple choice task guide"),_c.forEach(t),gc.forEach(t),Xe.forEach(t),ws=p(n),oe=s(n,"H2",{class:!0});var Ws=a(oe);Ee=s(Ws,"A",{id:!0,class:!0,href:!0});var kc=a(Ee);ho=s(kc,"SPAN",{});var vc=a(ho);w(vn.$$.fragment,vc),vc.forEach(t),kc.forEach(t),Va=p(Ws),mo=s(Ws,"SPAN",{});var bc=a(mo);Ja=l(bc,"CANINE specific outputs"),bc.forEach(t),Ws.forEach(t),Cs=p(n),se=s(n,"DIV",{class:!0});var Qs=a(se);w(bn.$$.fragment,Qs),Ga=p(Qs),P=s(Qs,"P",{});var X=a(P);Ya=l(X,"Output type of "),kt=s(X,"A",{href:!0});var wc=a(kt);Xa=l(wc,"CanineModel"),wc.forEach(t),Ka=l(X,". Based on "),vt=s(X,"A",{href:!0});var Cc=a(vt);Za=l(Cc,"BaseModelOutputWithPooling"),Cc.forEach(t),er=l(X,`, but with slightly
different `),uo=s(X,"CODE",{});var $c=a(uo);nr=l($c,"hidden_states"),$c.forEach(t),tr=l(X," and "),fo=s(X,"CODE",{});var yc=a(fo);or=l(yc,"attentions"),yc.forEach(t),sr=l(X,`, as these also include the hidden states and attentions of the shallow
Transformer encoders.`),X.forEach(t),Qs.forEach(t),$s=p(n),ae=s(n,"H2",{class:!0});var Hs=a(ae);ze=s(Hs,"A",{id:!0,class:!0,href:!0});var Tc=a(ze);go=s(Tc,"SPAN",{});var qc=a(go);w(wn.$$.fragment,qc),qc.forEach(t),Tc.forEach(t),ar=p(Hs),_o=s(Hs,"SPAN",{});var Ec=a(_o);rr=l(Ec,"CanineConfig"),Ec.forEach(t),Hs.forEach(t),ys=p(n),N=s(n,"DIV",{class:!0});var Ke=a(N);w(Cn.$$.fragment,Ke),ir=p(Ke),re=s(Ke,"P",{});var Pt=a(re);lr=l(Pt,"This is the configuration class to store the configuration of a "),bt=s(Pt,"A",{href:!0});var zc=a(bt);cr=l(zc,"CanineModel"),zc.forEach(t),dr=l(Pt,`. It is used to instantiate an
CANINE 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 CANINE
`),$n=s(Pt,"A",{href:!0,rel:!0});var xc=a($n);pr=l(xc,"google/canine-s"),xc.forEach(t),hr=l(Pt," architecture."),Pt.forEach(t),mr=p(Ke),ie=s(Ke,"P",{});var Nt=a(ie);ur=l(Nt,"Configuration objects inherit from "),wt=s(Nt,"A",{href:!0});var jc=a(wt);fr=l(jc,"PretrainedConfig"),jc.forEach(t),gr=l(Nt,` and can be used to control the model outputs. Read the
documentation from `),Ct=s(Nt,"A",{href:!0});var Fc=a(Ct);_r=l(Fc,"PretrainedConfig"),Fc.forEach(t),kr=l(Nt," for more information."),Nt.forEach(t),vr=p(Ke),w(xe.$$.fragment,Ke),Ke.forEach(t),Ts=p(n),le=s(n,"H2",{class:!0});var Bs=a(le);je=s(Bs,"A",{id:!0,class:!0,href:!0});var Ac=a(je);ko=s(Ac,"SPAN",{});var Mc=a(ko);w(yn.$$.fragment,Mc),Mc.forEach(t),Ac.forEach(t),br=p(Bs),vo=s(Bs,"SPAN",{});var Pc=a(vo);wr=l(Pc,"CanineTokenizer"),Pc.forEach(t),Bs.forEach(t),qs=p(n),z=s(n,"DIV",{class:!0});var M=a(z);w(Tn.$$.fragment,M),Cr=p(M),bo=s(M,"P",{});var Nc=a(bo);$r=l(Nc,`Construct a CANINE tokenizer (i.e. a character splitter). It turns text into a sequence of characters, and then
converts each character into its Unicode code point.`),Nc.forEach(t),yr=p(M),Fe=s(M,"P",{});var as=a(Fe);$t=s(as,"A",{href:!0});var Ic=a($t);Tr=l(Ic,"CanineTokenizer"),Ic.forEach(t),qr=l(as," inherits from "),yt=s(as,"A",{href:!0});var Oc=a(yt);Er=l(Oc,"PreTrainedTokenizer"),Oc.forEach(t),zr=l(as,"."),as.forEach(t),xr=p(M),qn=s(M,"P",{});var Us=a(qn);jr=l(Us,"Refer to superclass "),Tt=s(Us,"A",{href:!0});var Sc=a(Tt);Fr=l(Sc,"PreTrainedTokenizer"),Sc.forEach(t),Ar=l(Us," for usage examples and documentation concerning parameters."),Us.forEach(t),Mr=p(M),Y=s(M,"DIV",{class:!0});var It=a(Y);w(En.$$.fragment,It),Pr=p(It),wo=s(It,"P",{});var Lc=a(wo);Nr=l(Lc,`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A CANINE sequence has the following format:`),Lc.forEach(t),Ir=p(It),zn=s(It,"UL",{});var Rs=a(zn);qt=s(Rs,"LI",{});var Dl=a(qt);Or=l(Dl,"single sequence: "),Co=s(Dl,"CODE",{});var Dc=a(Co);Sr=l(Dc,"[CLS] X [SEP]"),Dc.forEach(t),Dl.forEach(t),Lr=p(Rs),Et=s(Rs,"LI",{});var Wl=a(Et);Dr=l(Wl,"pair of sequences: "),$o=s(Wl,"CODE",{});var Wc=a($o);Wr=l(Wc,"[CLS] A [SEP] B [SEP]"),Wc.forEach(t),Wl.forEach(t),Rs.forEach(t),It.forEach(t),Qr=p(M),Ae=s(M,"DIV",{class:!0});var Vs=a(Ae);w(xn.$$.fragment,Vs),Hr=p(Vs),jn=s(Vs,"P",{});var Js=a(jn);Br=l(Js,`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),yo=s(Js,"CODE",{});var Qc=a(yo);Ur=l(Qc,"prepare_for_model"),Qc.forEach(t),Rr=l(Js," method."),Js.forEach(t),Vs.forEach(t),Vr=p(M),W=s(M,"DIV",{class:!0});var Ze=a(W);w(Fn.$$.fragment,Ze),Jr=p(Ze),To=s(Ze,"P",{});var Hc=a(To);Gr=l(Hc,"Create a mask from the two sequences passed to be used in a sequence-pair classification task. A CANINE"),Hc.forEach(t),Yr=p(Ze),w(Me.$$.fragment,Ze),Xr=p(Ze),ce=s(Ze,"P",{});var Ot=a(ce);Kr=l(Ot,"If "),qo=s(Ot,"CODE",{});var Bc=a(qo);Zr=l(Bc,"token_ids_1"),Bc.forEach(t),ei=l(Ot," is "),Eo=s(Ot,"CODE",{});var Uc=a(Eo);ni=l(Uc,"None"),Uc.forEach(t),ti=l(Ot,", this method only returns the first portion of the mask (0s)."),Ot.forEach(t),Ze.forEach(t),M.forEach(t),Es=p(n),de=s(n,"H2",{class:!0});var Gs=a(de);Pe=s(Gs,"A",{id:!0,class:!0,href:!0});var Rc=a(Pe);zo=s(Rc,"SPAN",{});var Vc=a(zo);w(An.$$.fragment,Vc),Vc.forEach(t),Rc.forEach(t),oi=p(Gs),xo=s(Gs,"SPAN",{});var Jc=a(xo);si=l(Jc,"CanineModel"),Jc.forEach(t),Gs.forEach(t),zs=p(n),V=s(n,"DIV",{class:!0});var St=a(V);w(Mn.$$.fragment,St),ai=p(St),Pn=s(St,"P",{});var Ys=a(Pn);ri=l(Ys,`The bare CANINE Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),Nn=s(Ys,"A",{href:!0,rel:!0});var Gc=a(Nn);ii=l(Gc,"torch.nn.Module"),Gc.forEach(t),li=l(Ys,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ys.forEach(t),ci=p(St),Q=s(St,"DIV",{class:!0});var en=a(Q);w(In.$$.fragment,en),di=p(en),pe=s(en,"P",{});var Lt=a(pe);pi=l(Lt,"The "),zt=s(Lt,"A",{href:!0});var Yc=a(zt);hi=l(Yc,"CanineModel"),Yc.forEach(t),mi=l(Lt," forward method, overrides the "),jo=s(Lt,"CODE",{});var Xc=a(jo);ui=l(Xc,"__call__"),Xc.forEach(t),fi=l(Lt," special method."),Lt.forEach(t),gi=p(en),w(Ne.$$.fragment,en),_i=p(en),w(Ie.$$.fragment,en),en.forEach(t),St.forEach(t),xs=p(n),he=s(n,"H2",{class:!0});var Xs=a(he);Oe=s(Xs,"A",{id:!0,class:!0,href:!0});var Kc=a(Oe);Fo=s(Kc,"SPAN",{});var Zc=a(Fo);w(On.$$.fragment,Zc),Zc.forEach(t),Kc.forEach(t),ki=p(Xs),Ao=s(Xs,"SPAN",{});var ed=a(Ao);vi=l(ed,"CanineForSequenceClassification"),ed.forEach(t),Xs.forEach(t),js=p(n),I=s(n,"DIV",{class:!0});var nn=a(I);w(Sn.$$.fragment,nn),bi=p(nn),Mo=s(nn,"P",{});var nd=a(Mo);wi=l(nd,`CANINE Model transformer with a sequence classification/regression head on top (a linear layer on top of the pooled
output) e.g. for GLUE tasks.`),nd.forEach(t),Ci=p(nn),Ln=s(nn,"P",{});var Ks=a(Ln);$i=l(Ks,"This model is a PyTorch "),Dn=s(Ks,"A",{href:!0,rel:!0});var td=a(Dn);yi=l(td,"torch.nn.Module"),td.forEach(t),Ti=l(Ks,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ks.forEach(t),qi=p(nn),F=s(nn,"DIV",{class:!0});var K=a(F);w(Wn.$$.fragment,K),Ei=p(K),me=s(K,"P",{});var Dt=a(me);zi=l(Dt,"The "),xt=s(Dt,"A",{href:!0});var od=a(xt);xi=l(od,"CanineForSequenceClassification"),od.forEach(t),ji=l(Dt," forward method, overrides the "),Po=s(Dt,"CODE",{});var sd=a(Po);Fi=l(sd,"__call__"),sd.forEach(t),Ai=l(Dt," special method."),Dt.forEach(t),Mi=p(K),w(Se.$$.fragment,K),Pi=p(K),w(Le.$$.fragment,K),Ni=p(K),w(De.$$.fragment,K),K.forEach(t),nn.forEach(t),Fs=p(n),ue=s(n,"H2",{class:!0});var Zs=a(ue);We=s(Zs,"A",{id:!0,class:!0,href:!0});var ad=a(We);No=s(ad,"SPAN",{});var rd=a(No);w(Qn.$$.fragment,rd),rd.forEach(t),ad.forEach(t),Ii=p(Zs),Io=s(Zs,"SPAN",{});var id=a(Io);Oi=l(id,"CanineForMultipleChoice"),id.forEach(t),Zs.forEach(t),As=p(n),O=s(n,"DIV",{class:!0});var tn=a(O);w(Hn.$$.fragment,tn),Si=p(tn),Oo=s(tn,"P",{});var ld=a(Oo);Li=l(ld,`CANINE 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.`),ld.forEach(t),Di=p(tn),Bn=s(tn,"P",{});var ea=a(Bn);Wi=l(ea,"This model is a PyTorch "),Un=s(ea,"A",{href:!0,rel:!0});var cd=a(Un);Qi=l(cd,"torch.nn.Module"),cd.forEach(t),Hi=l(ea,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ea.forEach(t),Bi=p(tn),H=s(tn,"DIV",{class:!0});var on=a(H);w(Rn.$$.fragment,on),Ui=p(on),fe=s(on,"P",{});var Wt=a(fe);Ri=l(Wt,"The "),jt=s(Wt,"A",{href:!0});var dd=a(jt);Vi=l(dd,"CanineForMultipleChoice"),dd.forEach(t),Ji=l(Wt," forward method, overrides the "),So=s(Wt,"CODE",{});var pd=a(So);Gi=l(pd,"__call__"),pd.forEach(t),Yi=l(Wt," special method."),Wt.forEach(t),Xi=p(on),w(Qe.$$.fragment,on),Ki=p(on),w(He.$$.fragment,on),on.forEach(t),tn.forEach(t),Ms=p(n),ge=s(n,"H2",{class:!0});var na=a(ge);Be=s(na,"A",{id:!0,class:!0,href:!0});var hd=a(Be);Lo=s(hd,"SPAN",{});var md=a(Lo);w(Vn.$$.fragment,md),md.forEach(t),hd.forEach(t),Zi=p(na),Do=s(na,"SPAN",{});var ud=a(Do);el=l(ud,"CanineForTokenClassification"),ud.forEach(t),na.forEach(t),Ps=p(n),S=s(n,"DIV",{class:!0});var sn=a(S);w(Jn.$$.fragment,sn),nl=p(sn),Wo=s(sn,"P",{});var fd=a(Wo);tl=l(fd,`CANINE 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.`),fd.forEach(t),ol=p(sn),Gn=s(sn,"P",{});var ta=a(Gn);sl=l(ta,"This model is a PyTorch "),Yn=s(ta,"A",{href:!0,rel:!0});var gd=a(Yn);al=l(gd,"torch.nn.Module"),gd.forEach(t),rl=l(ta,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),ta.forEach(t),il=p(sn),A=s(sn,"DIV",{class:!0});var Z=a(A);w(Xn.$$.fragment,Z),ll=p(Z),_e=s(Z,"P",{});var Qt=a(_e);cl=l(Qt,"The "),Ft=s(Qt,"A",{href:!0});var _d=a(Ft);dl=l(_d,"CanineForTokenClassification"),_d.forEach(t),pl=l(Qt," forward method, overrides the "),Qo=s(Qt,"CODE",{});var kd=a(Qo);hl=l(kd,"__call__"),kd.forEach(t),ml=l(Qt," special method."),Qt.forEach(t),ul=p(Z),w(Ue.$$.fragment,Z),fl=p(Z),w(Re.$$.fragment,Z),gl=p(Z),w(Ve.$$.fragment,Z),Z.forEach(t),sn.forEach(t),Ns=p(n),ke=s(n,"H2",{class:!0});var oa=a(ke);Je=s(oa,"A",{id:!0,class:!0,href:!0});var vd=a(Je);Ho=s(vd,"SPAN",{});var bd=a(Ho);w(Kn.$$.fragment,bd),bd.forEach(t),vd.forEach(t),_l=p(oa),Bo=s(oa,"SPAN",{});var wd=a(Bo);kl=l(wd,"CanineForQuestionAnswering"),wd.forEach(t),oa.forEach(t),Is=p(n),L=s(n,"DIV",{class:!0});var an=a(L);w(Zn.$$.fragment,an),vl=p(an),ve=s(an,"P",{});var Ht=a(ve);bl=l(Ht,`CANINE 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 `),Uo=s(Ht,"CODE",{});var Cd=a(Uo);wl=l(Cd,"span start logits"),Cd.forEach(t),Cl=l(Ht," and "),Ro=s(Ht,"CODE",{});var $d=a(Ro);$l=l($d,"span end logits"),$d.forEach(t),yl=l(Ht,")."),Ht.forEach(t),Tl=p(an),et=s(an,"P",{});var sa=a(et);ql=l(sa,"This model is a PyTorch "),nt=s(sa,"A",{href:!0,rel:!0});var yd=a(nt);El=l(yd,"torch.nn.Module"),yd.forEach(t),zl=l(sa,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),sa.forEach(t),xl=p(an),B=s(an,"DIV",{class:!0});var rn=a(B);w(tt.$$.fragment,rn),jl=p(rn),be=s(rn,"P",{});var Bt=a(be);Fl=l(Bt,"The "),At=s(Bt,"A",{href:!0});var Td=a(At);Al=l(Td,"CanineForQuestionAnswering"),Td.forEach(t),Ml=l(Bt," forward method, overrides the "),Vo=s(Bt,"CODE",{});var qd=a(Vo);Pl=l(qd,"__call__"),qd.forEach(t),Nl=l(Bt," special method."),Bt.forEach(t),Il=p(rn),w(Ge.$$.fragment,rn),Ol=p(rn),w(Ye.$$.fragment,rn),rn.forEach(t),an.forEach(t),this.h()},h(){h(c,"name","hf:doc:metadata"),h(c,"content",JSON.stringify(Vd)),h(m,"id","canine"),h(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"),h(m,"href","#canine"),h(g,"class","relative group"),h($e,"id","overview"),h($e,"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"),h($e,"href","#overview"),h(ee,"class","relative group"),h(cn,"href","https://arxiv.org/abs/2103.06874"),h(cn,"rel","nofollow"),h(ct,"href","/docs/transformers/v4.29.0/en/model_doc/canine#transformers.CanineTokenizer"),h(pn,"href","https://huggingface.co/google/canine-c"),h(pn,"rel","nofollow"),h(hn,"href","https://huggingface.co/google/canine-s"),h(hn,"rel","nofollow"),h(mn,"href","https://huggingface.co/nielsr"),h(mn,"rel","nofollow"),h(un,"href","https://github.com/google-research/language/tree/master/language/canine"),h(un,"rel","nofollow"),h(Te,"id","example"),h(Te,"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"),h(Te,"href","#example"),h(ne,"class","relative group"),h(qe,"id","documentation-resources"),h(qe,"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"),h(qe,"href","#documentation-resources"),h(te,"class","relative group"),h(ut,"href","../tasks/sequence_classification"),h(ft,"href","../tasks/token_classification"),h(gt,"href","../tasks/question_answering"),h(_t,"href","../tasks/multiple_choice"),h(Ee,"id","transformers.models.canine.modeling_canine.CanineModelOutputWithPooling"),h(Ee,"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"),h(Ee,"href","#transformers.models.canine.modeling_canine.CanineModelOutputWithPooling"),h(oe,"class","relative group"),h(kt,"href","/docs/transformers/v4.29.0/en/model_doc/canine#transformers.CanineModel"),h(vt,"href","/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"),h(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ze,"id","transformers.CanineConfig"),h(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"),h(ze,"href","#transformers.CanineConfig"),h(ae,"class","relative group"),h(bt,"href","/docs/transformers/v4.29.0/en/model_doc/canine#transformers.CanineModel"),h($n,"href","https://huggingface.co/google/canine-s"),h($n,"rel","nofollow"),h(wt,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),h(Ct,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),h(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(je,"id","transformers.CanineTokenizer"),h(je,"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"),h(je,"href","#transformers.CanineTokenizer"),h(le,"class","relative group"),h($t,"href","/docs/transformers/v4.29.0/en/model_doc/canine#transformers.CanineTokenizer"),h(yt,"href","/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),h(Tt,"href","/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),h(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Pe,"id","transformers.CanineModel"),h(Pe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Pe,"href","#transformers.CanineModel"),h(de,"class","relative group"),h(Nn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Nn,"rel","nofollow"),h(zt,"href","/docs/transformers/v4.29.0/en/model_doc/canine#transformers.CanineModel"),h(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Oe,"id","transformers.CanineForSequenceClassification"),h(Oe,"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"),h(Oe,"href","#transformers.CanineForSequenceClassification"),h(he,"class","relative group"),h(Dn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Dn,"rel","nofollow"),h(xt,"href","/docs/transformers/v4.29.0/en/model_doc/canine#transformers.CanineForSequenceClassification"),h(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(We,"id","transformers.CanineForMultipleChoice"),h(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"),h(We,"href","#transformers.CanineForMultipleChoice"),h(ue,"class","relative group"),h(Un,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Un,"rel","nofollow"),h(jt,"href","/docs/transformers/v4.29.0/en/model_doc/canine#transformers.CanineForMultipleChoice"),h(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Be,"id","transformers.CanineForTokenClassification"),h(Be,"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"),h(Be,"href","#transformers.CanineForTokenClassification"),h(ge,"class","relative group"),h(Yn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Yn,"rel","nofollow"),h(Ft,"href","/docs/transformers/v4.29.0/en/model_doc/canine#transformers.CanineForTokenClassification"),h(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Je,"id","transformers.CanineForQuestionAnswering"),h(Je,"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"),h(Je,"href","#transformers.CanineForQuestionAnswering"),h(ke,"class","relative group"),h(nt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(nt,"rel","nofollow"),h(At,"href","/docs/transformers/v4.29.0/en/model_doc/canine#transformers.CanineForQuestionAnswering"),h(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(n,f){e(document.head,c),_(n,v,f),_(n,g,f),e(g,m),e(m,k),C(r,k,null),e(g,u),e(g,E),e(E,aa),_(n,is,f),_(n,ee,f),e(ee,$e),e($e,Ut),C(ln,Ut,null),e(ee,ra),e(ee,Rt),e(Rt,ia),_(n,ls,f),_(n,ye,f),e(ye,la),e(ye,cn),e(cn,ca),e(ye,da),_(n,cs,f),_(n,rt,f),e(rt,pa),_(n,ds,f),_(n,it,f),e(it,Vt),e(Vt,ha),_(n,ps,f),_(n,lt,f),e(lt,ma),_(n,hs,f),_(n,x,f),e(x,Jt),e(Jt,Gt),e(Gt,ua),e(x,fa),e(x,Yt),e(Yt,dn),e(dn,ga),e(dn,ct),e(ct,_a),e(dn,ka),e(x,va),e(x,Xt),e(Xt,Kt),e(Kt,ba),e(x,wa),e(x,Zt),e(Zt,eo),e(eo,Ca),e(x,$a),e(x,no),e(no,dt),e(dt,pn),e(pn,ya),e(dt,Ta),e(x,qa),e(x,to),e(to,pt),e(pt,hn),e(hn,Ea),e(pt,za),_(n,ms,f),_(n,G,f),e(G,xa),e(G,mn),e(mn,ja),e(G,Fa),e(G,un),e(un,Aa),e(G,Ma),_(n,us,f),_(n,ne,f),e(ne,Te),e(Te,oo),C(fn,oo,null),e(ne,Pa),e(ne,so),e(so,Na),_(n,fs,f),_(n,ht,f),e(ht,Ia),_(n,gs,f),C(gn,n,f),_(n,_s,f),_(n,mt,f),e(mt,Oa),_(n,ks,f),C(_n,n,f),_(n,vs,f),_(n,te,f),e(te,qe),e(qe,ao),C(kn,ao,null),e(te,Sa),e(te,ro),e(ro,La),_(n,bs,f),_(n,D,f),e(D,io),e(io,ut),e(ut,Da),e(D,Wa),e(D,lo),e(lo,ft),e(ft,Qa),e(D,Ha),e(D,co),e(co,gt),e(gt,Ba),e(D,Ua),e(D,po),e(po,_t),e(_t,Ra),_(n,ws,f),_(n,oe,f),e(oe,Ee),e(Ee,ho),C(vn,ho,null),e(oe,Va),e(oe,mo),e(mo,Ja),_(n,Cs,f),_(n,se,f),C(bn,se,null),e(se,Ga),e(se,P),e(P,Ya),e(P,kt),e(kt,Xa),e(P,Ka),e(P,vt),e(vt,Za),e(P,er),e(P,uo),e(uo,nr),e(P,tr),e(P,fo),e(fo,or),e(P,sr),_(n,$s,f),_(n,ae,f),e(ae,ze),e(ze,go),C(wn,go,null),e(ae,ar),e(ae,_o),e(_o,rr),_(n,ys,f),_(n,N,f),C(Cn,N,null),e(N,ir),e(N,re),e(re,lr),e(re,bt),e(bt,cr),e(re,dr),e(re,$n),e($n,pr),e(re,hr),e(N,mr),e(N,ie),e(ie,ur),e(ie,wt),e(wt,fr),e(ie,gr),e(ie,Ct),e(Ct,_r),e(ie,kr),e(N,vr),C(xe,N,null),_(n,Ts,f),_(n,le,f),e(le,je),e(je,ko),C(yn,ko,null),e(le,br),e(le,vo),e(vo,wr),_(n,qs,f),_(n,z,f),C(Tn,z,null),e(z,Cr),e(z,bo),e(bo,$r),e(z,yr),e(z,Fe),e(Fe,$t),e($t,Tr),e(Fe,qr),e(Fe,yt),e(yt,Er),e(Fe,zr),e(z,xr),e(z,qn),e(qn,jr),e(qn,Tt),e(Tt,Fr),e(qn,Ar),e(z,Mr),e(z,Y),C(En,Y,null),e(Y,Pr),e(Y,wo),e(wo,Nr),e(Y,Ir),e(Y,zn),e(zn,qt),e(qt,Or),e(qt,Co),e(Co,Sr),e(zn,Lr),e(zn,Et),e(Et,Dr),e(Et,$o),e($o,Wr),e(z,Qr),e(z,Ae),C(xn,Ae,null),e(Ae,Hr),e(Ae,jn),e(jn,Br),e(jn,yo),e(yo,Ur),e(jn,Rr),e(z,Vr),e(z,W),C(Fn,W,null),e(W,Jr),e(W,To),e(To,Gr),e(W,Yr),C(Me,W,null),e(W,Xr),e(W,ce),e(ce,Kr),e(ce,qo),e(qo,Zr),e(ce,ei),e(ce,Eo),e(Eo,ni),e(ce,ti),_(n,Es,f),_(n,de,f),e(de,Pe),e(Pe,zo),C(An,zo,null),e(de,oi),e(de,xo),e(xo,si),_(n,zs,f),_(n,V,f),C(Mn,V,null),e(V,ai),e(V,Pn),e(Pn,ri),e(Pn,Nn),e(Nn,ii),e(Pn,li),e(V,ci),e(V,Q),C(In,Q,null),e(Q,di),e(Q,pe),e(pe,pi),e(pe,zt),e(zt,hi),e(pe,mi),e(pe,jo),e(jo,ui),e(pe,fi),e(Q,gi),C(Ne,Q,null),e(Q,_i),C(Ie,Q,null),_(n,xs,f),_(n,he,f),e(he,Oe),e(Oe,Fo),C(On,Fo,null),e(he,ki),e(he,Ao),e(Ao,vi),_(n,js,f),_(n,I,f),C(Sn,I,null),e(I,bi),e(I,Mo),e(Mo,wi),e(I,Ci),e(I,Ln),e(Ln,$i),e(Ln,Dn),e(Dn,yi),e(Ln,Ti),e(I,qi),e(I,F),C(Wn,F,null),e(F,Ei),e(F,me),e(me,zi),e(me,xt),e(xt,xi),e(me,ji),e(me,Po),e(Po,Fi),e(me,Ai),e(F,Mi),C(Se,F,null),e(F,Pi),C(Le,F,null),e(F,Ni),C(De,F,null),_(n,Fs,f),_(n,ue,f),e(ue,We),e(We,No),C(Qn,No,null),e(ue,Ii),e(ue,Io),e(Io,Oi),_(n,As,f),_(n,O,f),C(Hn,O,null),e(O,Si),e(O,Oo),e(Oo,Li),e(O,Di),e(O,Bn),e(Bn,Wi),e(Bn,Un),e(Un,Qi),e(Bn,Hi),e(O,Bi),e(O,H),C(Rn,H,null),e(H,Ui),e(H,fe),e(fe,Ri),e(fe,jt),e(jt,Vi),e(fe,Ji),e(fe,So),e(So,Gi),e(fe,Yi),e(H,Xi),C(Qe,H,null),e(H,Ki),C(He,H,null),_(n,Ms,f),_(n,ge,f),e(ge,Be),e(Be,Lo),C(Vn,Lo,null),e(ge,Zi),e(ge,Do),e(Do,el),_(n,Ps,f),_(n,S,f),C(Jn,S,null),e(S,nl),e(S,Wo),e(Wo,tl),e(S,ol),e(S,Gn),e(Gn,sl),e(Gn,Yn),e(Yn,al),e(Gn,rl),e(S,il),e(S,A),C(Xn,A,null),e(A,ll),e(A,_e),e(_e,cl),e(_e,Ft),e(Ft,dl),e(_e,pl),e(_e,Qo),e(Qo,hl),e(_e,ml),e(A,ul),C(Ue,A,null),e(A,fl),C(Re,A,null),e(A,gl),C(Ve,A,null),_(n,Ns,f),_(n,ke,f),e(ke,Je),e(Je,Ho),C(Kn,Ho,null),e(ke,_l),e(ke,Bo),e(Bo,kl),_(n,Is,f),_(n,L,f),C(Zn,L,null),e(L,vl),e(L,ve),e(ve,bl),e(ve,Uo),e(Uo,wl),e(ve,Cl),e(ve,Ro),e(Ro,$l),e(ve,yl),e(L,Tl),e(L,et),e(et,ql),e(et,nt),e(nt,El),e(et,zl),e(L,xl),e(L,B),C(tt,B,null),e(B,jl),e(B,be),e(be,Fl),e(be,At),e(At,Al),e(be,Ml),e(be,Vo),e(Vo,Pl),e(be,Nl),e(B,Il),C(Ge,B,null),e(B,Ol),C(Ye,B,null),Os=!0},p(n,[f]){const ot={};f&2&&(ot.$$scope={dirty:f,ctx:n}),xe.$set(ot);const Jo={};f&2&&(Jo.$$scope={dirty:f,ctx:n}),Me.$set(Jo);const Go={};f&2&&(Go.$$scope={dirty:f,ctx:n}),Ne.$set(Go);const Yo={};f&2&&(Yo.$$scope={dirty:f,ctx:n}),Ie.$set(Yo);const st={};f&2&&(st.$$scope={dirty:f,ctx:n}),Se.$set(st);const Xo={};f&2&&(Xo.$$scope={dirty:f,ctx:n}),Le.$set(Xo);const Ko={};f&2&&(Ko.$$scope={dirty:f,ctx:n}),De.$set(Ko);const Zo={};f&2&&(Zo.$$scope={dirty:f,ctx:n}),Qe.$set(Zo);const at={};f&2&&(at.$$scope={dirty:f,ctx:n}),He.$set(at);const es={};f&2&&(es.$$scope={dirty:f,ctx:n}),Ue.$set(es);const ns={};f&2&&(ns.$$scope={dirty:f,ctx:n}),Re.$set(ns);const ts={};f&2&&(ts.$$scope={dirty:f,ctx:n}),Ve.$set(ts);const os={};f&2&&(os.$$scope={dirty:f,ctx:n}),Ge.$set(os);const ss={};f&2&&(ss.$$scope={dirty:f,ctx:n}),Ye.$set(ss)},i(n){Os||($(r.$$.fragment,n),$(ln.$$.fragment,n),$(fn.$$.fragment,n),$(gn.$$.fragment,n),$(_n.$$.fragment,n),$(kn.$$.fragment,n),$(vn.$$.fragment,n),$(bn.$$.fragment,n),$(wn.$$.fragment,n),$(Cn.$$.fragment,n),$(xe.$$.fragment,n),$(yn.$$.fragment,n),$(Tn.$$.fragment,n),$(En.$$.fragment,n),$(xn.$$.fragment,n),$(Fn.$$.fragment,n),$(Me.$$.fragment,n),$(An.$$.fragment,n),$(Mn.$$.fragment,n),$(In.$$.fragment,n),$(Ne.$$.fragment,n),$(Ie.$$.fragment,n),$(On.$$.fragment,n),$(Sn.$$.fragment,n),$(Wn.$$.fragment,n),$(Se.$$.fragment,n),$(Le.$$.fragment,n),$(De.$$.fragment,n),$(Qn.$$.fragment,n),$(Hn.$$.fragment,n),$(Rn.$$.fragment,n),$(Qe.$$.fragment,n),$(He.$$.fragment,n),$(Vn.$$.fragment,n),$(Jn.$$.fragment,n),$(Xn.$$.fragment,n),$(Ue.$$.fragment,n),$(Re.$$.fragment,n),$(Ve.$$.fragment,n),$(Kn.$$.fragment,n),$(Zn.$$.fragment,n),$(tt.$$.fragment,n),$(Ge.$$.fragment,n),$(Ye.$$.fragment,n),Os=!0)},o(n){y(r.$$.fragment,n),y(ln.$$.fragment,n),y(fn.$$.fragment,n),y(gn.$$.fragment,n),y(_n.$$.fragment,n),y(kn.$$.fragment,n),y(vn.$$.fragment,n),y(bn.$$.fragment,n),y(wn.$$.fragment,n),y(Cn.$$.fragment,n),y(xe.$$.fragment,n),y(yn.$$.fragment,n),y(Tn.$$.fragment,n),y(En.$$.fragment,n),y(xn.$$.fragment,n),y(Fn.$$.fragment,n),y(Me.$$.fragment,n),y(An.$$.fragment,n),y(Mn.$$.fragment,n),y(In.$$.fragment,n),y(Ne.$$.fragment,n),y(Ie.$$.fragment,n),y(On.$$.fragment,n),y(Sn.$$.fragment,n),y(Wn.$$.fragment,n),y(Se.$$.fragment,n),y(Le.$$.fragment,n),y(De.$$.fragment,n),y(Qn.$$.fragment,n),y(Hn.$$.fragment,n),y(Rn.$$.fragment,n),y(Qe.$$.fragment,n),y(He.$$.fragment,n),y(Vn.$$.fragment,n),y(Jn.$$.fragment,n),y(Xn.$$.fragment,n),y(Ue.$$.fragment,n),y(Re.$$.fragment,n),y(Ve.$$.fragment,n),y(Kn.$$.fragment,n),y(Zn.$$.fragment,n),y(tt.$$.fragment,n),y(Ge.$$.fragment,n),y(Ye.$$.fragment,n),Os=!1},d(n){t(c),n&&t(v),n&&t(g),T(r),n&&t(is),n&&t(ee),T(ln),n&&t(ls),n&&t(ye),n&&t(cs),n&&t(rt),n&&t(ds),n&&t(it),n&&t(ps),n&&t(lt),n&&t(hs),n&&t(x),n&&t(ms),n&&t(G),n&&t(us),n&&t(ne),T(fn),n&&t(fs),n&&t(ht),n&&t(gs),T(gn,n),n&&t(_s),n&&t(mt),n&&t(ks),T(_n,n),n&&t(vs),n&&t(te),T(kn),n&&t(bs),n&&t(D),n&&t(ws),n&&t(oe),T(vn),n&&t(Cs),n&&t(se),T(bn),n&&t($s),n&&t(ae),T(wn),n&&t(ys),n&&t(N),T(Cn),T(xe),n&&t(Ts),n&&t(le),T(yn),n&&t(qs),n&&t(z),T(Tn),T(En),T(xn),T(Fn),T(Me),n&&t(Es),n&&t(de),T(An),n&&t(zs),n&&t(V),T(Mn),T(In),T(Ne),T(Ie),n&&t(xs),n&&t(he),T(On),n&&t(js),n&&t(I),T(Sn),T(Wn),T(Se),T(Le),T(De),n&&t(Fs),n&&t(ue),T(Qn),n&&t(As),n&&t(O),T(Hn),T(Rn),T(Qe),T(He),n&&t(Ms),n&&t(ge),T(Vn),n&&t(Ps),n&&t(S),T(Jn),T(Xn),T(Ue),T(Re),T(Ve),n&&t(Ns),n&&t(ke),T(Kn),n&&t(Is),n&&t(L),T(Zn),T(tt),T(Ge),T(Ye)}}}const Vd={local:"canine",sections:[{local:"overview",sections:[{local:"example",title:"Example"}],title:"Overview"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.models.canine.modeling_canine.CanineModelOutputWithPooling",title:"CANINE specific outputs"},{local:"transformers.CanineConfig",title:"CanineConfig"},{local:"transformers.CanineTokenizer",title:"CanineTokenizer"},{local:"transformers.CanineModel",title:"CanineModel"},{local:"transformers.CanineForSequenceClassification",title:"CanineForSequenceClassification"},{local:"transformers.CanineForMultipleChoice",title:"CanineForMultipleChoice"},{local:"transformers.CanineForTokenClassification",title:"CanineForTokenClassification"},{local:"transformers.CanineForQuestionAnswering",title:"CanineForQuestionAnswering"}],title:"CANINE"};function Jd(q){return Fd(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class np extends Ed{constructor(c){super();zd(this,c,Jd,Rd,xd,{})}}export{np as default,Vd as metadata};
