import{S as Qc,i as Hc,s as Uc,e as o,k as d,w,t as i,M as Rc,c as s,d as t,m as p,a as r,x as v,h as l,b as h,G as e,g as _,y as C,q as $,o as y,B as T,v as Vc,L as we}from"../../chunks/vendor-hf-doc-builder.js";import{T as Uo}from"../../chunks/Tip-hf-doc-builder.js";import{D as j}from"../../chunks/Docstring-hf-doc-builder.js";import{C as V}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as R}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as be}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Jc(q){let c,b,g,m,k;return m=new V({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"),b=i("Example:"),g=d(),w(m.$$.fragment)},l(a){c=s(a,"P",{});var u=r(c);b=l(u,"Example:"),u.forEach(t),g=p(a),v(m.$$.fragment,a)},m(a,u){_(a,c,u),e(c,b),_(a,g,u),C(m,a,u),k=!0},p:we,i(a){k||($(m.$$.fragment,a),k=!0)},o(a){y(m.$$.fragment,a),k=!1},d(a){a&&t(c),a&&t(g),T(m,a)}}}function Gc(q){let c,b,g,m,k;return m=new V({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"),b=i("sequence pair mask has the following format:"),g=d(),w(m.$$.fragment)},l(a){c=s(a,"P",{});var u=r(c);b=l(u,"sequence pair mask has the following format:"),u.forEach(t),g=p(a),v(m.$$.fragment,a)},m(a,u){_(a,c,u),e(c,b),_(a,g,u),C(m,a,u),k=!0},p:we,i(a){k||($(m.$$.fragment,a),k=!0)},o(a){y(m.$$.fragment,a),k=!1},d(a){a&&t(c),a&&t(g),T(m,a)}}}function Yc(q){let c,b,g,m,k;return{c(){c=o("p"),b=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(a){c=s(a,"P",{});var u=r(c);b=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var z=r(g);m=l(z,"Module"),z.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(a,u){_(a,c,u),e(c,b),e(c,g),e(g,m),e(c,k)},d(a){a&&t(c)}}}function Xc(q){let c,b,g,m,k;return m=new V({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"),b=i("Example:"),g=d(),w(m.$$.fragment)},l(a){c=s(a,"P",{});var u=r(c);b=l(u,"Example:"),u.forEach(t),g=p(a),v(m.$$.fragment,a)},m(a,u){_(a,c,u),e(c,b),_(a,g,u),C(m,a,u),k=!0},p:we,i(a){k||($(m.$$.fragment,a),k=!0)},o(a){y(m.$$.fragment,a),k=!1},d(a){a&&t(c),a&&t(g),T(m,a)}}}function Kc(q){let c,b,g,m,k;return{c(){c=o("p"),b=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(a){c=s(a,"P",{});var u=r(c);b=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var z=r(g);m=l(z,"Module"),z.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(a,u){_(a,c,u),e(c,b),e(c,g),e(g,m),e(c,k)},d(a){a&&t(c)}}}function Zc(q){let c,b,g,m,k;return m=new V({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"),b=i("Example of single-label classification:"),g=d(),w(m.$$.fragment)},l(a){c=s(a,"P",{});var u=r(c);b=l(u,"Example of single-label classification:"),u.forEach(t),g=p(a),v(m.$$.fragment,a)},m(a,u){_(a,c,u),e(c,b),_(a,g,u),C(m,a,u),k=!0},p:we,i(a){k||($(m.$$.fragment,a),k=!0)},o(a){y(m.$$.fragment,a),k=!1},d(a){a&&t(c),a&&t(g),T(m,a)}}}function ed(q){let c,b,g,m,k;return m=new V({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"),b=i("Example of multi-label classification:"),g=d(),w(m.$$.fragment)},l(a){c=s(a,"P",{});var u=r(c);b=l(u,"Example of multi-label classification:"),u.forEach(t),g=p(a),v(m.$$.fragment,a)},m(a,u){_(a,c,u),e(c,b),_(a,g,u),C(m,a,u),k=!0},p:we,i(a){k||($(m.$$.fragment,a),k=!0)},o(a){y(m.$$.fragment,a),k=!1},d(a){a&&t(c),a&&t(g),T(m,a)}}}function nd(q){let c,b,g,m,k;return{c(){c=o("p"),b=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(a){c=s(a,"P",{});var u=r(c);b=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var z=r(g);m=l(z,"Module"),z.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(a,u){_(a,c,u),e(c,b),e(c,g),e(g,m),e(c,k)},d(a){a&&t(c)}}}function td(q){let c,b,g,m,k;return m=new V({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"),b=i("Example:"),g=d(),w(m.$$.fragment)},l(a){c=s(a,"P",{});var u=r(c);b=l(u,"Example:"),u.forEach(t),g=p(a),v(m.$$.fragment,a)},m(a,u){_(a,c,u),e(c,b),_(a,g,u),C(m,a,u),k=!0},p:we,i(a){k||($(m.$$.fragment,a),k=!0)},o(a){y(m.$$.fragment,a),k=!1},d(a){a&&t(c),a&&t(g),T(m,a)}}}function od(q){let c,b,g,m,k;return{c(){c=o("p"),b=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(a){c=s(a,"P",{});var u=r(c);b=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var z=r(g);m=l(z,"Module"),z.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(a,u){_(a,c,u),e(c,b),e(c,g),e(g,m),e(c,k)},d(a){a&&t(c)}}}function sd(q){let c,b,g,m,k;return m=new V({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"),b=i("Example:"),g=d(),w(m.$$.fragment)},l(a){c=s(a,"P",{});var u=r(c);b=l(u,"Example:"),u.forEach(t),g=p(a),v(m.$$.fragment,a)},m(a,u){_(a,c,u),e(c,b),_(a,g,u),C(m,a,u),k=!0},p:we,i(a){k||($(m.$$.fragment,a),k=!0)},o(a){y(m.$$.fragment,a),k=!1},d(a){a&&t(c),a&&t(g),T(m,a)}}}function ad(q){let c,b;return c=new V({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(){w(c.$$.fragment)},l(g){v(c.$$.fragment,g)},m(g,m){C(c,g,m),b=!0},p:we,i(g){b||($(c.$$.fragment,g),b=!0)},o(g){y(c.$$.fragment,g),b=!1},d(g){T(c,g)}}}function rd(q){let c,b,g,m,k;return{c(){c=o("p"),b=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(a){c=s(a,"P",{});var u=r(c);b=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var z=r(g);m=l(z,"Module"),z.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(a,u){_(a,c,u),e(c,b),e(c,g),e(g,m),e(c,k)},d(a){a&&t(c)}}}function id(q){let c,b,g,m,k;return m=new V({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"),b=i("Example:"),g=d(),w(m.$$.fragment)},l(a){c=s(a,"P",{});var u=r(c);b=l(u,"Example:"),u.forEach(t),g=p(a),v(m.$$.fragment,a)},m(a,u){_(a,c,u),e(c,b),_(a,g,u),C(m,a,u),k=!0},p:we,i(a){k||($(m.$$.fragment,a),k=!0)},o(a){y(m.$$.fragment,a),k=!1},d(a){a&&t(c),a&&t(g),T(m,a)}}}function ld(q){let c,b,g,m,k,a,u,z,Ws,Ro,Z,ve,It,on,Bs,Ot,Qs,Vo,Ce,Hs,sn,Us,Rs,Jo,nt,Vs,Go,tt,St,Js,Yo,ot,Gs,Xo,x,Lt,Dt,Ys,Xs,Wt,an,Ks,st,Zs,ea,na,Bt,Qt,ta,oa,Ht,Ut,sa,aa,Rt,at,rn,ra,ia,la,Vt,rt,ln,ca,da,Ko,J,pa,cn,ha,ma,dn,ua,fa,Zo,ee,$e,Jt,pn,ga,Gt,_a,es,it,ka,ns,hn,ts,lt,ba,os,mn,ss,ne,ye,Yt,un,wa,Xt,va,as,te,fn,Ca,P,$a,ct,ya,Ta,dt,qa,za,Kt,Ea,xa,Zt,ja,Fa,rs,oe,Te,eo,gn,Aa,no,Ma,is,N,_n,Pa,se,Na,pt,Ia,Oa,kn,Sa,La,Da,ae,Wa,ht,Ba,Qa,mt,Ha,Ua,Ra,qe,ls,re,ze,to,bn,Va,oo,Ja,cs,E,wn,Ga,so,Ya,Xa,Ee,ut,Ka,Za,ft,er,nr,tr,vn,or,gt,sr,ar,rr,G,Cn,ir,ao,lr,cr,$n,_t,dr,ro,pr,hr,kt,mr,io,ur,fr,xe,yn,gr,Tn,_r,lo,kr,br,wr,D,qn,vr,co,Cr,$r,je,yr,ie,Tr,po,qr,zr,ho,Er,xr,ds,le,Fe,mo,zn,jr,uo,Fr,ps,U,En,Ar,xn,Mr,jn,Pr,Nr,Ir,W,Fn,Or,ce,Sr,bt,Lr,Dr,fo,Wr,Br,Qr,Ae,Hr,Me,hs,de,Pe,go,An,Ur,_o,Rr,ms,I,Mn,Vr,ko,Jr,Gr,Pn,Yr,Nn,Xr,Kr,Zr,F,In,ei,pe,ni,wt,ti,oi,bo,si,ai,ri,Ne,ii,Ie,li,Oe,us,he,Se,wo,On,ci,vo,di,fs,O,Sn,pi,Co,hi,mi,Ln,ui,Dn,fi,gi,_i,B,Wn,ki,me,bi,vt,wi,vi,$o,Ci,$i,yi,Le,Ti,De,gs,ue,We,yo,Bn,qi,To,zi,_s,S,Qn,Ei,qo,xi,ji,Hn,Fi,Un,Ai,Mi,Pi,A,Rn,Ni,fe,Ii,Ct,Oi,Si,zo,Li,Di,Wi,Be,Bi,Qe,Qi,He,ks,ge,Ue,Eo,Vn,Hi,xo,Ui,bs,L,Jn,Ri,_e,Vi,jo,Ji,Gi,Fo,Yi,Xi,Ki,Gn,Zi,Yn,el,nl,tl,Q,Xn,ol,ke,sl,$t,al,rl,Ao,il,ll,cl,Re,dl,Ve,ws;return a=new R({}),on=new R({}),pn=new R({}),hn=new V({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`}}),mn=new V({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`}}),un=new R({}),fn=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/main/src/transformers/models/canine/modeling_canine.py#L66"}}),gn=new R({}),_n=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/main/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/main/src/transformers/models/canine/configuration_canine.py#L29"}}),qe=new be({props:{anchor:"transformers.CanineConfig.example",$$slots:{default:[Jc]},$$scope:{ctx:q}}}),bn=new R({}),wn=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/main/src/transformers/models/canine/tokenization_canine.py#L63"}}),Cn=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/main/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>
`}}),yn=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/main/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>
`}}),qn=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/main/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>
`}}),je=new be({props:{anchor:"transformers.CanineTokenizer.create_token_type_ids_from_sequences.example",$$slots:{default:[Gc]},$$scope:{ctx:q}}}),zn=new R({}),En=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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/canine/modeling_canine.py#L992"}}),Fn=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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/canine/modeling_canine.py#L1100",returnDescription:`
<p>A <a
  href="/docs/transformers/main/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/main/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/main/en/model_doc/canine#transformers.models.canine.modeling_canine.CanineModelOutputWithPooling"
>transformers.models.canine.modeling_canine.CanineModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ae=new Uo({props:{$$slots:{default:[Yc]},$$scope:{ctx:q}}}),Me=new be({props:{anchor:"transformers.CanineModel.forward.example",$$slots:{default:[Xc]},$$scope:{ctx:q}}}),An=new R({}),Mn=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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/canine/modeling_canine.py#L1269"}}),In=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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/canine/modeling_canine.py#L1281",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/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/main/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ne=new Uo({props:{$$slots:{default:[Kc]},$$scope:{ctx:q}}}),Ie=new be({props:{anchor:"transformers.CanineForSequenceClassification.forward.example",$$slots:{default:[Zc]},$$scope:{ctx:q}}}),Oe=new be({props:{anchor:"transformers.CanineForSequenceClassification.forward.example-2",$$slots:{default:[ed]},$$scope:{ctx:q}}}),On=new R({}),Sn=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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/canine/modeling_canine.py#L1366"}}),Wn=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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/canine/modeling_canine.py#L1377",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.MultipleChoiceModelOutput"
>transformers.modeling_outputs.MultipleChoiceModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/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/main/en/main_classes/output#transformers.modeling_outputs.MultipleChoiceModelOutput"
>transformers.modeling_outputs.MultipleChoiceModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Le=new Uo({props:{$$slots:{default:[nd]},$$scope:{ctx:q}}}),De=new be({props:{anchor:"transformers.CanineForMultipleChoice.forward.example",$$slots:{default:[td]},$$scope:{ctx:q}}}),Bn=new R({}),Qn=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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/canine/modeling_canine.py#L1457"}}),Rn=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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/canine/modeling_canine.py#L1469",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/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/main/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput"
>transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Be=new Uo({props:{$$slots:{default:[od]},$$scope:{ctx:q}}}),Qe=new be({props:{anchor:"transformers.CanineForTokenClassification.forward.example",$$slots:{default:[sd]},$$scope:{ctx:q}}}),He=new be({props:{anchor:"transformers.CanineForTokenClassification.forward.example-2",$$slots:{default:[ad]},$$scope:{ctx:q}}}),Vn=new R({}),Jn=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/main/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/main/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/canine/modeling_canine.py#L1563"}}),Xn=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/main/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/main/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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/main/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/main/src/transformers/models/canine/modeling_canine.py#L1574",returnDescription:`
<p>A <a
  href="/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/main/en/model_doc/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/main/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput"
>transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Re=new Uo({props:{$$slots:{default:[rd]},$$scope:{ctx:q}}}),Ve=new be({props:{anchor:"transformers.CanineForQuestionAnswering.forward.example",$$slots:{default:[id]},$$scope:{ctx:q}}}),{c(){c=o("meta"),b=d(),g=o("h1"),m=o("a"),k=o("span"),w(a.$$.fragment),u=d(),z=o("span"),Ws=i("CANINE"),Ro=d(),Z=o("h2"),ve=o("a"),It=o("span"),w(on.$$.fragment),Bs=d(),Ot=o("span"),Qs=i("Overview"),Vo=d(),Ce=o("p"),Hs=i("The CANINE model was proposed in "),sn=o("a"),Us=i(`CANINE: Pre-training an Efficient Tokenization-Free Encoder for Language
Representation`),Rs=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.`),Jo=d(),nt=o("p"),Vs=i("The abstract from the paper is the following:"),Go=d(),tt=o("p"),St=o("em"),Js=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.`),Yo=d(),ot=o("p"),Gs=i("Tips:"),Xo=d(),x=o("ul"),Lt=o("li"),Dt=o("p"),Ys=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.`),Xs=d(),Wt=o("li"),an=o("p"),Ks=i("CANINE uses a max sequence length of 2048 characters by default. One can use "),st=o("a"),Zs=i("CanineTokenizer"),ea=i(`
to prepare text for the model.`),na=d(),Bt=o("li"),Qt=o("p"),ta=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.`),oa=d(),Ht=o("li"),Ut=o("p"),sa=i("Models:"),aa=d(),Rt=o("li"),at=o("p"),rn=o("a"),ra=i("google/canine-c"),ia=i(`: Pre-trained with autoregressive character loss,
12-layer, 768-hidden, 12-heads, 121M parameters (size ~500 MB).`),la=d(),Vt=o("li"),rt=o("p"),ln=o("a"),ca=i("google/canine-s"),da=i(`: Pre-trained with subword loss, 12-layer,
768-hidden, 12-heads, 121M parameters (size ~500 MB).`),Ko=d(),J=o("p"),pa=i("This model was contributed by "),cn=o("a"),ha=i("nielsr"),ma=i(". The original code can be found "),dn=o("a"),ua=i("here"),fa=i("."),Zo=d(),ee=o("h3"),$e=o("a"),Jt=o("span"),w(pn.$$.fragment),ga=d(),Gt=o("span"),_a=i("Example"),es=d(),it=o("p"),ka=i("CANINE works on raw characters, so it can be used without a tokenizer:"),ns=d(),w(hn.$$.fragment),ts=d(),lt=o("p"),ba=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):`),os=d(),w(mn.$$.fragment),ss=d(),ne=o("h2"),ye=o("a"),Yt=o("span"),w(un.$$.fragment),wa=d(),Xt=o("span"),va=i("CANINE specific outputs"),as=d(),te=o("div"),w(fn.$$.fragment),Ca=d(),P=o("p"),$a=i("Output type of "),ct=o("a"),ya=i("CanineModel"),Ta=i(". Based on "),dt=o("a"),qa=i("BaseModelOutputWithPooling"),za=i(`, but with slightly
different `),Kt=o("code"),Ea=i("hidden_states"),xa=i(" and "),Zt=o("code"),ja=i("attentions"),Fa=i(`, as these also include the hidden states and attentions of the shallow
Transformer encoders.`),rs=d(),oe=o("h2"),Te=o("a"),eo=o("span"),w(gn.$$.fragment),Aa=d(),no=o("span"),Ma=i("CanineConfig"),is=d(),N=o("div"),w(_n.$$.fragment),Pa=d(),se=o("p"),Na=i("This is the configuration class to store the configuration of a "),pt=o("a"),Ia=i("CanineModel"),Oa=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
`),kn=o("a"),Sa=i("google/canine-s"),La=i(" architecture."),Da=d(),ae=o("p"),Wa=i("Configuration objects inherit from "),ht=o("a"),Ba=i("PretrainedConfig"),Qa=i(` and can be used to control the model outputs. Read the
documentation from `),mt=o("a"),Ha=i("PretrainedConfig"),Ua=i(" for more information."),Ra=d(),w(qe.$$.fragment),ls=d(),re=o("h2"),ze=o("a"),to=o("span"),w(bn.$$.fragment),Va=d(),oo=o("span"),Ja=i("CanineTokenizer"),cs=d(),E=o("div"),w(wn.$$.fragment),Ga=d(),so=o("p"),Ya=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.`),Xa=d(),Ee=o("p"),ut=o("a"),Ka=i("CanineTokenizer"),Za=i(" inherits from "),ft=o("a"),er=i("PreTrainedTokenizer"),nr=i("."),tr=d(),vn=o("p"),or=i("Refer to superclass "),gt=o("a"),sr=i("PreTrainedTokenizer"),ar=i(" for usage examples and documentation concerning parameters."),rr=d(),G=o("div"),w(Cn.$$.fragment),ir=d(),ao=o("p"),lr=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:`),cr=d(),$n=o("ul"),_t=o("li"),dr=i("single sequence: "),ro=o("code"),pr=i("[CLS] X [SEP]"),hr=d(),kt=o("li"),mr=i("pair of sequences: "),io=o("code"),ur=i("[CLS] A [SEP] B [SEP]"),fr=d(),xe=o("div"),w(yn.$$.fragment),gr=d(),Tn=o("p"),_r=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 `),lo=o("code"),kr=i("prepare_for_model"),br=i(" method."),wr=d(),D=o("div"),w(qn.$$.fragment),vr=d(),co=o("p"),Cr=i("Create a mask from the two sequences passed to be used in a sequence-pair classification task. A CANINE"),$r=d(),w(je.$$.fragment),yr=d(),ie=o("p"),Tr=i("If "),po=o("code"),qr=i("token_ids_1"),zr=i(" is "),ho=o("code"),Er=i("None"),xr=i(", this method only returns the first portion of the mask (0s)."),ds=d(),le=o("h2"),Fe=o("a"),mo=o("span"),w(zn.$$.fragment),jr=d(),uo=o("span"),Fr=i("CanineModel"),ps=d(),U=o("div"),w(En.$$.fragment),Ar=d(),xn=o("p"),Mr=i(`The bare CANINE Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),jn=o("a"),Pr=i("torch.nn.Module"),Nr=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.`),Ir=d(),W=o("div"),w(Fn.$$.fragment),Or=d(),ce=o("p"),Sr=i("The "),bt=o("a"),Lr=i("CanineModel"),Dr=i(" forward method, overrides the "),fo=o("code"),Wr=i("__call__"),Br=i(" special method."),Qr=d(),w(Ae.$$.fragment),Hr=d(),w(Me.$$.fragment),hs=d(),de=o("h2"),Pe=o("a"),go=o("span"),w(An.$$.fragment),Ur=d(),_o=o("span"),Rr=i("CanineForSequenceClassification"),ms=d(),I=o("div"),w(Mn.$$.fragment),Vr=d(),ko=o("p"),Jr=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.`),Gr=d(),Pn=o("p"),Yr=i("This model is a PyTorch "),Nn=o("a"),Xr=i("torch.nn.Module"),Kr=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.`),Zr=d(),F=o("div"),w(In.$$.fragment),ei=d(),pe=o("p"),ni=i("The "),wt=o("a"),ti=i("CanineForSequenceClassification"),oi=i(" forward method, overrides the "),bo=o("code"),si=i("__call__"),ai=i(" special method."),ri=d(),w(Ne.$$.fragment),ii=d(),w(Ie.$$.fragment),li=d(),w(Oe.$$.fragment),us=d(),he=o("h2"),Se=o("a"),wo=o("span"),w(On.$$.fragment),ci=d(),vo=o("span"),di=i("CanineForMultipleChoice"),fs=d(),O=o("div"),w(Sn.$$.fragment),pi=d(),Co=o("p"),hi=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.`),mi=d(),Ln=o("p"),ui=i("This model is a PyTorch "),Dn=o("a"),fi=i("torch.nn.Module"),gi=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.`),_i=d(),B=o("div"),w(Wn.$$.fragment),ki=d(),me=o("p"),bi=i("The "),vt=o("a"),wi=i("CanineForMultipleChoice"),vi=i(" forward method, overrides the "),$o=o("code"),Ci=i("__call__"),$i=i(" special method."),yi=d(),w(Le.$$.fragment),Ti=d(),w(De.$$.fragment),gs=d(),ue=o("h2"),We=o("a"),yo=o("span"),w(Bn.$$.fragment),qi=d(),To=o("span"),zi=i("CanineForTokenClassification"),_s=d(),S=o("div"),w(Qn.$$.fragment),Ei=d(),qo=o("p"),xi=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.`),ji=d(),Hn=o("p"),Fi=i("This model is a PyTorch "),Un=o("a"),Ai=i("torch.nn.Module"),Mi=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.`),Pi=d(),A=o("div"),w(Rn.$$.fragment),Ni=d(),fe=o("p"),Ii=i("The "),Ct=o("a"),Oi=i("CanineForTokenClassification"),Si=i(" forward method, overrides the "),zo=o("code"),Li=i("__call__"),Di=i(" special method."),Wi=d(),w(Be.$$.fragment),Bi=d(),w(Qe.$$.fragment),Qi=d(),w(He.$$.fragment),ks=d(),ge=o("h2"),Ue=o("a"),Eo=o("span"),w(Vn.$$.fragment),Hi=d(),xo=o("span"),Ui=i("CanineForQuestionAnswering"),bs=d(),L=o("div"),w(Jn.$$.fragment),Ri=d(),_e=o("p"),Vi=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 `),jo=o("code"),Ji=i("span start logits"),Gi=i(" and "),Fo=o("code"),Yi=i("span end logits"),Xi=i(")."),Ki=d(),Gn=o("p"),Zi=i("This model is a PyTorch "),Yn=o("a"),el=i("torch.nn.Module"),nl=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.`),tl=d(),Q=o("div"),w(Xn.$$.fragment),ol=d(),ke=o("p"),sl=i("The "),$t=o("a"),al=i("CanineForQuestionAnswering"),rl=i(" forward method, overrides the "),Ao=o("code"),il=i("__call__"),ll=i(" special method."),cl=d(),w(Re.$$.fragment),dl=d(),w(Ve.$$.fragment),this.h()},l(n){const f=Rc('[data-svelte="svelte-1phssyn"]',document.head);c=s(f,"META",{name:!0,content:!0}),f.forEach(t),b=p(n),g=s(n,"H1",{class:!0});var Kn=r(g);m=s(Kn,"A",{id:!0,class:!0,href:!0});var Mo=r(m);k=s(Mo,"SPAN",{});var Po=r(k);v(a.$$.fragment,Po),Po.forEach(t),Mo.forEach(t),u=p(Kn),z=s(Kn,"SPAN",{});var No=r(z);Ws=l(No,"CANINE"),No.forEach(t),Kn.forEach(t),Ro=p(n),Z=s(n,"H2",{class:!0});var Zn=r(Z);ve=s(Zn,"A",{id:!0,class:!0,href:!0});var Io=r(ve);It=s(Io,"SPAN",{});var Oo=r(It);v(on.$$.fragment,Oo),Oo.forEach(t),Io.forEach(t),Bs=p(Zn),Ot=s(Zn,"SPAN",{});var So=r(Ot);Qs=l(So,"Overview"),So.forEach(t),Zn.forEach(t),Vo=p(n),Ce=s(n,"P",{});var et=r(Ce);Hs=l(et,"The CANINE model was proposed in "),sn=s(et,"A",{href:!0,rel:!0});var Lo=r(sn);Us=l(Lo,`CANINE: Pre-training an Efficient Tokenization-Free Encoder for Language
Representation`),Lo.forEach(t),Rs=l(et,` 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.`),et.forEach(t),Jo=p(n),nt=s(n,"P",{});var Do=r(nt);Vs=l(Do,"The abstract from the paper is the following:"),Do.forEach(t),Go=p(n),tt=s(n,"P",{});var Wo=r(tt);St=s(Wo,"EM",{});var Bo=r(St);Js=l(Bo,`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.`),Bo.forEach(t),Wo.forEach(t),Yo=p(n),ot=s(n,"P",{});var Qo=r(ot);Gs=l(Qo,"Tips:"),Qo.forEach(t),Xo=p(n),x=s(n,"UL",{});var H=r(x);Lt=s(H,"LI",{});var fl=r(Lt);Dt=s(fl,"P",{});var gl=r(Dt);Ys=l(gl,`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.`),gl.forEach(t),fl.forEach(t),Xs=p(H),Wt=s(H,"LI",{});var _l=r(Wt);an=s(_l,"P",{});var vs=r(an);Ks=l(vs,"CANINE uses a max sequence length of 2048 characters by default. One can use "),st=s(vs,"A",{href:!0});var kl=r(st);Zs=l(kl,"CanineTokenizer"),kl.forEach(t),ea=l(vs,`
to prepare text for the model.`),vs.forEach(t),_l.forEach(t),na=p(H),Bt=s(H,"LI",{});var bl=r(Bt);Qt=s(bl,"P",{});var wl=r(Qt);ta=l(wl,`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.`),wl.forEach(t),bl.forEach(t),oa=p(H),Ht=s(H,"LI",{});var vl=r(Ht);Ut=s(vl,"P",{});var Cl=r(Ut);sa=l(Cl,"Models:"),Cl.forEach(t),vl.forEach(t),aa=p(H),Rt=s(H,"LI",{});var $l=r(Rt);at=s($l,"P",{});var pl=r(at);rn=s(pl,"A",{href:!0,rel:!0});var yl=r(rn);ra=l(yl,"google/canine-c"),yl.forEach(t),ia=l(pl,`: Pre-trained with autoregressive character loss,
12-layer, 768-hidden, 12-heads, 121M parameters (size ~500 MB).`),pl.forEach(t),$l.forEach(t),la=p(H),Vt=s(H,"LI",{});var Tl=r(Vt);rt=s(Tl,"P",{});var hl=r(rt);ln=s(hl,"A",{href:!0,rel:!0});var ql=r(ln);ca=l(ql,"google/canine-s"),ql.forEach(t),da=l(hl,`: Pre-trained with subword loss, 12-layer,
768-hidden, 12-heads, 121M parameters (size ~500 MB).`),hl.forEach(t),Tl.forEach(t),H.forEach(t),Ko=p(n),J=s(n,"P",{});var yt=r(J);pa=l(yt,"This model was contributed by "),cn=s(yt,"A",{href:!0,rel:!0});var zl=r(cn);ha=l(zl,"nielsr"),zl.forEach(t),ma=l(yt,". The original code can be found "),dn=s(yt,"A",{href:!0,rel:!0});var El=r(dn);ua=l(El,"here"),El.forEach(t),fa=l(yt,"."),yt.forEach(t),Zo=p(n),ee=s(n,"H3",{class:!0});var Cs=r(ee);$e=s(Cs,"A",{id:!0,class:!0,href:!0});var xl=r($e);Jt=s(xl,"SPAN",{});var jl=r(Jt);v(pn.$$.fragment,jl),jl.forEach(t),xl.forEach(t),ga=p(Cs),Gt=s(Cs,"SPAN",{});var Fl=r(Gt);_a=l(Fl,"Example"),Fl.forEach(t),Cs.forEach(t),es=p(n),it=s(n,"P",{});var Al=r(it);ka=l(Al,"CANINE works on raw characters, so it can be used without a tokenizer:"),Al.forEach(t),ns=p(n),v(hn.$$.fragment,n),ts=p(n),lt=s(n,"P",{});var Ml=r(lt);ba=l(Ml,`For batched inference and training, it is however recommended to make use of the tokenizer (to pad/truncate all
sequences to the same length):`),Ml.forEach(t),os=p(n),v(mn.$$.fragment,n),ss=p(n),ne=s(n,"H2",{class:!0});var $s=r(ne);ye=s($s,"A",{id:!0,class:!0,href:!0});var Pl=r(ye);Yt=s(Pl,"SPAN",{});var Nl=r(Yt);v(un.$$.fragment,Nl),Nl.forEach(t),Pl.forEach(t),wa=p($s),Xt=s($s,"SPAN",{});var Il=r(Xt);va=l(Il,"CANINE specific outputs"),Il.forEach(t),$s.forEach(t),as=p(n),te=s(n,"DIV",{class:!0});var ys=r(te);v(fn.$$.fragment,ys),Ca=p(ys),P=s(ys,"P",{});var Y=r(P);$a=l(Y,"Output type of "),ct=s(Y,"A",{href:!0});var Ol=r(ct);ya=l(Ol,"CanineModel"),Ol.forEach(t),Ta=l(Y,". Based on "),dt=s(Y,"A",{href:!0});var Sl=r(dt);qa=l(Sl,"BaseModelOutputWithPooling"),Sl.forEach(t),za=l(Y,`, but with slightly
different `),Kt=s(Y,"CODE",{});var Ll=r(Kt);Ea=l(Ll,"hidden_states"),Ll.forEach(t),xa=l(Y," and "),Zt=s(Y,"CODE",{});var Dl=r(Zt);ja=l(Dl,"attentions"),Dl.forEach(t),Fa=l(Y,`, as these also include the hidden states and attentions of the shallow
Transformer encoders.`),Y.forEach(t),ys.forEach(t),rs=p(n),oe=s(n,"H2",{class:!0});var Ts=r(oe);Te=s(Ts,"A",{id:!0,class:!0,href:!0});var Wl=r(Te);eo=s(Wl,"SPAN",{});var Bl=r(eo);v(gn.$$.fragment,Bl),Bl.forEach(t),Wl.forEach(t),Aa=p(Ts),no=s(Ts,"SPAN",{});var Ql=r(no);Ma=l(Ql,"CanineConfig"),Ql.forEach(t),Ts.forEach(t),is=p(n),N=s(n,"DIV",{class:!0});var Je=r(N);v(_n.$$.fragment,Je),Pa=p(Je),se=s(Je,"P",{});var Tt=r(se);Na=l(Tt,"This is the configuration class to store the configuration of a "),pt=s(Tt,"A",{href:!0});var Hl=r(pt);Ia=l(Hl,"CanineModel"),Hl.forEach(t),Oa=l(Tt,`. 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
`),kn=s(Tt,"A",{href:!0,rel:!0});var Ul=r(kn);Sa=l(Ul,"google/canine-s"),Ul.forEach(t),La=l(Tt," architecture."),Tt.forEach(t),Da=p(Je),ae=s(Je,"P",{});var qt=r(ae);Wa=l(qt,"Configuration objects inherit from "),ht=s(qt,"A",{href:!0});var Rl=r(ht);Ba=l(Rl,"PretrainedConfig"),Rl.forEach(t),Qa=l(qt,` and can be used to control the model outputs. Read the
documentation from `),mt=s(qt,"A",{href:!0});var Vl=r(mt);Ha=l(Vl,"PretrainedConfig"),Vl.forEach(t),Ua=l(qt," for more information."),qt.forEach(t),Ra=p(Je),v(qe.$$.fragment,Je),Je.forEach(t),ls=p(n),re=s(n,"H2",{class:!0});var qs=r(re);ze=s(qs,"A",{id:!0,class:!0,href:!0});var Jl=r(ze);to=s(Jl,"SPAN",{});var Gl=r(to);v(bn.$$.fragment,Gl),Gl.forEach(t),Jl.forEach(t),Va=p(qs),oo=s(qs,"SPAN",{});var Yl=r(oo);Ja=l(Yl,"CanineTokenizer"),Yl.forEach(t),qs.forEach(t),cs=p(n),E=s(n,"DIV",{class:!0});var M=r(E);v(wn.$$.fragment,M),Ga=p(M),so=s(M,"P",{});var Xl=r(so);Ya=l(Xl,`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.`),Xl.forEach(t),Xa=p(M),Ee=s(M,"P",{});var Ho=r(Ee);ut=s(Ho,"A",{href:!0});var Kl=r(ut);Ka=l(Kl,"CanineTokenizer"),Kl.forEach(t),Za=l(Ho," inherits from "),ft=s(Ho,"A",{href:!0});var Zl=r(ft);er=l(Zl,"PreTrainedTokenizer"),Zl.forEach(t),nr=l(Ho,"."),Ho.forEach(t),tr=p(M),vn=s(M,"P",{});var zs=r(vn);or=l(zs,"Refer to superclass "),gt=s(zs,"A",{href:!0});var ec=r(gt);sr=l(ec,"PreTrainedTokenizer"),ec.forEach(t),ar=l(zs," for usage examples and documentation concerning parameters."),zs.forEach(t),rr=p(M),G=s(M,"DIV",{class:!0});var zt=r(G);v(Cn.$$.fragment,zt),ir=p(zt),ao=s(zt,"P",{});var nc=r(ao);lr=l(nc,`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:`),nc.forEach(t),cr=p(zt),$n=s(zt,"UL",{});var Es=r($n);_t=s(Es,"LI",{});var ml=r(_t);dr=l(ml,"single sequence: "),ro=s(ml,"CODE",{});var tc=r(ro);pr=l(tc,"[CLS] X [SEP]"),tc.forEach(t),ml.forEach(t),hr=p(Es),kt=s(Es,"LI",{});var ul=r(kt);mr=l(ul,"pair of sequences: "),io=s(ul,"CODE",{});var oc=r(io);ur=l(oc,"[CLS] A [SEP] B [SEP]"),oc.forEach(t),ul.forEach(t),Es.forEach(t),zt.forEach(t),fr=p(M),xe=s(M,"DIV",{class:!0});var xs=r(xe);v(yn.$$.fragment,xs),gr=p(xs),Tn=s(xs,"P",{});var js=r(Tn);_r=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 `),lo=s(js,"CODE",{});var sc=r(lo);kr=l(sc,"prepare_for_model"),sc.forEach(t),br=l(js," method."),js.forEach(t),xs.forEach(t),wr=p(M),D=s(M,"DIV",{class:!0});var Ge=r(D);v(qn.$$.fragment,Ge),vr=p(Ge),co=s(Ge,"P",{});var ac=r(co);Cr=l(ac,"Create a mask from the two sequences passed to be used in a sequence-pair classification task. A CANINE"),ac.forEach(t),$r=p(Ge),v(je.$$.fragment,Ge),yr=p(Ge),ie=s(Ge,"P",{});var Et=r(ie);Tr=l(Et,"If "),po=s(Et,"CODE",{});var rc=r(po);qr=l(rc,"token_ids_1"),rc.forEach(t),zr=l(Et," is "),ho=s(Et,"CODE",{});var ic=r(ho);Er=l(ic,"None"),ic.forEach(t),xr=l(Et,", this method only returns the first portion of the mask (0s)."),Et.forEach(t),Ge.forEach(t),M.forEach(t),ds=p(n),le=s(n,"H2",{class:!0});var Fs=r(le);Fe=s(Fs,"A",{id:!0,class:!0,href:!0});var lc=r(Fe);mo=s(lc,"SPAN",{});var cc=r(mo);v(zn.$$.fragment,cc),cc.forEach(t),lc.forEach(t),jr=p(Fs),uo=s(Fs,"SPAN",{});var dc=r(uo);Fr=l(dc,"CanineModel"),dc.forEach(t),Fs.forEach(t),ps=p(n),U=s(n,"DIV",{class:!0});var xt=r(U);v(En.$$.fragment,xt),Ar=p(xt),xn=s(xt,"P",{});var As=r(xn);Mr=l(As,`The bare CANINE Model transformer outputting raw hidden-states without any specific head on top.
This model is a PyTorch `),jn=s(As,"A",{href:!0,rel:!0});var pc=r(jn);Pr=l(pc,"torch.nn.Module"),pc.forEach(t),Nr=l(As,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),As.forEach(t),Ir=p(xt),W=s(xt,"DIV",{class:!0});var Ye=r(W);v(Fn.$$.fragment,Ye),Or=p(Ye),ce=s(Ye,"P",{});var jt=r(ce);Sr=l(jt,"The "),bt=s(jt,"A",{href:!0});var hc=r(bt);Lr=l(hc,"CanineModel"),hc.forEach(t),Dr=l(jt," forward method, overrides the "),fo=s(jt,"CODE",{});var mc=r(fo);Wr=l(mc,"__call__"),mc.forEach(t),Br=l(jt," special method."),jt.forEach(t),Qr=p(Ye),v(Ae.$$.fragment,Ye),Hr=p(Ye),v(Me.$$.fragment,Ye),Ye.forEach(t),xt.forEach(t),hs=p(n),de=s(n,"H2",{class:!0});var Ms=r(de);Pe=s(Ms,"A",{id:!0,class:!0,href:!0});var uc=r(Pe);go=s(uc,"SPAN",{});var fc=r(go);v(An.$$.fragment,fc),fc.forEach(t),uc.forEach(t),Ur=p(Ms),_o=s(Ms,"SPAN",{});var gc=r(_o);Rr=l(gc,"CanineForSequenceClassification"),gc.forEach(t),Ms.forEach(t),ms=p(n),I=s(n,"DIV",{class:!0});var Xe=r(I);v(Mn.$$.fragment,Xe),Vr=p(Xe),ko=s(Xe,"P",{});var _c=r(ko);Jr=l(_c,`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.`),_c.forEach(t),Gr=p(Xe),Pn=s(Xe,"P",{});var Ps=r(Pn);Yr=l(Ps,"This model is a PyTorch "),Nn=s(Ps,"A",{href:!0,rel:!0});var kc=r(Nn);Xr=l(kc,"torch.nn.Module"),kc.forEach(t),Kr=l(Ps,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ps.forEach(t),Zr=p(Xe),F=s(Xe,"DIV",{class:!0});var X=r(F);v(In.$$.fragment,X),ei=p(X),pe=s(X,"P",{});var Ft=r(pe);ni=l(Ft,"The "),wt=s(Ft,"A",{href:!0});var bc=r(wt);ti=l(bc,"CanineForSequenceClassification"),bc.forEach(t),oi=l(Ft," forward method, overrides the "),bo=s(Ft,"CODE",{});var wc=r(bo);si=l(wc,"__call__"),wc.forEach(t),ai=l(Ft," special method."),Ft.forEach(t),ri=p(X),v(Ne.$$.fragment,X),ii=p(X),v(Ie.$$.fragment,X),li=p(X),v(Oe.$$.fragment,X),X.forEach(t),Xe.forEach(t),us=p(n),he=s(n,"H2",{class:!0});var Ns=r(he);Se=s(Ns,"A",{id:!0,class:!0,href:!0});var vc=r(Se);wo=s(vc,"SPAN",{});var Cc=r(wo);v(On.$$.fragment,Cc),Cc.forEach(t),vc.forEach(t),ci=p(Ns),vo=s(Ns,"SPAN",{});var $c=r(vo);di=l($c,"CanineForMultipleChoice"),$c.forEach(t),Ns.forEach(t),fs=p(n),O=s(n,"DIV",{class:!0});var Ke=r(O);v(Sn.$$.fragment,Ke),pi=p(Ke),Co=s(Ke,"P",{});var yc=r(Co);hi=l(yc,`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.`),yc.forEach(t),mi=p(Ke),Ln=s(Ke,"P",{});var Is=r(Ln);ui=l(Is,"This model is a PyTorch "),Dn=s(Is,"A",{href:!0,rel:!0});var Tc=r(Dn);fi=l(Tc,"torch.nn.Module"),Tc.forEach(t),gi=l(Is,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Is.forEach(t),_i=p(Ke),B=s(Ke,"DIV",{class:!0});var Ze=r(B);v(Wn.$$.fragment,Ze),ki=p(Ze),me=s(Ze,"P",{});var At=r(me);bi=l(At,"The "),vt=s(At,"A",{href:!0});var qc=r(vt);wi=l(qc,"CanineForMultipleChoice"),qc.forEach(t),vi=l(At," forward method, overrides the "),$o=s(At,"CODE",{});var zc=r($o);Ci=l(zc,"__call__"),zc.forEach(t),$i=l(At," special method."),At.forEach(t),yi=p(Ze),v(Le.$$.fragment,Ze),Ti=p(Ze),v(De.$$.fragment,Ze),Ze.forEach(t),Ke.forEach(t),gs=p(n),ue=s(n,"H2",{class:!0});var Os=r(ue);We=s(Os,"A",{id:!0,class:!0,href:!0});var Ec=r(We);yo=s(Ec,"SPAN",{});var xc=r(yo);v(Bn.$$.fragment,xc),xc.forEach(t),Ec.forEach(t),qi=p(Os),To=s(Os,"SPAN",{});var jc=r(To);zi=l(jc,"CanineForTokenClassification"),jc.forEach(t),Os.forEach(t),_s=p(n),S=s(n,"DIV",{class:!0});var en=r(S);v(Qn.$$.fragment,en),Ei=p(en),qo=s(en,"P",{});var Fc=r(qo);xi=l(Fc,`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.`),Fc.forEach(t),ji=p(en),Hn=s(en,"P",{});var Ss=r(Hn);Fi=l(Ss,"This model is a PyTorch "),Un=s(Ss,"A",{href:!0,rel:!0});var Ac=r(Un);Ai=l(Ac,"torch.nn.Module"),Ac.forEach(t),Mi=l(Ss,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ss.forEach(t),Pi=p(en),A=s(en,"DIV",{class:!0});var K=r(A);v(Rn.$$.fragment,K),Ni=p(K),fe=s(K,"P",{});var Mt=r(fe);Ii=l(Mt,"The "),Ct=s(Mt,"A",{href:!0});var Mc=r(Ct);Oi=l(Mc,"CanineForTokenClassification"),Mc.forEach(t),Si=l(Mt," forward method, overrides the "),zo=s(Mt,"CODE",{});var Pc=r(zo);Li=l(Pc,"__call__"),Pc.forEach(t),Di=l(Mt," special method."),Mt.forEach(t),Wi=p(K),v(Be.$$.fragment,K),Bi=p(K),v(Qe.$$.fragment,K),Qi=p(K),v(He.$$.fragment,K),K.forEach(t),en.forEach(t),ks=p(n),ge=s(n,"H2",{class:!0});var Ls=r(ge);Ue=s(Ls,"A",{id:!0,class:!0,href:!0});var Nc=r(Ue);Eo=s(Nc,"SPAN",{});var Ic=r(Eo);v(Vn.$$.fragment,Ic),Ic.forEach(t),Nc.forEach(t),Hi=p(Ls),xo=s(Ls,"SPAN",{});var Oc=r(xo);Ui=l(Oc,"CanineForQuestionAnswering"),Oc.forEach(t),Ls.forEach(t),bs=p(n),L=s(n,"DIV",{class:!0});var nn=r(L);v(Jn.$$.fragment,nn),Ri=p(nn),_e=s(nn,"P",{});var Pt=r(_e);Vi=l(Pt,`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 `),jo=s(Pt,"CODE",{});var Sc=r(jo);Ji=l(Sc,"span start logits"),Sc.forEach(t),Gi=l(Pt," and "),Fo=s(Pt,"CODE",{});var Lc=r(Fo);Yi=l(Lc,"span end logits"),Lc.forEach(t),Xi=l(Pt,")."),Pt.forEach(t),Ki=p(nn),Gn=s(nn,"P",{});var Ds=r(Gn);Zi=l(Ds,"This model is a PyTorch "),Yn=s(Ds,"A",{href:!0,rel:!0});var Dc=r(Yn);el=l(Dc,"torch.nn.Module"),Dc.forEach(t),nl=l(Ds,` sub-class. Use
it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and
behavior.`),Ds.forEach(t),tl=p(nn),Q=s(nn,"DIV",{class:!0});var tn=r(Q);v(Xn.$$.fragment,tn),ol=p(tn),ke=s(tn,"P",{});var Nt=r(ke);sl=l(Nt,"The "),$t=s(Nt,"A",{href:!0});var Wc=r($t);al=l(Wc,"CanineForQuestionAnswering"),Wc.forEach(t),rl=l(Nt," forward method, overrides the "),Ao=s(Nt,"CODE",{});var Bc=r(Ao);il=l(Bc,"__call__"),Bc.forEach(t),ll=l(Nt," special method."),Nt.forEach(t),cl=p(tn),v(Re.$$.fragment,tn),dl=p(tn),v(Ve.$$.fragment,tn),tn.forEach(t),nn.forEach(t),this.h()},h(){h(c,"name","hf:doc:metadata"),h(c,"content",JSON.stringify(cd)),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(ve,"id","overview"),h(ve,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(ve,"href","#overview"),h(Z,"class","relative group"),h(sn,"href","https://arxiv.org/abs/2103.06874"),h(sn,"rel","nofollow"),h(st,"href","/docs/transformers/main/en/model_doc/canine#transformers.CanineTokenizer"),h(rn,"href","https://huggingface.co/google/canine-c"),h(rn,"rel","nofollow"),h(ln,"href","https://huggingface.co/google/canine-s"),h(ln,"rel","nofollow"),h(cn,"href","https://huggingface.co/nielsr"),h(cn,"rel","nofollow"),h(dn,"href","https://github.com/google-research/language/tree/master/language/canine"),h(dn,"rel","nofollow"),h($e,"id","example"),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","#example"),h(ee,"class","relative group"),h(ye,"id","transformers.models.canine.modeling_canine.CanineModelOutputWithPooling"),h(ye,"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(ye,"href","#transformers.models.canine.modeling_canine.CanineModelOutputWithPooling"),h(ne,"class","relative group"),h(ct,"href","/docs/transformers/main/en/model_doc/canine#transformers.CanineModel"),h(dt,"href","/docs/transformers/main/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"),h(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Te,"id","transformers.CanineConfig"),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","#transformers.CanineConfig"),h(oe,"class","relative group"),h(pt,"href","/docs/transformers/main/en/model_doc/canine#transformers.CanineModel"),h(kn,"href","https://huggingface.co/google/canine-s"),h(kn,"rel","nofollow"),h(ht,"href","/docs/transformers/main/en/main_classes/configuration#transformers.PretrainedConfig"),h(mt,"href","/docs/transformers/main/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(ze,"id","transformers.CanineTokenizer"),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.CanineTokenizer"),h(re,"class","relative group"),h(ut,"href","/docs/transformers/main/en/model_doc/canine#transformers.CanineTokenizer"),h(ft,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),h(gt,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),h(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(Fe,"id","transformers.CanineModel"),h(Fe,"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(Fe,"href","#transformers.CanineModel"),h(le,"class","relative group"),h(jn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(jn,"rel","nofollow"),h(bt,"href","/docs/transformers/main/en/model_doc/canine#transformers.CanineModel"),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(U,"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.CanineForSequenceClassification"),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.CanineForSequenceClassification"),h(de,"class","relative group"),h(Nn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Nn,"rel","nofollow"),h(wt,"href","/docs/transformers/main/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(Se,"id","transformers.CanineForMultipleChoice"),h(Se,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Se,"href","#transformers.CanineForMultipleChoice"),h(he,"class","relative group"),h(Dn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Dn,"rel","nofollow"),h(vt,"href","/docs/transformers/main/en/model_doc/canine#transformers.CanineForMultipleChoice"),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(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(We,"id","transformers.CanineForTokenClassification"),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.CanineForTokenClassification"),h(ue,"class","relative group"),h(Un,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Un,"rel","nofollow"),h(Ct,"href","/docs/transformers/main/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(Ue,"id","transformers.CanineForQuestionAnswering"),h(Ue,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(Ue,"href","#transformers.CanineForQuestionAnswering"),h(ge,"class","relative group"),h(Yn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),h(Yn,"rel","nofollow"),h($t,"href","/docs/transformers/main/en/model_doc/canine#transformers.CanineForQuestionAnswering"),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(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,b,f),_(n,g,f),e(g,m),e(m,k),C(a,k,null),e(g,u),e(g,z),e(z,Ws),_(n,Ro,f),_(n,Z,f),e(Z,ve),e(ve,It),C(on,It,null),e(Z,Bs),e(Z,Ot),e(Ot,Qs),_(n,Vo,f),_(n,Ce,f),e(Ce,Hs),e(Ce,sn),e(sn,Us),e(Ce,Rs),_(n,Jo,f),_(n,nt,f),e(nt,Vs),_(n,Go,f),_(n,tt,f),e(tt,St),e(St,Js),_(n,Yo,f),_(n,ot,f),e(ot,Gs),_(n,Xo,f),_(n,x,f),e(x,Lt),e(Lt,Dt),e(Dt,Ys),e(x,Xs),e(x,Wt),e(Wt,an),e(an,Ks),e(an,st),e(st,Zs),e(an,ea),e(x,na),e(x,Bt),e(Bt,Qt),e(Qt,ta),e(x,oa),e(x,Ht),e(Ht,Ut),e(Ut,sa),e(x,aa),e(x,Rt),e(Rt,at),e(at,rn),e(rn,ra),e(at,ia),e(x,la),e(x,Vt),e(Vt,rt),e(rt,ln),e(ln,ca),e(rt,da),_(n,Ko,f),_(n,J,f),e(J,pa),e(J,cn),e(cn,ha),e(J,ma),e(J,dn),e(dn,ua),e(J,fa),_(n,Zo,f),_(n,ee,f),e(ee,$e),e($e,Jt),C(pn,Jt,null),e(ee,ga),e(ee,Gt),e(Gt,_a),_(n,es,f),_(n,it,f),e(it,ka),_(n,ns,f),C(hn,n,f),_(n,ts,f),_(n,lt,f),e(lt,ba),_(n,os,f),C(mn,n,f),_(n,ss,f),_(n,ne,f),e(ne,ye),e(ye,Yt),C(un,Yt,null),e(ne,wa),e(ne,Xt),e(Xt,va),_(n,as,f),_(n,te,f),C(fn,te,null),e(te,Ca),e(te,P),e(P,$a),e(P,ct),e(ct,ya),e(P,Ta),e(P,dt),e(dt,qa),e(P,za),e(P,Kt),e(Kt,Ea),e(P,xa),e(P,Zt),e(Zt,ja),e(P,Fa),_(n,rs,f),_(n,oe,f),e(oe,Te),e(Te,eo),C(gn,eo,null),e(oe,Aa),e(oe,no),e(no,Ma),_(n,is,f),_(n,N,f),C(_n,N,null),e(N,Pa),e(N,se),e(se,Na),e(se,pt),e(pt,Ia),e(se,Oa),e(se,kn),e(kn,Sa),e(se,La),e(N,Da),e(N,ae),e(ae,Wa),e(ae,ht),e(ht,Ba),e(ae,Qa),e(ae,mt),e(mt,Ha),e(ae,Ua),e(N,Ra),C(qe,N,null),_(n,ls,f),_(n,re,f),e(re,ze),e(ze,to),C(bn,to,null),e(re,Va),e(re,oo),e(oo,Ja),_(n,cs,f),_(n,E,f),C(wn,E,null),e(E,Ga),e(E,so),e(so,Ya),e(E,Xa),e(E,Ee),e(Ee,ut),e(ut,Ka),e(Ee,Za),e(Ee,ft),e(ft,er),e(Ee,nr),e(E,tr),e(E,vn),e(vn,or),e(vn,gt),e(gt,sr),e(vn,ar),e(E,rr),e(E,G),C(Cn,G,null),e(G,ir),e(G,ao),e(ao,lr),e(G,cr),e(G,$n),e($n,_t),e(_t,dr),e(_t,ro),e(ro,pr),e($n,hr),e($n,kt),e(kt,mr),e(kt,io),e(io,ur),e(E,fr),e(E,xe),C(yn,xe,null),e(xe,gr),e(xe,Tn),e(Tn,_r),e(Tn,lo),e(lo,kr),e(Tn,br),e(E,wr),e(E,D),C(qn,D,null),e(D,vr),e(D,co),e(co,Cr),e(D,$r),C(je,D,null),e(D,yr),e(D,ie),e(ie,Tr),e(ie,po),e(po,qr),e(ie,zr),e(ie,ho),e(ho,Er),e(ie,xr),_(n,ds,f),_(n,le,f),e(le,Fe),e(Fe,mo),C(zn,mo,null),e(le,jr),e(le,uo),e(uo,Fr),_(n,ps,f),_(n,U,f),C(En,U,null),e(U,Ar),e(U,xn),e(xn,Mr),e(xn,jn),e(jn,Pr),e(xn,Nr),e(U,Ir),e(U,W),C(Fn,W,null),e(W,Or),e(W,ce),e(ce,Sr),e(ce,bt),e(bt,Lr),e(ce,Dr),e(ce,fo),e(fo,Wr),e(ce,Br),e(W,Qr),C(Ae,W,null),e(W,Hr),C(Me,W,null),_(n,hs,f),_(n,de,f),e(de,Pe),e(Pe,go),C(An,go,null),e(de,Ur),e(de,_o),e(_o,Rr),_(n,ms,f),_(n,I,f),C(Mn,I,null),e(I,Vr),e(I,ko),e(ko,Jr),e(I,Gr),e(I,Pn),e(Pn,Yr),e(Pn,Nn),e(Nn,Xr),e(Pn,Kr),e(I,Zr),e(I,F),C(In,F,null),e(F,ei),e(F,pe),e(pe,ni),e(pe,wt),e(wt,ti),e(pe,oi),e(pe,bo),e(bo,si),e(pe,ai),e(F,ri),C(Ne,F,null),e(F,ii),C(Ie,F,null),e(F,li),C(Oe,F,null),_(n,us,f),_(n,he,f),e(he,Se),e(Se,wo),C(On,wo,null),e(he,ci),e(he,vo),e(vo,di),_(n,fs,f),_(n,O,f),C(Sn,O,null),e(O,pi),e(O,Co),e(Co,hi),e(O,mi),e(O,Ln),e(Ln,ui),e(Ln,Dn),e(Dn,fi),e(Ln,gi),e(O,_i),e(O,B),C(Wn,B,null),e(B,ki),e(B,me),e(me,bi),e(me,vt),e(vt,wi),e(me,vi),e(me,$o),e($o,Ci),e(me,$i),e(B,yi),C(Le,B,null),e(B,Ti),C(De,B,null),_(n,gs,f),_(n,ue,f),e(ue,We),e(We,yo),C(Bn,yo,null),e(ue,qi),e(ue,To),e(To,zi),_(n,_s,f),_(n,S,f),C(Qn,S,null),e(S,Ei),e(S,qo),e(qo,xi),e(S,ji),e(S,Hn),e(Hn,Fi),e(Hn,Un),e(Un,Ai),e(Hn,Mi),e(S,Pi),e(S,A),C(Rn,A,null),e(A,Ni),e(A,fe),e(fe,Ii),e(fe,Ct),e(Ct,Oi),e(fe,Si),e(fe,zo),e(zo,Li),e(fe,Di),e(A,Wi),C(Be,A,null),e(A,Bi),C(Qe,A,null),e(A,Qi),C(He,A,null),_(n,ks,f),_(n,ge,f),e(ge,Ue),e(Ue,Eo),C(Vn,Eo,null),e(ge,Hi),e(ge,xo),e(xo,Ui),_(n,bs,f),_(n,L,f),C(Jn,L,null),e(L,Ri),e(L,_e),e(_e,Vi),e(_e,jo),e(jo,Ji),e(_e,Gi),e(_e,Fo),e(Fo,Yi),e(_e,Xi),e(L,Ki),e(L,Gn),e(Gn,Zi),e(Gn,Yn),e(Yn,el),e(Gn,nl),e(L,tl),e(L,Q),C(Xn,Q,null),e(Q,ol),e(Q,ke),e(ke,sl),e(ke,$t),e($t,al),e(ke,rl),e(ke,Ao),e(Ao,il),e(ke,ll),e(Q,cl),C(Re,Q,null),e(Q,dl),C(Ve,Q,null),ws=!0},p(n,[f]){const Kn={};f&2&&(Kn.$$scope={dirty:f,ctx:n}),qe.$set(Kn);const Mo={};f&2&&(Mo.$$scope={dirty:f,ctx:n}),je.$set(Mo);const Po={};f&2&&(Po.$$scope={dirty:f,ctx:n}),Ae.$set(Po);const No={};f&2&&(No.$$scope={dirty:f,ctx:n}),Me.$set(No);const Zn={};f&2&&(Zn.$$scope={dirty:f,ctx:n}),Ne.$set(Zn);const Io={};f&2&&(Io.$$scope={dirty:f,ctx:n}),Ie.$set(Io);const Oo={};f&2&&(Oo.$$scope={dirty:f,ctx:n}),Oe.$set(Oo);const So={};f&2&&(So.$$scope={dirty:f,ctx:n}),Le.$set(So);const et={};f&2&&(et.$$scope={dirty:f,ctx:n}),De.$set(et);const Lo={};f&2&&(Lo.$$scope={dirty:f,ctx:n}),Be.$set(Lo);const Do={};f&2&&(Do.$$scope={dirty:f,ctx:n}),Qe.$set(Do);const Wo={};f&2&&(Wo.$$scope={dirty:f,ctx:n}),He.$set(Wo);const Bo={};f&2&&(Bo.$$scope={dirty:f,ctx:n}),Re.$set(Bo);const Qo={};f&2&&(Qo.$$scope={dirty:f,ctx:n}),Ve.$set(Qo)},i(n){ws||($(a.$$.fragment,n),$(on.$$.fragment,n),$(pn.$$.fragment,n),$(hn.$$.fragment,n),$(mn.$$.fragment,n),$(un.$$.fragment,n),$(fn.$$.fragment,n),$(gn.$$.fragment,n),$(_n.$$.fragment,n),$(qe.$$.fragment,n),$(bn.$$.fragment,n),$(wn.$$.fragment,n),$(Cn.$$.fragment,n),$(yn.$$.fragment,n),$(qn.$$.fragment,n),$(je.$$.fragment,n),$(zn.$$.fragment,n),$(En.$$.fragment,n),$(Fn.$$.fragment,n),$(Ae.$$.fragment,n),$(Me.$$.fragment,n),$(An.$$.fragment,n),$(Mn.$$.fragment,n),$(In.$$.fragment,n),$(Ne.$$.fragment,n),$(Ie.$$.fragment,n),$(Oe.$$.fragment,n),$(On.$$.fragment,n),$(Sn.$$.fragment,n),$(Wn.$$.fragment,n),$(Le.$$.fragment,n),$(De.$$.fragment,n),$(Bn.$$.fragment,n),$(Qn.$$.fragment,n),$(Rn.$$.fragment,n),$(Be.$$.fragment,n),$(Qe.$$.fragment,n),$(He.$$.fragment,n),$(Vn.$$.fragment,n),$(Jn.$$.fragment,n),$(Xn.$$.fragment,n),$(Re.$$.fragment,n),$(Ve.$$.fragment,n),ws=!0)},o(n){y(a.$$.fragment,n),y(on.$$.fragment,n),y(pn.$$.fragment,n),y(hn.$$.fragment,n),y(mn.$$.fragment,n),y(un.$$.fragment,n),y(fn.$$.fragment,n),y(gn.$$.fragment,n),y(_n.$$.fragment,n),y(qe.$$.fragment,n),y(bn.$$.fragment,n),y(wn.$$.fragment,n),y(Cn.$$.fragment,n),y(yn.$$.fragment,n),y(qn.$$.fragment,n),y(je.$$.fragment,n),y(zn.$$.fragment,n),y(En.$$.fragment,n),y(Fn.$$.fragment,n),y(Ae.$$.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(Oe.$$.fragment,n),y(On.$$.fragment,n),y(Sn.$$.fragment,n),y(Wn.$$.fragment,n),y(Le.$$.fragment,n),y(De.$$.fragment,n),y(Bn.$$.fragment,n),y(Qn.$$.fragment,n),y(Rn.$$.fragment,n),y(Be.$$.fragment,n),y(Qe.$$.fragment,n),y(He.$$.fragment,n),y(Vn.$$.fragment,n),y(Jn.$$.fragment,n),y(Xn.$$.fragment,n),y(Re.$$.fragment,n),y(Ve.$$.fragment,n),ws=!1},d(n){t(c),n&&t(b),n&&t(g),T(a),n&&t(Ro),n&&t(Z),T(on),n&&t(Vo),n&&t(Ce),n&&t(Jo),n&&t(nt),n&&t(Go),n&&t(tt),n&&t(Yo),n&&t(ot),n&&t(Xo),n&&t(x),n&&t(Ko),n&&t(J),n&&t(Zo),n&&t(ee),T(pn),n&&t(es),n&&t(it),n&&t(ns),T(hn,n),n&&t(ts),n&&t(lt),n&&t(os),T(mn,n),n&&t(ss),n&&t(ne),T(un),n&&t(as),n&&t(te),T(fn),n&&t(rs),n&&t(oe),T(gn),n&&t(is),n&&t(N),T(_n),T(qe),n&&t(ls),n&&t(re),T(bn),n&&t(cs),n&&t(E),T(wn),T(Cn),T(yn),T(qn),T(je),n&&t(ds),n&&t(le),T(zn),n&&t(ps),n&&t(U),T(En),T(Fn),T(Ae),T(Me),n&&t(hs),n&&t(de),T(An),n&&t(ms),n&&t(I),T(Mn),T(In),T(Ne),T(Ie),T(Oe),n&&t(us),n&&t(he),T(On),n&&t(fs),n&&t(O),T(Sn),T(Wn),T(Le),T(De),n&&t(gs),n&&t(ue),T(Bn),n&&t(_s),n&&t(S),T(Qn),T(Rn),T(Be),T(Qe),T(He),n&&t(ks),n&&t(ge),T(Vn),n&&t(bs),n&&t(L),T(Jn),T(Xn),T(Re),T(Ve)}}}const cd={local:"canine",sections:[{local:"overview",sections:[{local:"example",title:"Example"}],title:"Overview"},{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 dd(q){return Vc(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _d extends Qc{constructor(c){super();Hc(this,c,dd,ld,Uc,{})}}export{_d as default,cd as metadata};
