import{S as jd,i as Jd,s as Ed,e as o,k as d,w,t as i,M as Ud,c as s,d as t,m as p,a,x as M,h as l,b as h,G as e,g as _,y as T,q as v,o as k,B as C,v as Id,L as Te}from"../../chunks/vendor-hf-doc-builder.js";import{T as rs}from"../../chunks/Tip-hf-doc-builder.js";import{D as U}from"../../chunks/Docstring-hf-doc-builder.js";import{C as Y}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Q}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Me}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function zd($){let c,y,g,m,b;return m=new Y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENhbmluZUNvbmZpZyUyQyUyMENhbmluZU1vZGVsJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMENBTklORSUyMGdvb2dsZSUyRmNhbmluZS1zJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMENhbmluZUNvbmZpZygpJTBBJTBBJTIzJTIwSW5pdGlhbGl6aW5nJTIwYSUyMG1vZGVsJTIwKHdpdGglMjByYW5kb20lMjB3ZWlnaHRzKSUyMGZyb20lMjB0aGUlMjBnb29nbGUlMkZjYW5pbmUtcyUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwQ2FuaW5lTW9kZWwoY29uZmlndXJhdGlvbiklMEElMEElMjMlMjBBY2Nlc3NpbmclMjB0aGUlMjBtb2RlbCUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwbW9kZWwuY29uZmln",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"),y=i("Example:"),g=d(),w(m.$$.fragment)},l(r){c=s(r,"P",{});var u=a(c);y=l(u,"Example:"),u.forEach(t),g=p(r),M(m.$$.fragment,r)},m(r,u){_(r,c,u),e(c,y),_(r,g,u),T(m,r,u),b=!0},p:Te,i(r){b||(v(m.$$.fragment,r),b=!0)},o(r){k(m.$$.fragment,r),b=!1},d(r){r&&t(c),r&&t(g),C(m,r)}}}function Nd($){let c,y,g,m,b;return m=new Y({props:{code:"MCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAwJTIwMCUyMDAlMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMjAxJTIwMSUyMDElMEElN0MlMjBmaXJzdCUyMHNlcXVlbmNlJTIwJTIwJTIwJTIwJTdDJTIwc2Vjb25kJTIwc2VxdWVuY2UlMjAlN0M=",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"),y=i("sequence pair mask has the following format:"),g=d(),w(m.$$.fragment)},l(r){c=s(r,"P",{});var u=a(c);y=l(u,"sequence pair mask has the following format:"),u.forEach(t),g=p(r),M(m.$$.fragment,r)},m(r,u){_(r,c,u),e(c,y),_(r,g,u),T(m,r,u),b=!0},p:Te,i(r){b||(v(m.$$.fragment,r),b=!0)},o(r){k(m.$$.fragment,r),b=!1},d(r){r&&t(c),r&&t(g),C(m,r)}}}function Fd($){let c,y,g,m,b;return{c(){c=o("p"),y=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=o("code"),m=i("Module"),b=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(r){c=s(r,"P",{});var u=a(c);y=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var j=a(g);m=l(j,"Module"),j.forEach(t),b=l(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(r,u){_(r,c,u),e(c,y),e(c,g),e(g,m),e(c,b)},d(r){r&&t(c)}}}function xd($){let c,y,g,m,b;return m=new Y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBDYW5pbmVNb2RlbCUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGY2FuaW5lLXMlMjIpJTBBbW9kZWwlMjAlM0QlMjBDYW5pbmVNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGY2FuaW5lLXMlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",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"),y=i("Example:"),g=d(),w(m.$$.fragment)},l(r){c=s(r,"P",{});var u=a(c);y=l(u,"Example:"),u.forEach(t),g=p(r),M(m.$$.fragment,r)},m(r,u){_(r,c,u),e(c,y),_(r,g,u),T(m,r,u),b=!0},p:Te,i(r){b||(v(m.$$.fragment,r),b=!0)},o(r){k(m.$$.fragment,r),b=!1},d(r){r&&t(c),r&&t(g),C(m,r)}}}function Wd($){let c,y,g,m,b;return{c(){c=o("p"),y=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=o("code"),m=i("Module"),b=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(r){c=s(r,"P",{});var u=a(c);y=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var j=a(g);m=l(j,"Module"),j.forEach(t),b=l(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(r,u){_(r,c,u),e(c,y),e(c,g),e(g,m),e(c,b)},d(r){r&&t(c)}}}function Zd($){let c,y,g,m,b;return m=new Y({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMENhbmluZUZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZjYW5pbmUtcyUyMiklMEFtb2RlbCUyMCUzRCUyMENhbmluZUZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRmNhbmluZS1zJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQXByZWRpY3RlZF9jbGFzc19pZCUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoKS5pdGVtKCklMEElMEElMjMlMjBUbyUyMHRyYWluJTIwYSUyMG1vZGVsJTIwb24lMjAlNjBudW1fbGFiZWxzJTYwJTIwY2xhc3NlcyUyQyUyMHlvdSUyMGNhbiUyMHBhc3MlMjAlNjBudW1fbGFiZWxzJTNEbnVtX2xhYmVscyU2MCUyMHRvJTIwJTYwLmZyb21fcHJldHJhaW5lZCguLi4pJTYwJTBBbnVtX2xhYmVscyUyMCUzRCUyMGxlbihtb2RlbC5jb25maWcuaWQybGFiZWwpJTBBbW9kZWwlMjAlM0QlMjBDYW5pbmVGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZjYW5pbmUtcyUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTVEKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",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"),y=i("Example of single-label classification:"),g=d(),w(m.$$.fragment)},l(r){c=s(r,"P",{});var u=a(c);y=l(u,"Example of single-label classification:"),u.forEach(t),g=p(r),M(m.$$.fragment,r)},m(r,u){_(r,c,u),e(c,y),_(r,g,u),T(m,r,u),b=!0},p:Te,i(r){b||(v(m.$$.fragment,r),b=!0)},o(r){k(m.$$.fragment,r),b=!1},d(r){r&&t(c),r&&t(g),C(m,r)}}}function Bd($){let c,y,g,m,b;return m=new Y({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMENhbmluZUZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZjYW5pbmUtcyUyMiklMEFtb2RlbCUyMCUzRCUyMENhbmluZUZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRmNhbmluZS1zJTIyJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX2NsYXNzX2lkcyUyMCUzRCUyMHRvcmNoLmFyYW5nZSgwJTJDJTIwbG9naXRzLnNoYXBlJTVCLTElNUQpJTVCdG9yY2guc2lnbW9pZChsb2dpdHMpLnNxdWVlemUoZGltJTNEMCklMjAlM0UlMjAwLjUlNUQlMEElMEElMjMlMjBUbyUyMHRyYWluJTIwYSUyMG1vZGVsJTIwb24lMjAlNjBudW1fbGFiZWxzJTYwJTIwY2xhc3NlcyUyQyUyMHlvdSUyMGNhbiUyMHBhc3MlMjAlNjBudW1fbGFiZWxzJTNEbnVtX2xhYmVscyU2MCUyMHRvJTIwJTYwLmZyb21fcHJldHJhaW5lZCguLi4pJTYwJTBBbnVtX2xhYmVscyUyMCUzRCUyMGxlbihtb2RlbC5jb25maWcuaWQybGFiZWwpJTBBbW9kZWwlMjAlM0QlMjBDYW5pbmVGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJnb29nbGUlMkZjYW5pbmUtcyUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIlMEEpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2guc3VtKCUwQSUyMCUyMCUyMCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwub25lX2hvdChwcmVkaWN0ZWRfY2xhc3NfaWRzJTVCTm9uZSUyQyUyMCUzQSU1RC5jbG9uZSgpJTJDJTIwbnVtX2NsYXNzZXMlM0RudW1fbGFiZWxzKSUyQyUyMGRpbSUzRDElMEEpLnRvKHRvcmNoLmZsb2F0KSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",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"),y=i("Example of multi-label classification:"),g=d(),w(m.$$.fragment)},l(r){c=s(r,"P",{});var u=a(c);y=l(u,"Example of multi-label classification:"),u.forEach(t),g=p(r),M(m.$$.fragment,r)},m(r,u){_(r,c,u),e(c,y),_(r,g,u),T(m,r,u),b=!0},p:Te,i(r){b||(v(m.$$.fragment,r),b=!0)},o(r){k(m.$$.fragment,r),b=!1},d(r){r&&t(c),r&&t(g),C(m,r)}}}function qd($){let c,y,g,m,b;return{c(){c=o("p"),y=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=o("code"),m=i("Module"),b=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(r){c=s(r,"P",{});var u=a(c);y=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var j=a(g);m=l(j,"Module"),j.forEach(t),b=l(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(r,u){_(r,c,u),e(c,y),e(c,g),e(g,m),e(c,b)},d(r){r&&t(c)}}}function Ad($){let c,y,g,m,b;return m=new Y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBDYW5pbmVGb3JNdWx0aXBsZUNob2ljZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGY2FuaW5lLXMlMjIpJTBBbW9kZWwlMjAlM0QlMjBDYW5pbmVGb3JNdWx0aXBsZUNob2ljZS5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGY2FuaW5lLXMlMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIySW4lMjBJdGFseSUyQyUyMHBpenphJTIwc2VydmVkJTIwaW4lMjBmb3JtYWwlMjBzZXR0aW5ncyUyQyUyMHN1Y2glMjBhcyUyMGF0JTIwYSUyMHJlc3RhdXJhbnQlMkMlMjBpcyUyMHByZXNlbnRlZCUyMHVuc2xpY2VkLiUyMiUwQWNob2ljZTAlMjAlM0QlMjAlMjJJdCUyMGlzJTIwZWF0ZW4lMjB3aXRoJTIwYSUyMGZvcmslMjBhbmQlMjBhJTIwa25pZmUuJTIyJTBBY2hvaWNlMSUyMCUzRCUyMCUyMkl0JTIwaXMlMjBlYXRlbiUyMHdoaWxlJTIwaGVsZCUyMGluJTIwdGhlJTIwaGFuZC4lMjIlMEFsYWJlbHMlMjAlM0QlMjB0b3JjaC50ZW5zb3IoMCkudW5zcXVlZXplKDApJTIwJTIwJTIzJTIwY2hvaWNlMCUyMGlzJTIwY29ycmVjdCUyMChhY2NvcmRpbmclMjB0byUyMFdpa2lwZWRpYSUyMCUzQikpJTJDJTIwYmF0Y2glMjBzaXplJTIwMSUwQSUwQWVuY29kaW5nJTIwJTNEJTIwdG9rZW5pemVyKCU1QnByb21wdCUyQyUyMHByb21wdCU1RCUyQyUyMCU1QmNob2ljZTAlMkMlMjBjaG9pY2UxJTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUyQyUyMHBhZGRpbmclM0RUcnVlKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKiU3QmslM0ElMjB2LnVuc3F1ZWV6ZSgwKSUyMGZvciUyMGslMkMlMjB2JTIwaW4lMjBlbmNvZGluZy5pdGVtcygpJTdEJTJDJTIwbGFiZWxzJTNEbGFiZWxzKSUyMCUyMCUyMyUyMGJhdGNoJTIwc2l6ZSUyMGlzJTIwMSUwQSUwQSUyMyUyMHRoZSUyMGxpbmVhciUyMGNsYXNzaWZpZXIlMjBzdGlsbCUyMG5lZWRzJTIwdG8lMjBiZSUyMHRyYWluZWQlMEFsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3NzJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHM=",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"),y=i("Example:"),g=d(),w(m.$$.fragment)},l(r){c=s(r,"P",{});var u=a(c);y=l(u,"Example:"),u.forEach(t),g=p(r),M(m.$$.fragment,r)},m(r,u){_(r,c,u),e(c,y),_(r,g,u),T(m,r,u),b=!0},p:Te,i(r){b||(v(m.$$.fragment,r),b=!0)},o(r){k(m.$$.fragment,r),b=!1},d(r){r&&t(c),r&&t(g),C(m,r)}}}function Gd($){let c,y,g,m,b;return{c(){c=o("p"),y=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=o("code"),m=i("Module"),b=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(r){c=s(r,"P",{});var u=a(c);y=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var j=a(g);m=l(j,"Module"),j.forEach(t),b=l(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(r,u){_(r,c,u),e(c,y),e(c,g),e(g,m),e(c,b)},d(r){r&&t(c)}}}function Vd($){let c,y,g,m,b;return m=new Y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBDYW5pbmVGb3JUb2tlbkNsYXNzaWZpY2F0aW9uJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZjYW5pbmUtcyUyMiklMEFtb2RlbCUyMCUzRCUyMENhbmluZUZvclRva2VuQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRmNhbmluZS1zJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMEElMjAlMjAlMjAlMjAlMjJIdWdnaW5nRmFjZSUyMGlzJTIwYSUyMGNvbXBhbnklMjBiYXNlZCUyMGluJTIwUGFyaXMlMjBhbmQlMjBOZXclMjBZb3JrJTIyJTJDJTIwYWRkX3NwZWNpYWxfdG9rZW5zJTNERmFsc2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTBBKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoLTEpJTBBJTBBJTIzJTIwTm90ZSUyMHRoYXQlMjB0b2tlbnMlMjBhcmUlMjBjbGFzc2lmaWVkJTIwcmF0aGVyJTIwdGhlbiUyMGlucHV0JTIwd29yZHMlMjB3aGljaCUyMG1lYW5zJTIwdGhhdCUwQSUyMyUyMHRoZXJlJTIwbWlnaHQlMjBiZSUyMG1vcmUlMjBwcmVkaWN0ZWQlMjB0b2tlbiUyMGNsYXNzZXMlMjB0aGFuJTIwd29yZHMuJTBBJTIzJTIwTXVsdGlwbGUlMjB0b2tlbiUyMGNsYXNzZXMlMjBtaWdodCUyMGFjY291bnQlMjBmb3IlMjB0aGUlMjBzYW1lJTIwd29yZCUwQXByZWRpY3RlZF90b2tlbnNfY2xhc3NlcyUyMCUzRCUyMCU1Qm1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnQuaXRlbSgpJTVEJTIwZm9yJTIwdCUyMGluJTIwcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyU1QjAlNUQlNUQlMEFwcmVkaWN0ZWRfdG9rZW5zX2NsYXNzZXM=",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"),y=i("Example:"),g=d(),w(m.$$.fragment)},l(r){c=s(r,"P",{});var u=a(c);y=l(u,"Example:"),u.forEach(t),g=p(r),M(m.$$.fragment,r)},m(r,u){_(r,c,u),e(c,y),_(r,g,u),T(m,r,u),b=!0},p:Te,i(r){b||(v(m.$$.fragment,r),b=!0)},o(r){k(m.$$.fragment,r),b=!1},d(r){r&&t(c),r&&t(g),C(m,r)}}}function Rd($){let c,y;return c=new Y({props:{code:"bGFiZWxzJTIwJTNEJTIwcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcyUwQXJvdW5kKGxvc3MuaXRlbSgpJTJDJTIwMik=",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){M(c.$$.fragment,g)},m(g,m){T(c,g,m),y=!0},p:Te,i(g){y||(v(c.$$.fragment,g),y=!0)},o(g){k(c.$$.fragment,g),y=!1},d(g){C(c,g)}}}function Sd($){let c,y,g,m,b;return{c(){c=o("p"),y=i("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=o("code"),m=i("Module"),b=i(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(r){c=s(r,"P",{});var u=a(c);y=l(u,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(u,"CODE",{});var j=a(g);m=l(j,"Module"),j.forEach(t),b=l(u,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),u.forEach(t)},m(r,u){_(r,c,u),e(c,y),e(c,g),e(g,m),e(c,b)},d(r){r&&t(c)}}}function Xd($){let c,y,g,m,b;return m=new Y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBDYW5pbmVGb3JRdWVzdGlvbkFuc3dlcmluZyUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyU3BsZW5kMWRjaGFuJTJGY2FuaW5lLWMtc3F1YWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBDYW5pbmVGb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIyU3BsZW5kMWRjaGFuJTJGY2FuaW5lLWMtc3F1YWQlMjIpJTBBJTBBcXVlc3Rpb24lMkMlMjB0ZXh0JTIwJTNEJTIwJTIyV2hvJTIwd2FzJTIwSmltJTIwSGVuc29uJTNGJTIyJTJDJTIwJTIySmltJTIwSGVuc29uJTIwd2FzJTIwYSUyMG5pY2UlMjBwdXBwZXQlMjIlMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIocXVlc3Rpb24lMkMlMjB0ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWFuc3dlcl9zdGFydF9pbmRleCUyMCUzRCUyMG91dHB1dHMuc3RhcnRfbG9naXRzLmFyZ21heCgpJTBBYW5zd2VyX2VuZF9pbmRleCUyMCUzRCUyMG91dHB1dHMuZW5kX2xvZ2l0cy5hcmdtYXgoKSUwQSUwQXByZWRpY3RfYW5zd2VyX3Rva2VucyUyMCUzRCUyMGlucHV0cy5pbnB1dF9pZHMlNUIwJTJDJTIwYW5zd2VyX3N0YXJ0X2luZGV4JTIwJTNBJTIwYW5zd2VyX2VuZF9pbmRleCUyMCUyQiUyMDElNUQlMEF0b2tlbml6ZXIuZGVjb2RlKHByZWRpY3RfYW5zd2VyX3Rva2VucyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSUwQSUwQSUyMyUyMHRhcmdldCUyMGlzJTIwJTIybmljZSUyMHB1cHBldCUyMiUwQXRhcmdldF9zdGFydF9pbmRleCUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxNCU1RCklMEF0YXJnZXRfZW5kX2luZGV4JTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QjE1JTVEKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMHN0YXJ0X3Bvc2l0aW9ucyUzRHRhcmdldF9zdGFydF9pbmRleCUyQyUyMGVuZF9wb3NpdGlvbnMlM0R0YXJnZXRfZW5kX2luZGV4KSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3MlMEFyb3VuZChsb3NzLml0ZW0oKSUyQyUyMDIp",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"),y=i("Example:"),g=d(),w(m.$$.fragment)},l(r){c=s(r,"P",{});var u=a(c);y=l(u,"Example:"),u.forEach(t),g=p(r),M(m.$$.fragment,r)},m(r,u){_(r,c,u),e(c,y),_(r,g,u),T(m,r,u),b=!0},p:Te,i(r){b||(v(m.$$.fragment,r),b=!0)},o(r){k(m.$$.fragment,r),b=!1},d(r){r&&t(c),r&&t(g),C(m,r)}}}function Qd($){let c,y,g,m,b,r,u,j,aa,is,ee,ve,Xt,ln,ra,Qt,ia,ls,ke,la,cn,ca,da,cs,rt,pa,ds,it,Pt,ha,ps,lt,ma,hs,E,Yt,Ht,ua,fa,Lt,dn,ga,ct,_a,ba,ya,Dt,Ot,wa,Ma,Kt,eo,Ta,va,no,dt,pn,ka,Ca,$a,to,pt,hn,ja,Ja,ms,H,Ea,mn,Ua,Ia,un,za,Na,us,ne,Ce,oo,fn,Fa,so,xa,fs,ht,Wa,gs,gn,_s,mt,Za,bs,_n,ys,te,$e,ao,bn,Ba,ro,qa,ws,A,io,ut,Aa,Ga,lo,ft,Va,Ra,co,gt,Sa,Xa,po,_t,Qa,Ms,oe,je,ho,yn,Pa,mo,Ya,Ts,se,wn,Ha,F,La,bt,Da,Oa,yt,Ka,er,uo,nr,tr,fo,or,sr,vs,ae,Je,go,Mn,ar,_o,rr,ks,x,Tn,ir,re,lr,wt,cr,dr,vn,pr,hr,mr,ie,ur,Mt,fr,gr,Tt,_r,br,yr,Ee,Cs,le,Ue,bo,kn,wr,yo,Mr,$s,J,Cn,Tr,wo,vr,kr,Ie,vt,Cr,$r,kt,jr,Jr,Er,$n,Ur,Ct,Ir,zr,Nr,L,jn,Fr,Mo,xr,Wr,Jn,$t,Zr,To,Br,qr,jt,Ar,vo,Gr,Vr,ze,En,Rr,Un,Sr,ko,Xr,Qr,Pr,G,In,Yr,Co,Hr,Lr,Ne,Dr,ce,Or,$o,Kr,ei,jo,ni,ti,js,de,Fe,Jo,zn,oi,Eo,si,Js,P,Nn,ai,Fn,ri,xn,ii,li,ci,V,Wn,di,pe,pi,Jt,hi,mi,Uo,ui,fi,gi,xe,_i,We,Es,he,Ze,Io,Zn,bi,zo,yi,Us,W,Bn,wi,No,Mi,Ti,qn,vi,An,ki,Ci,$i,I,Gn,ji,me,Ji,Et,Ei,Ui,Fo,Ii,zi,Ni,Be,Fi,qe,xi,Ae,Is,ue,Ge,xo,Vn,Wi,Wo,Zi,zs,Z,Rn,Bi,Zo,qi,Ai,Sn,Gi,Xn,Vi,Ri,Si,R,Qn,Xi,fe,Qi,Ut,Pi,Yi,Bo,Hi,Li,Di,Ve,Oi,Re,Ns,ge,Se,qo,Pn,Ki,Ao,el,Fs,B,Yn,nl,Go,tl,ol,Hn,sl,Ln,al,rl,il,z,Dn,ll,_e,cl,It,dl,pl,Vo,hl,ml,ul,Xe,fl,Qe,gl,Pe,xs,be,Ye,Ro,On,_l,So,bl,Ws,q,Kn,yl,ye,wl,Xo,Ml,Tl,Qo,vl,kl,Cl,et,$l,nt,jl,Jl,El,S,tt,Ul,we,Il,zt,zl,Nl,Po,Fl,xl,Wl,He,Zl,Le,Zs;return r=new Q({}),ln=new Q({}),fn=new Q({}),gn=new Y({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMENhbmluZU1vZGVsJTBBaW1wb3J0JTIwdG9yY2glMEElMEFtb2RlbCUyMCUzRCUyMENhbmluZU1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZjYW5pbmUtYyUyMiklMjAlMjAlMjMlMjBtb2RlbCUyMHByZS10cmFpbmVkJTIwd2l0aCUyMGF1dG9yZWdyZXNzaXZlJTIwY2hhcmFjdGVyJTIwbG9zcyUwQSUwQXRleHQlMjAlM0QlMjAlMjJoZWxsbyUyMHdvcmxkJTIyJTBBJTIzJTIwdXNlJTIwUHl0aG9uJ3MlMjBidWlsdC1pbiUyMG9yZCgpJTIwZnVuY3Rpb24lMjB0byUyMHR1cm4lMjBlYWNoJTIwY2hhcmFjdGVyJTIwaW50byUyMGl0cyUyMHVuaWNvZGUlMjBjb2RlJTIwcG9pbnQlMjBpZCUwQWlucHV0X2lkcyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIlNUJvcmQoY2hhciklMjBmb3IlMjBjaGFyJTIwaW4lMjB0ZXh0JTVEJTVEKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbChpbnB1dF9pZHMpJTIwJTIwJTIzJTIwZm9yd2FyZCUyMHBhc3MlMEFwb29sZWRfb3V0cHV0JTIwJTNEJTIwb3V0cHV0cy5wb29sZXJfb3V0cHV0JTBBc2VxdWVuY2Vfb3V0cHV0JTIwJTNEJTIwb3V0cHV0cy5sYXN0X2hpZGRlbl9zdGF0ZQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CanineModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

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

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

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