Buckets:
| import{s as En,o as An,n as Z}from"../chunks/scheduler.25b97de1.js";import{S as Pn,i as Dn,g as c,s as a,r as T,A as On,h as p,f as s,c as r,j as q,u as y,x as _,k as W,y as i,a as d,v as M,d as w,t as k,w as F}from"../chunks/index.d9030fc9.js";import{T as Je}from"../chunks/Tip.baa67368.js";import{D as H}from"../chunks/Docstring.ffac8efa.js";import{C as Re}from"../chunks/CodeBlock.e6cd0d95.js";import{F as Kn,M as Yn}from"../chunks/Markdown.7217f838.js";import{E as Xe}from"../chunks/ExampleCodeBlock.22dfe688.js";import{H as Le,E as eo}from"../chunks/EditOnGithub.91d95064.js";function to($){let e,h="pair mask has the following format:",n,o,b;return o=new Re({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 |`,wrap:!1}}),{c(){e=c("p"),e.textContent=h,n=a(),T(o.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),_(e)!=="svelte-qjgeij"&&(e.textContent=h),n=r(t),y(o.$$.fragment,t)},m(t,g){d(t,e,g),d(t,n,g),M(o,t,g),b=!0},p:Z,i(t){b||(w(o.$$.fragment,t),b=!0)},o(t){k(o.$$.fragment,t),b=!1},d(t){t&&(s(e),s(n)),F(o,t)}}}function no($){let e,h=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=h},l(n){e=p(n,"P",{"data-svelte-h":!0}),_(e)!=="svelte-fincs2"&&(e.innerHTML=h)},m(n,o){d(n,e,o)},p:Z,d(n){n&&s(e)}}}function oo($){let e,h="Example:",n,o,b;return o=new Re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF1YmVydE1vZGVsJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJmbGF1YmVydCUyRmZsYXViZXJ0X2Jhc2VfY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBGbGF1YmVydE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJmbGF1YmVydCUyRmZsYXViZXJ0X2Jhc2VfY2FzZWQlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaubertModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>model = FlaubertModel.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>last_hidden_states = outputs.last_hidden_state`,wrap:!1}}),{c(){e=c("p"),e.textContent=h,n=a(),T(o.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),_(e)!=="svelte-11lpom8"&&(e.textContent=h),n=r(t),y(o.$$.fragment,t)},m(t,g){d(t,e,g),d(t,n,g),M(o,t,g),b=!0},p:Z,i(t){b||(w(o.$$.fragment,t),b=!0)},o(t){k(o.$$.fragment,t),b=!1},d(t){t&&(s(e),s(n)),F(o,t)}}}function so($){let e,h=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=h},l(n){e=p(n,"P",{"data-svelte-h":!0}),_(e)!=="svelte-fincs2"&&(e.innerHTML=h)},m(n,o){d(n,e,o)},p:Z,d(n){n&&s(e)}}}function ao($){let e,h="Example:",n,o,b;return o=new Re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF1YmVydFdpdGhMTUhlYWRNb2RlbCUwQWltcG9ydCUyMHRvcmNoJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZmxhdWJlcnQlMkZmbGF1YmVydF9iYXNlX2Nhc2VkJTIyKSUwQW1vZGVsJTIwJTNEJTIwRmxhdWJlcnRXaXRoTE1IZWFkTW9kZWwuZnJvbV9wcmV0cmFpbmVkKCUyMmZsYXViZXJ0JTJGZmxhdWJlcnRfYmFzZV9jYXNlZCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIyVGhlJTIwY2FwaXRhbCUyMG9mJTIwRnJhbmNlJTIwaXMlMjAlM0NzcGVjaWFsMSUzRS4lMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBJTIzJTIwcmV0cmlldmUlMjBpbmRleCUyMG9mJTIwJTNDc3BlY2lhbDElM0UlMEFtYXNrX3Rva2VuX2luZGV4JTIwJTNEJTIwKGlucHV0cy5pbnB1dF9pZHMlMjAlM0QlM0QlMjB0b2tlbml6ZXIubWFza190b2tlbl9pZCklNUIwJTVELm5vbnplcm8oYXNfdHVwbGUlM0RUcnVlKSU1QjAlNUQlMEElMEFwcmVkaWN0ZWRfdG9rZW5faWQlMjAlM0QlMjBsb2dpdHMlNUIwJTJDJTIwbWFza190b2tlbl9pbmRleCU1RC5hcmdtYXgoYXhpcyUzRC0xKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRva2VuaXplciglMjJUaGUlMjBjYXBpdGFsJTIwb2YlMjBGcmFuY2UlMjBpcyUyMFBhcmlzLiUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBJTIzJTIwbWFzayUyMGxhYmVscyUyMG9mJTIwbm9uLSUzQ3NwZWNpYWwxJTNFJTIwdG9rZW5zJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2gud2hlcmUoaW5wdXRzLmlucHV0X2lkcyUyMCUzRCUzRCUyMHRva2VuaXplci5tYXNrX3Rva2VuX2lkJTJDJTIwbGFiZWxzJTJDJTIwLTEwMCklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMlMkMlMjBsYWJlbHMlM0RsYWJlbHMp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaubertWithLMHeadModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>model = FlaubertWithLMHeadModel.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"The capital of France is <special1>."</span>, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># retrieve index of <special1></span> | |
| <span class="hljs-meta">>>> </span>mask_token_index = (inputs.input_ids == tokenizer.mask_token_id)[<span class="hljs-number">0</span>].nonzero(as_tuple=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>] | |
| <span class="hljs-meta">>>> </span>predicted_token_id = logits[<span class="hljs-number">0</span>, mask_token_index].argmax(axis=-<span class="hljs-number">1</span>) | |
| <span class="hljs-meta">>>> </span>labels = tokenizer(<span class="hljs-string">"The capital of France is Paris."</span>, return_tensors=<span class="hljs-string">"pt"</span>)[<span class="hljs-string">"input_ids"</span>] | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># mask labels of non-<special1> tokens</span> | |
| <span class="hljs-meta">>>> </span>labels = torch.where(inputs.input_ids == tokenizer.mask_token_id, labels, -<span class="hljs-number">100</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs, labels=labels)`,wrap:!1}}),{c(){e=c("p"),e.textContent=h,n=a(),T(o.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),_(e)!=="svelte-11lpom8"&&(e.textContent=h),n=r(t),y(o.$$.fragment,t)},m(t,g){d(t,e,g),d(t,n,g),M(o,t,g),b=!0},p:Z,i(t){b||(w(o.$$.fragment,t),b=!0)},o(t){k(o.$$.fragment,t),b=!1},d(t){t&&(s(e),s(n)),F(o,t)}}}function ro($){let e,h=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=h},l(n){e=p(n,"P",{"data-svelte-h":!0}),_(e)!=="svelte-fincs2"&&(e.innerHTML=h)},m(n,o){d(n,e,o)},p:Z,d(n){n&&s(e)}}}function io($){let e,h="Example of single-label classification:",n,o,b;return o=new Re({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEZsYXViZXJ0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmZsYXViZXJ0JTJGZmxhdWJlcnRfYmFzZV9jYXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMEZsYXViZXJ0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZmxhdWJlcnQlMkZmbGF1YmVydF9iYXNlX2Nhc2VkJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQXByZWRpY3RlZF9jbGFzc19pZCUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoKS5pdGVtKCklMEElMEElMjMlMjBUbyUyMHRyYWluJTIwYSUyMG1vZGVsJTIwb24lMjAlNjBudW1fbGFiZWxzJTYwJTIwY2xhc3NlcyUyQyUyMHlvdSUyMGNhbiUyMHBhc3MlMjAlNjBudW1fbGFiZWxzJTNEbnVtX2xhYmVscyU2MCUyMHRvJTIwJTYwLmZyb21fcHJldHJhaW5lZCguLi4pJTYwJTBBbnVtX2xhYmVscyUyMCUzRCUyMGxlbihtb2RlbC5jb25maWcuaWQybGFiZWwpJTBBbW9kZWwlMjAlM0QlMjBGbGF1YmVydEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmZsYXViZXJ0JTJGZmxhdWJlcnRfYmFzZV9jYXNlZCUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxJTVEKSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaubertForSequenceClassification | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>model = FlaubertForSequenceClassification.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span>predicted_class_id = logits.argmax().item() | |
| <span class="hljs-meta">>>> </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">>>> </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label) | |
| <span class="hljs-meta">>>> </span>model = FlaubertForSequenceClassification.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>, num_labels=num_labels) | |
| <span class="hljs-meta">>>> </span>labels = torch.tensor([<span class="hljs-number">1</span>]) | |
| <span class="hljs-meta">>>> </span>loss = model(**inputs, labels=labels).loss`,wrap:!1}}),{c(){e=c("p"),e.textContent=h,n=a(),T(o.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),_(e)!=="svelte-ykxpe4"&&(e.textContent=h),n=r(t),y(o.$$.fragment,t)},m(t,g){d(t,e,g),d(t,n,g),M(o,t,g),b=!0},p:Z,i(t){b||(w(o.$$.fragment,t),b=!0)},o(t){k(o.$$.fragment,t),b=!1},d(t){t&&(s(e),s(n)),F(o,t)}}}function lo($){let e,h="Example of multi-label classification:",n,o,b;return o=new Re({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwQXV0b1Rva2VuaXplciUyQyUyMEZsYXViZXJ0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmZsYXViZXJ0JTJGZmxhdWJlcnRfYmFzZV9jYXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMEZsYXViZXJ0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZmxhdWJlcnQlMkZmbGF1YmVydF9iYXNlX2Nhc2VkJTIyJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX2NsYXNzX2lkcyUyMCUzRCUyMHRvcmNoLmFyYW5nZSgwJTJDJTIwbG9naXRzLnNoYXBlJTVCLTElNUQpJTVCdG9yY2guc2lnbW9pZChsb2dpdHMpLnNxdWVlemUoZGltJTNEMCklMjAlM0UlMjAwLjUlNUQlMEElMEElMjMlMjBUbyUyMHRyYWluJTIwYSUyMG1vZGVsJTIwb24lMjAlNjBudW1fbGFiZWxzJTYwJTIwY2xhc3NlcyUyQyUyMHlvdSUyMGNhbiUyMHBhc3MlMjAlNjBudW1fbGFiZWxzJTNEbnVtX2xhYmVscyU2MCUyMHRvJTIwJTYwLmZyb21fcHJldHJhaW5lZCguLi4pJTYwJTBBbnVtX2xhYmVscyUyMCUzRCUyMGxlbihtb2RlbC5jb25maWcuaWQybGFiZWwpJTBBbW9kZWwlMjAlM0QlMjBGbGF1YmVydEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmZsYXViZXJ0JTJGZmxhdWJlcnRfYmFzZV9jYXNlZCUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzJTJDJTIwcHJvYmxlbV90eXBlJTNEJTIybXVsdGlfbGFiZWxfY2xhc3NpZmljYXRpb24lMjIlMEEpJTBBJTBBbGFiZWxzJTIwJTNEJTIwdG9yY2guc3VtKCUwQSUyMCUyMCUyMCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwub25lX2hvdChwcmVkaWN0ZWRfY2xhc3NfaWRzJTVCTm9uZSUyQyUyMCUzQSU1RC5jbG9uZSgpJTJDJTIwbnVtX2NsYXNzZXMlM0RudW1fbGFiZWxzKSUyQyUyMGRpbSUzRDElMEEpLnRvKHRvcmNoLmZsb2F0KSUwQWxvc3MlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMGxhYmVscyUzRGxhYmVscykubG9zcw==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaubertForSequenceClassification | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>model = FlaubertForSequenceClassification.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>, problem_type=<span class="hljs-string">"multi_label_classification"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </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>) > <span class="hljs-number">0.5</span>] | |
| <span class="hljs-meta">>>> </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">>>> </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label) | |
| <span class="hljs-meta">>>> </span>model = FlaubertForSequenceClassification.from_pretrained( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"flaubert/flaubert_base_cased"</span>, num_labels=num_labels, problem_type=<span class="hljs-string">"multi_label_classification"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </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">>>> </span>loss = model(**inputs, labels=labels).loss`,wrap:!1}}),{c(){e=c("p"),e.textContent=h,n=a(),T(o.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),_(e)!=="svelte-1l8e32d"&&(e.textContent=h),n=r(t),y(o.$$.fragment,t)},m(t,g){d(t,e,g),d(t,n,g),M(o,t,g),b=!0},p:Z,i(t){b||(w(o.$$.fragment,t),b=!0)},o(t){k(o.$$.fragment,t),b=!1},d(t){t&&(s(e),s(n)),F(o,t)}}}function co($){let e,h=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=h},l(n){e=p(n,"P",{"data-svelte-h":!0}),_(e)!=="svelte-fincs2"&&(e.innerHTML=h)},m(n,o){d(n,e,o)},p:Z,d(n){n&&s(e)}}}function po($){let e,h="Example:",n,o,b;return o=new Re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF1YmVydEZvck11bHRpcGxlQ2hvaWNlJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJmbGF1YmVydCUyRmZsYXViZXJ0X2Jhc2VfY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBGbGF1YmVydEZvck11bHRpcGxlQ2hvaWNlLmZyb21fcHJldHJhaW5lZCglMjJmbGF1YmVydCUyRmZsYXViZXJ0X2Jhc2VfY2FzZWQlMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIySW4lMjBJdGFseSUyQyUyMHBpenphJTIwc2VydmVkJTIwaW4lMjBmb3JtYWwlMjBzZXR0aW5ncyUyQyUyMHN1Y2glMjBhcyUyMGF0JTIwYSUyMHJlc3RhdXJhbnQlMkMlMjBpcyUyMHByZXNlbnRlZCUyMHVuc2xpY2VkLiUyMiUwQWNob2ljZTAlMjAlM0QlMjAlMjJJdCUyMGlzJTIwZWF0ZW4lMjB3aXRoJTIwYSUyMGZvcmslMjBhbmQlMjBhJTIwa25pZmUuJTIyJTBBY2hvaWNlMSUyMCUzRCUyMCUyMkl0JTIwaXMlMjBlYXRlbiUyMHdoaWxlJTIwaGVsZCUyMGluJTIwdGhlJTIwaGFuZC4lMjIlMEFsYWJlbHMlMjAlM0QlMjB0b3JjaC50ZW5zb3IoMCkudW5zcXVlZXplKDApJTIwJTIwJTIzJTIwY2hvaWNlMCUyMGlzJTIwY29ycmVjdCUyMChhY2NvcmRpbmclMjB0byUyMFdpa2lwZWRpYSUyMCUzQikpJTJDJTIwYmF0Y2glMjBzaXplJTIwMSUwQSUwQWVuY29kaW5nJTIwJTNEJTIwdG9rZW5pemVyKCU1QnByb21wdCUyQyUyMHByb21wdCU1RCUyQyUyMCU1QmNob2ljZTAlMkMlMjBjaG9pY2UxJTVEJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiUyQyUyMHBhZGRpbmclM0RUcnVlKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKiU3QmslM0ElMjB2LnVuc3F1ZWV6ZSgwKSUyMGZvciUyMGslMkMlMjB2JTIwaW4lMjBlbmNvZGluZy5pdGVtcygpJTdEJTJDJTIwbGFiZWxzJTNEbGFiZWxzKSUyMCUyMCUyMyUyMGJhdGNoJTIwc2l6ZSUyMGlzJTIwMSUwQSUwQSUyMyUyMHRoZSUyMGxpbmVhciUyMGNsYXNzaWZpZXIlMjBzdGlsbCUyMG5lZWRzJTIwdG8lMjBiZSUyMHRyYWluZWQlMEFsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3NzJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHM=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaubertForMultipleChoice | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>model = FlaubertForMultipleChoice.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>prompt = <span class="hljs-string">"In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced."</span> | |
| <span class="hljs-meta">>>> </span>choice0 = <span class="hljs-string">"It is eaten with a fork and a knife."</span> | |
| <span class="hljs-meta">>>> </span>choice1 = <span class="hljs-string">"It is eaten while held in the hand."</span> | |
| <span class="hljs-meta">>>> </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">>>> </span>encoding = tokenizer([prompt, prompt], [choice0, choice1], return_tensors=<span class="hljs-string">"pt"</span>, padding=<span class="hljs-literal">True</span>) | |
| <span class="hljs-meta">>>> </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">>>> </span><span class="hljs-comment"># the linear classifier still needs to be trained</span> | |
| <span class="hljs-meta">>>> </span>loss = outputs.loss | |
| <span class="hljs-meta">>>> </span>logits = outputs.logits`,wrap:!1}}),{c(){e=c("p"),e.textContent=h,n=a(),T(o.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),_(e)!=="svelte-11lpom8"&&(e.textContent=h),n=r(t),y(o.$$.fragment,t)},m(t,g){d(t,e,g),d(t,n,g),M(o,t,g),b=!0},p:Z,i(t){b||(w(o.$$.fragment,t),b=!0)},o(t){k(o.$$.fragment,t),b=!1},d(t){t&&(s(e),s(n)),F(o,t)}}}function uo($){let e,h=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=h},l(n){e=p(n,"P",{"data-svelte-h":!0}),_(e)!=="svelte-fincs2"&&(e.innerHTML=h)},m(n,o){d(n,e,o)},p:Z,d(n){n&&s(e)}}}function mo($){let e,h="Example:",n,o,b;return o=new Re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF1YmVydEZvclRva2VuQ2xhc3NpZmljYXRpb24lMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmZsYXViZXJ0JTJGZmxhdWJlcnRfYmFzZV9jYXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMEZsYXViZXJ0Rm9yVG9rZW5DbGFzc2lmaWNhdGlvbi5mcm9tX3ByZXRyYWluZWQoJTIyZmxhdWJlcnQlMkZmbGF1YmVydF9iYXNlX2Nhc2VkJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMEElMjAlMjAlMjAlMjAlMjJIdWdnaW5nRmFjZSUyMGlzJTIwYSUyMGNvbXBhbnklMjBiYXNlZCUyMGluJTIwUGFyaXMlMjBhbmQlMjBOZXclMjBZb3JrJTIyJTJDJTIwYWRkX3NwZWNpYWxfdG9rZW5zJTNERmFsc2UlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTBBKSUwQSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBJTBBcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyUyMCUzRCUyMGxvZ2l0cy5hcmdtYXgoLTEpJTBBJTBBJTIzJTIwTm90ZSUyMHRoYXQlMjB0b2tlbnMlMjBhcmUlMjBjbGFzc2lmaWVkJTIwcmF0aGVyJTIwdGhlbiUyMGlucHV0JTIwd29yZHMlMjB3aGljaCUyMG1lYW5zJTIwdGhhdCUwQSUyMyUyMHRoZXJlJTIwbWlnaHQlMjBiZSUyMG1vcmUlMjBwcmVkaWN0ZWQlMjB0b2tlbiUyMGNsYXNzZXMlMjB0aGFuJTIwd29yZHMuJTBBJTIzJTIwTXVsdGlwbGUlMjB0b2tlbiUyMGNsYXNzZXMlMjBtaWdodCUyMGFjY291bnQlMjBmb3IlMjB0aGUlMjBzYW1lJTIwd29yZCUwQXByZWRpY3RlZF90b2tlbnNfY2xhc3NlcyUyMCUzRCUyMCU1Qm1vZGVsLmNvbmZpZy5pZDJsYWJlbCU1QnQuaXRlbSgpJTVEJTIwZm9yJTIwdCUyMGluJTIwcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyU1QjAlNUQlNUQlMEElMEFsYWJlbHMlMjAlM0QlMjBwcmVkaWN0ZWRfdG9rZW5fY2xhc3NfaWRzJTBBbG9zcyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKS5sb3Nz",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaubertForTokenClassification | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>model = FlaubertForTokenClassification.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"HuggingFace is a company based in Paris and New York"</span>, add_special_tokens=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">"pt"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span>predicted_token_class_ids = logits.argmax(-<span class="hljs-number">1</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Note that tokens are classified rather then input words which means that</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># there might be more predicted token classes than words.</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Multiple token classes might account for the same word</span> | |
| <span class="hljs-meta">>>> </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">>>> </span>labels = predicted_token_class_ids | |
| <span class="hljs-meta">>>> </span>loss = model(**inputs, labels=labels).loss`,wrap:!1}}),{c(){e=c("p"),e.textContent=h,n=a(),T(o.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),_(e)!=="svelte-11lpom8"&&(e.textContent=h),n=r(t),y(o.$$.fragment,t)},m(t,g){d(t,e,g),d(t,n,g),M(o,t,g),b=!0},p:Z,i(t){b||(w(o.$$.fragment,t),b=!0)},o(t){k(o.$$.fragment,t),b=!1},d(t){t&&(s(e),s(n)),F(o,t)}}}function ho($){let e,h=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=h},l(n){e=p(n,"P",{"data-svelte-h":!0}),_(e)!=="svelte-fincs2"&&(e.innerHTML=h)},m(n,o){d(n,e,o)},p:Z,d(n){n&&s(e)}}}function fo($){let e,h="Example:",n,o,b;return o=new Re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBGbGF1YmVydEZvclF1ZXN0aW9uQW5zd2VyaW5nU2ltcGxlJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJmbGF1YmVydCUyRmZsYXViZXJ0X2Jhc2VfY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBGbGF1YmVydEZvclF1ZXN0aW9uQW5zd2VyaW5nU2ltcGxlLmZyb21fcHJldHJhaW5lZCglMjJmbGF1YmVydCUyRmZsYXViZXJ0X2Jhc2VfY2FzZWQlMjIpJTBBJTBBcXVlc3Rpb24lMkMlMjB0ZXh0JTIwJTNEJTIwJTIyV2hvJTIwd2FzJTIwSmltJTIwSGVuc29uJTNGJTIyJTJDJTIwJTIySmltJTIwSGVuc29uJTIwd2FzJTIwYSUyMG5pY2UlMjBwdXBwZXQlMjIlMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIocXVlc3Rpb24lMkMlMjB0ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWFuc3dlcl9zdGFydF9pbmRleCUyMCUzRCUyMG91dHB1dHMuc3RhcnRfbG9naXRzLmFyZ21heCgpJTBBYW5zd2VyX2VuZF9pbmRleCUyMCUzRCUyMG91dHB1dHMuZW5kX2xvZ2l0cy5hcmdtYXgoKSUwQSUwQXByZWRpY3RfYW5zd2VyX3Rva2VucyUyMCUzRCUyMGlucHV0cy5pbnB1dF9pZHMlNUIwJTJDJTIwYW5zd2VyX3N0YXJ0X2luZGV4JTIwJTNBJTIwYW5zd2VyX2VuZF9pbmRleCUyMCUyQiUyMDElNUQlMEElMEElMjMlMjB0YXJnZXQlMjBpcyUyMCUyMm5pY2UlMjBwdXBwZXQlMjIlMEF0YXJnZXRfc3RhcnRfaW5kZXglMjAlM0QlMjB0b3JjaC50ZW5zb3IoJTVCMTQlNUQpJTBBdGFyZ2V0X2VuZF9pbmRleCUyMCUzRCUyMHRvcmNoLnRlbnNvciglNUIxNSU1RCklMEElMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMlMkMlMjBzdGFydF9wb3NpdGlvbnMlM0R0YXJnZXRfc3RhcnRfaW5kZXglMkMlMjBlbmRfcG9zaXRpb25zJTNEdGFyZ2V0X2VuZF9pbmRleCklMEFsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3Nz",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, FlaubertForQuestionAnsweringSimple | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>model = FlaubertForQuestionAnsweringSimple.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>question, text = <span class="hljs-string">"Who was Jim Henson?"</span>, <span class="hljs-string">"Jim Henson was a nice puppet"</span> | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(question, text, return_tensors=<span class="hljs-string">"pt"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> torch.no_grad(): | |
| <span class="hljs-meta">... </span> outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>answer_start_index = outputs.start_logits.argmax() | |
| <span class="hljs-meta">>>> </span>answer_end_index = outputs.end_logits.argmax() | |
| <span class="hljs-meta">>>> </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">>>> </span><span class="hljs-comment"># target is "nice puppet"</span> | |
| <span class="hljs-meta">>>> </span>target_start_index = torch.tensor([<span class="hljs-number">14</span>]) | |
| <span class="hljs-meta">>>> </span>target_end_index = torch.tensor([<span class="hljs-number">15</span>]) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index) | |
| <span class="hljs-meta">>>> </span>loss = outputs.loss`,wrap:!1}}),{c(){e=c("p"),e.textContent=h,n=a(),T(o.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),_(e)!=="svelte-11lpom8"&&(e.textContent=h),n=r(t),y(o.$$.fragment,t)},m(t,g){d(t,e,g),d(t,n,g),M(o,t,g),b=!0},p:Z,i(t){b||(w(o.$$.fragment,t),b=!0)},o(t){k(o.$$.fragment,t),b=!1},d(t){t&&(s(e),s(n)),F(o,t)}}}function go($){let e,h=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=h},l(n){e=p(n,"P",{"data-svelte-h":!0}),_(e)!=="svelte-fincs2"&&(e.innerHTML=h)},m(n,o){d(n,e,o)},p:Z,d(n){n&&s(e)}}}function _o($){let e,h="Example:",n,o,b;return o=new Re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFhMTVRva2VuaXplciUyQyUyMFhMTUZvclF1ZXN0aW9uQW5zd2VyaW5nJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBYTE1Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMkZhY2Vib29rQUklMkZ4bG0tbWxtLWVuLTIwNDglMjIpJTBBbW9kZWwlMjAlM0QlMjBYTE1Gb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIyRmFjZWJvb2tBSSUyRnhsbS1tbG0tZW4tMjA0OCUyMiklMEElMEFpbnB1dF9pZHMlMjAlM0QlMjB0b3JjaC50ZW5zb3IodG9rZW5pemVyLmVuY29kZSglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwYWRkX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSkpLnVuc3F1ZWV6ZSglMEElMjAlMjAlMjAlMjAwJTBBKSUyMCUyMCUyMyUyMEJhdGNoJTIwc2l6ZSUyMDElMEFzdGFydF9wb3NpdGlvbnMlMjAlM0QlMjB0b3JjaC50ZW5zb3IoJTVCMSU1RCklMEFlbmRfcG9zaXRpb25zJTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QjMlNUQpJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0X2lkcyUyQyUyMHN0YXJ0X3Bvc2l0aW9ucyUzRHN0YXJ0X3Bvc2l0aW9ucyUyQyUyMGVuZF9wb3NpdGlvbnMlM0RlbmRfcG9zaXRpb25zKSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3M=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> XLMTokenizer, XLMForQuestionAnswering | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span>tokenizer = XLMTokenizer.from_pretrained(<span class="hljs-string">"FacebookAI/xlm-mlm-en-2048"</span>) | |
| <span class="hljs-meta">>>> </span>model = XLMForQuestionAnswering.from_pretrained(<span class="hljs-string">"FacebookAI/xlm-mlm-en-2048"</span>) | |
| <span class="hljs-meta">>>> </span>input_ids = torch.tensor(tokenizer.encode(<span class="hljs-string">"Hello, my dog is cute"</span>, add_special_tokens=<span class="hljs-literal">True</span>)).unsqueeze( | |
| <span class="hljs-meta">... </span> <span class="hljs-number">0</span> | |
| <span class="hljs-meta">... </span>) <span class="hljs-comment"># Batch size 1</span> | |
| <span class="hljs-meta">>>> </span>start_positions = torch.tensor([<span class="hljs-number">1</span>]) | |
| <span class="hljs-meta">>>> </span>end_positions = torch.tensor([<span class="hljs-number">3</span>]) | |
| <span class="hljs-meta">>>> </span>outputs = model(input_ids, start_positions=start_positions, end_positions=end_positions) | |
| <span class="hljs-meta">>>> </span>loss = outputs.loss`,wrap:!1}}),{c(){e=c("p"),e.textContent=h,n=a(),T(o.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),_(e)!=="svelte-11lpom8"&&(e.textContent=h),n=r(t),y(o.$$.fragment,t)},m(t,g){d(t,e,g),d(t,n,g),M(o,t,g),b=!0},p:Z,i(t){b||(w(o.$$.fragment,t),b=!0)},o(t){k(o.$$.fragment,t),b=!1},d(t){t&&(s(e),s(n)),F(o,t)}}}function bo($){let e,h,n,o,b,t,g,Y,N,j='The <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertModel">FlaubertModel</a> forward method, overrides the <code>__call__</code> special method.',R,z,J,I,m,x,pe,B,Ft,lt,Se,_n=`The Flaubert Model transformer with a language modeling head on top (linear layer with weights tied to the input | |
| embeddings).`,Qe,ze,vt=`This model inherits from <a href="/docs/transformers/pr_33512/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,Nt,ue,ln=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,K,E,Oe,Ue,Rt,Pt='The <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertWithLMHeadModel">FlaubertWithLMHeadModel</a> forward method, overrides the <code>__call__</code> special method.',Ne,Ke,$e,ie,Dt,Ze,et,le,P,$t,dt,Ye=`Flaubert Model with a sequence classification/regression head on top (a linear layer on top of the pooled output) | |
| e.g. for GLUE tasks.`,Ot,V,xe=`This model inherits from <a href="/docs/transformers/pr_33512/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,Kt,me,dn=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,ct,ee,A,pt,Ee,St='The <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertForSequenceClassification">FlaubertForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',cn,de,Ie,ut,xt,We,en,qe,tt,ce,G,Ce,Ct,nt=`Flaubert 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.`,bn,jt,se=`This model inherits from <a href="/docs/transformers/pr_33512/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,mt,je,Zt=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,ht,_e,ae,Qt,X,It='The <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertForMultipleChoice">FlaubertForMultipleChoice</a> forward method, overrides the <code>__call__</code> special method.',tn,re,Jt,ot,Ve,Wt,qt,L,ft,gt,Fe,Yt=`Flaubert 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.`,be,f,U=`This model inherits from <a href="/docs/transformers/pr_33512/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,ve,S,Vt=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,Ae,te,Te,Mn,zt,kn='The <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertForTokenClassification">FlaubertForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',ye,st,Fn,_t,vn,nn,on,He,sn,pn,Tn,Nn=`Flaubert 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 <code>span start logits</code> and <code>span end logits</code>).`,Et,un,Pe=`This model inherits from <a href="/docs/transformers/pr_33512/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,an,mn,yn=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass. | |
| Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage | |
| and behavior.`,Zn,at,rt,$n,bt,In='The <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertForQuestionAnsweringSimple">FlaubertForQuestionAnsweringSimple</a> forward method, overrides the <code>__call__</code> special method.',At,Ht,rn,Bt,he,Tt,wn,it,hn,xn,Me,fn,Cn,Gt,Wn='The <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertForQuestionAnswering">FlaubertForQuestionAnswering</a> forward method, overrides the <code>__call__</code> special method.',jn,De,Jn,we,gn="Base class for outputs of question answering models using a <code>SquadHead</code>.",zn,yt,Un;return e=new Le({props:{title:"FlaubertModel",local:"transformers.FlaubertModel",headingTag:"h2"}}),o=new H({props:{name:"class transformers.FlaubertModel",anchor:"transformers.FlaubertModel",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_33512/src/transformers/models/flaubert/modeling_flaubert.py#L376"}}),g=new H({props:{name:"forward",anchor:"transformers.FlaubertModel.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"langs",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"lengths",val:": Optional = None"},{name:"cache",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.FlaubertModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_33512/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FlaubertModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.FlaubertModel.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>) — | |
| 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.FlaubertModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.FlaubertModel.forward.lengths",description:`<strong>lengths</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Length of each sentence that can be used to avoid performing attention on padding token indices. You can | |
| also use <code>attention_mask</code> for the same result (see above), kept here for compatibility. Indices selected in | |
| <code>[0, ..., input_ids.size(-1)]</code>:`,name:"lengths"},{anchor:"transformers.FlaubertModel.forward.cache",description:`<strong>cache</strong> (<code>Dict[str, torch.FloatTensor]</code>, <em>optional</em>) — | |
| Dictionary strings to <code>torch.FloatTensor</code> that contains precomputed hidden-states (key and values in the | |
| attention blocks) as computed by the model (see <code>cache</code> output below). Can be used to speed up sequential | |
| decoding. The dictionary object will be modified in-place during the forward pass to add newly computed | |
| hidden-states.`,name:"cache"},{anchor:"transformers.FlaubertModel.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>) — | |
| 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.FlaubertModel.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>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.FlaubertModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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.FlaubertModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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.FlaubertModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_33512/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_33512/src/transformers/models/flaubert/modeling_flaubert.py#L467",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput" | |
| >transformers.modeling_outputs.BaseModelOutput</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/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig" | |
| >FlaubertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_outputs.BaseModelOutput" | |
| >transformers.modeling_outputs.BaseModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),z=new Je({props:{$$slots:{default:[no]},$$scope:{ctx:$}}}),I=new Xe({props:{anchor:"transformers.FlaubertModel.forward.example",$$slots:{default:[oo]},$$scope:{ctx:$}}}),x=new Le({props:{title:"FlaubertWithLMHeadModel",local:"transformers.FlaubertWithLMHeadModel",headingTag:"h2"}}),Ft=new H({props:{name:"class transformers.FlaubertWithLMHeadModel",anchor:"transformers.FlaubertWithLMHeadModel",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.FlaubertWithLMHeadModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig">FlaubertConfig</a>) — 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/pr_33512/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/vr_33512/src/transformers/models/flaubert/modeling_flaubert.py#L639"}}),Oe=new H({props:{name:"forward",anchor:"transformers.FlaubertWithLMHeadModel.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"langs",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"lengths",val:": Optional = None"},{name:"cache",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.FlaubertWithLMHeadModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_33512/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FlaubertWithLMHeadModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.FlaubertWithLMHeadModel.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>) — | |
| 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.FlaubertWithLMHeadModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.FlaubertWithLMHeadModel.forward.lengths",description:`<strong>lengths</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Length of each sentence that can be used to avoid performing attention on padding token indices. You can | |
| also use <code>attention_mask</code> for the same result (see above), kept here for compatibility. Indices selected in | |
| <code>[0, ..., input_ids.size(-1)]</code>:`,name:"lengths"},{anchor:"transformers.FlaubertWithLMHeadModel.forward.cache",description:`<strong>cache</strong> (<code>Dict[str, torch.FloatTensor]</code>, <em>optional</em>) — | |
| Dictionary strings to <code>torch.FloatTensor</code> that contains precomputed hidden-states (key and values in the | |
| attention blocks) as computed by the model (see <code>cache</code> output below). Can be used to speed up sequential | |
| decoding. The dictionary object will be modified in-place during the forward pass to add newly computed | |
| hidden-states.`,name:"cache"},{anchor:"transformers.FlaubertWithLMHeadModel.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>) — | |
| 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.FlaubertWithLMHeadModel.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>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.FlaubertWithLMHeadModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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.FlaubertWithLMHeadModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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.FlaubertWithLMHeadModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_33512/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.FlaubertWithLMHeadModel.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Labels for language modeling. Note that the labels <strong>are shifted</strong> inside the model, i.e. you can set | |
| <code>labels = input_ids</code> Indices are selected in <code>[-100, 0, ..., config.vocab_size]</code> All labels set to <code>-100</code> | |
| are ignored (masked), the loss is only computed for labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_33512/src/transformers/models/flaubert/modeling_flaubert.py#L677",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput" | |
| >transformers.modeling_outputs.MaskedLMOutput</a> or a tuple of | |
| <code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various | |
| elements depending on the configuration (<a | |
| href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig" | |
| >FlaubertConfig</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) — Masked language modeling (MLM) loss.</p> | |
| </li> | |
| <li> | |
| <p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput" | |
| >transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),Ke=new Je({props:{$$slots:{default:[so]},$$scope:{ctx:$}}}),ie=new Xe({props:{anchor:"transformers.FlaubertWithLMHeadModel.forward.example",$$slots:{default:[ao]},$$scope:{ctx:$}}}),Ze=new Le({props:{title:"FlaubertForSequenceClassification",local:"transformers.FlaubertForSequenceClassification",headingTag:"h2"}}),P=new H({props:{name:"class transformers.FlaubertForSequenceClassification",anchor:"transformers.FlaubertForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.FlaubertForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig">FlaubertConfig</a>) — 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/pr_33512/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/vr_33512/src/transformers/models/flaubert/modeling_flaubert.py#L737"}}),A=new H({props:{name:"forward",anchor:"transformers.FlaubertForSequenceClassification.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"langs",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"lengths",val:": Optional = None"},{name:"cache",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.FlaubertForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_33512/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FlaubertForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.FlaubertForSequenceClassification.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>) — | |
| 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.FlaubertForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.FlaubertForSequenceClassification.forward.lengths",description:`<strong>lengths</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Length of each sentence that can be used to avoid performing attention on padding token indices. You can | |
| also use <code>attention_mask</code> for the same result (see above), kept here for compatibility. Indices selected in | |
| <code>[0, ..., input_ids.size(-1)]</code>:`,name:"lengths"},{anchor:"transformers.FlaubertForSequenceClassification.forward.cache",description:`<strong>cache</strong> (<code>Dict[str, torch.FloatTensor]</code>, <em>optional</em>) — | |
| Dictionary strings to <code>torch.FloatTensor</code> that contains precomputed hidden-states (key and values in the | |
| attention blocks) as computed by the model (see <code>cache</code> output below). Can be used to speed up sequential | |
| decoding. The dictionary object will be modified in-place during the forward pass to add newly computed | |
| hidden-states.`,name:"cache"},{anchor:"transformers.FlaubertForSequenceClassification.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>) — | |
| 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.FlaubertForSequenceClassification.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>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.FlaubertForSequenceClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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.FlaubertForSequenceClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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.FlaubertForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_33512/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.FlaubertForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| 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 > 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_33512/src/transformers/models/flaubert/modeling_flaubert.py#L757",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_33512/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/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig" | |
| >FlaubertConfig</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) — 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>) — 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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput" | |
| >transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),de=new Je({props:{$$slots:{default:[ro]},$$scope:{ctx:$}}}),ut=new Xe({props:{anchor:"transformers.FlaubertForSequenceClassification.forward.example",$$slots:{default:[io]},$$scope:{ctx:$}}}),We=new Xe({props:{anchor:"transformers.FlaubertForSequenceClassification.forward.example-2",$$slots:{default:[lo]},$$scope:{ctx:$}}}),qe=new Le({props:{title:"FlaubertForMultipleChoice",local:"transformers.FlaubertForMultipleChoice",headingTag:"h2"}}),G=new H({props:{name:"class transformers.FlaubertForMultipleChoice",anchor:"transformers.FlaubertForMultipleChoice",parameters:[{name:"config",val:""},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaubertForMultipleChoice.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig">FlaubertConfig</a>) — 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/pr_33512/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/vr_33512/src/transformers/models/flaubert/modeling_flaubert.py#L1196"}}),ae=new H({props:{name:"forward",anchor:"transformers.FlaubertForMultipleChoice.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"langs",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"lengths",val:": Optional = None"},{name:"cache",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.FlaubertForMultipleChoice.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_33512/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FlaubertForMultipleChoice.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.FlaubertForMultipleChoice.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>) — | |
| 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.FlaubertForMultipleChoice.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.FlaubertForMultipleChoice.forward.lengths",description:`<strong>lengths</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Length of each sentence that can be used to avoid performing attention on padding token indices. You can | |
| also use <code>attention_mask</code> for the same result (see above), kept here for compatibility. Indices selected in | |
| <code>[0, ..., input_ids.size(-1)]</code>:`,name:"lengths"},{anchor:"transformers.FlaubertForMultipleChoice.forward.cache",description:`<strong>cache</strong> (<code>Dict[str, torch.FloatTensor]</code>, <em>optional</em>) — | |
| Dictionary strings to <code>torch.FloatTensor</code> that contains precomputed hidden-states (key and values in the | |
| attention blocks) as computed by the model (see <code>cache</code> output below). Can be used to speed up sequential | |
| decoding. The dictionary object will be modified in-place during the forward pass to add newly computed | |
| hidden-states.`,name:"cache"},{anchor:"transformers.FlaubertForMultipleChoice.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>) — | |
| 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.FlaubertForMultipleChoice.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>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.FlaubertForMultipleChoice.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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.FlaubertForMultipleChoice.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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.FlaubertForMultipleChoice.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_33512/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.FlaubertForMultipleChoice.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| 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/vr_33512/src/transformers/models/flaubert/modeling_flaubert.py#L1215",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_33512/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/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig" | |
| >FlaubertConfig</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) — Classification loss.</p> | |
| </li> | |
| <li> | |
| <p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, num_choices)</code>) — <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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_outputs.MultipleChoiceModelOutput" | |
| >transformers.modeling_outputs.MultipleChoiceModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),re=new Je({props:{$$slots:{default:[co]},$$scope:{ctx:$}}}),ot=new Xe({props:{anchor:"transformers.FlaubertForMultipleChoice.forward.example",$$slots:{default:[po]},$$scope:{ctx:$}}}),Wt=new Le({props:{title:"FlaubertForTokenClassification",local:"transformers.FlaubertForTokenClassification",headingTag:"h2"}}),ft=new H({props:{name:"class transformers.FlaubertForTokenClassification",anchor:"transformers.FlaubertForTokenClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.FlaubertForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig">FlaubertConfig</a>) — 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/pr_33512/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/vr_33512/src/transformers/models/flaubert/modeling_flaubert.py#L840"}}),Te=new H({props:{name:"forward",anchor:"transformers.FlaubertForTokenClassification.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"langs",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"lengths",val:": Optional = None"},{name:"cache",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"labels",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.FlaubertForTokenClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_33512/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FlaubertForTokenClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.FlaubertForTokenClassification.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>) — | |
| 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.FlaubertForTokenClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.FlaubertForTokenClassification.forward.lengths",description:`<strong>lengths</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Length of each sentence that can be used to avoid performing attention on padding token indices. You can | |
| also use <code>attention_mask</code> for the same result (see above), kept here for compatibility. Indices selected in | |
| <code>[0, ..., input_ids.size(-1)]</code>:`,name:"lengths"},{anchor:"transformers.FlaubertForTokenClassification.forward.cache",description:`<strong>cache</strong> (<code>Dict[str, torch.FloatTensor]</code>, <em>optional</em>) — | |
| Dictionary strings to <code>torch.FloatTensor</code> that contains precomputed hidden-states (key and values in the | |
| attention blocks) as computed by the model (see <code>cache</code> output below). Can be used to speed up sequential | |
| decoding. The dictionary object will be modified in-place during the forward pass to add newly computed | |
| hidden-states.`,name:"cache"},{anchor:"transformers.FlaubertForTokenClassification.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>) — | |
| 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.FlaubertForTokenClassification.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>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.FlaubertForTokenClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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.FlaubertForTokenClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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.FlaubertForTokenClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_33512/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.FlaubertForTokenClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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/vr_33512/src/transformers/models/flaubert/modeling_flaubert.py#L860",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_33512/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/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig" | |
| >FlaubertConfig</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) — Classification loss.</p> | |
| </li> | |
| <li> | |
| <p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) — 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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_outputs.TokenClassifierOutput" | |
| >transformers.modeling_outputs.TokenClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),st=new Je({props:{$$slots:{default:[uo]},$$scope:{ctx:$}}}),_t=new Xe({props:{anchor:"transformers.FlaubertForTokenClassification.forward.example",$$slots:{default:[mo]},$$scope:{ctx:$}}}),nn=new Le({props:{title:"FlaubertForQuestionAnsweringSimple",local:"transformers.FlaubertForQuestionAnsweringSimple",headingTag:"h2"}}),sn=new H({props:{name:"class transformers.FlaubertForQuestionAnsweringSimple",anchor:"transformers.FlaubertForQuestionAnsweringSimple",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.FlaubertForQuestionAnsweringSimple.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig">FlaubertConfig</a>) — 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/pr_33512/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/vr_33512/src/transformers/models/flaubert/modeling_flaubert.py#L925"}}),rt=new H({props:{name:"forward",anchor:"transformers.FlaubertForQuestionAnsweringSimple.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"langs",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"lengths",val:": Optional = None"},{name:"cache",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"start_positions",val:": Optional = None"},{name:"end_positions",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.FlaubertForQuestionAnsweringSimple.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_33512/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and | |
| <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FlaubertForQuestionAnsweringSimple.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.FlaubertForQuestionAnsweringSimple.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>) — | |
| 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.FlaubertForQuestionAnsweringSimple.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.FlaubertForQuestionAnsweringSimple.forward.lengths",description:`<strong>lengths</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Length of each sentence that can be used to avoid performing attention on padding token indices. You can | |
| also use <code>attention_mask</code> for the same result (see above), kept here for compatibility. Indices selected in | |
| <code>[0, ..., input_ids.size(-1)]</code>:`,name:"lengths"},{anchor:"transformers.FlaubertForQuestionAnsweringSimple.forward.cache",description:`<strong>cache</strong> (<code>Dict[str, torch.FloatTensor]</code>, <em>optional</em>) — | |
| Dictionary strings to <code>torch.FloatTensor</code> that contains precomputed hidden-states (key and values in the | |
| attention blocks) as computed by the model (see <code>cache</code> output below). Can be used to speed up sequential | |
| decoding. The dictionary object will be modified in-place during the forward pass to add newly computed | |
| hidden-states.`,name:"cache"},{anchor:"transformers.FlaubertForQuestionAnsweringSimple.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>) — | |
| 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.FlaubertForQuestionAnsweringSimple.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>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.FlaubertForQuestionAnsweringSimple.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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.FlaubertForQuestionAnsweringSimple.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| 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.FlaubertForQuestionAnsweringSimple.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_33512/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.FlaubertForQuestionAnsweringSimple.forward.start_positions",description:`<strong>start_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| 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.FlaubertForQuestionAnsweringSimple.forward.end_positions",description:`<strong>end_positions</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| 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/vr_33512/src/transformers/models/flaubert/modeling_flaubert.py#L943",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_33512/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/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig" | |
| >FlaubertConfig</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) — 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>) — 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>) — 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>) — 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>) — 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:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_outputs.QuestionAnsweringModelOutput" | |
| >transformers.modeling_outputs.QuestionAnsweringModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),Ht=new Je({props:{$$slots:{default:[ho]},$$scope:{ctx:$}}}),Bt=new Xe({props:{anchor:"transformers.FlaubertForQuestionAnsweringSimple.forward.example",$$slots:{default:[fo]},$$scope:{ctx:$}}}),Tt=new Le({props:{title:"FlaubertForQuestionAnswering",local:"transformers.FlaubertForQuestionAnswering",headingTag:"h2"}}),hn=new H({props:{name:"class transformers.FlaubertForQuestionAnswering",anchor:"transformers.FlaubertForQuestionAnswering",parameters:[{name:"config",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_33512/src/transformers/models/flaubert/modeling_flaubert.py#L1082"}}),fn=new H({props:{name:"forward",anchor:"transformers.FlaubertForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": Optional = None"},{name:"attention_mask",val:": Optional = None"},{name:"langs",val:": Optional = None"},{name:"token_type_ids",val:": Optional = None"},{name:"position_ids",val:": Optional = None"},{name:"lengths",val:": Optional = None"},{name:"cache",val:": Optional = None"},{name:"head_mask",val:": Optional = None"},{name:"inputs_embeds",val:": Optional = None"},{name:"start_positions",val:": Optional = None"},{name:"end_positions",val:": Optional = None"},{name:"is_impossible",val:": Optional = None"},{name:"cls_index",val:": Optional = None"},{name:"p_mask",val:": Optional = None"},{name:"output_attentions",val:": Optional = None"},{name:"output_hidden_states",val:": Optional = None"},{name:"return_dict",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.FlaubertForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.`,name:"input_ids"}],source:"https://github.com/huggingface/transformers/blob/vr_33512/src/transformers/models/flaubert/modeling_flaubert.py#L1092",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <code>transformers.models.flaubert.modeling_flaubert.FlaubertForQuestionAnsweringOutput</code> 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/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig" | |
| >FlaubertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li><strong>config</strong> (<a | |
| href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig" | |
| >FlaubertConfig</a>): 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/pr_33512/en/main_classes/model#transformers.PreTrainedModel.from_pretrained" | |
| >from_pretrained()</a> method to load the model weights.</li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>transformers.models.flaubert.modeling_flaubert.FlaubertForQuestionAnsweringOutput</code> or <code>tuple(torch.FloatTensor)</code></p> | |
| `}}),De=new Je({props:{$$slots:{default:[go]},$$scope:{ctx:$}}}),yt=new Xe({props:{anchor:"transformers.FlaubertForQuestionAnswering.forward.example",$$slots:{default:[_o]},$$scope:{ctx:$}}}),{c(){T(e.$$.fragment),h=a(),n=c("div"),T(o.$$.fragment),b=a(),t=c("div"),T(g.$$.fragment),Y=a(),N=c("p"),N.innerHTML=j,R=a(),T(z.$$.fragment),J=a(),T(I.$$.fragment),m=a(),T(x.$$.fragment),pe=a(),B=c("div"),T(Ft.$$.fragment),lt=a(),Se=c("p"),Se.textContent=_n,Qe=a(),ze=c("p"),ze.innerHTML=vt,Nt=a(),ue=c("p"),ue.innerHTML=ln,K=a(),E=c("div"),T(Oe.$$.fragment),Ue=a(),Rt=c("p"),Rt.innerHTML=Pt,Ne=a(),T(Ke.$$.fragment),$e=a(),T(ie.$$.fragment),Dt=a(),T(Ze.$$.fragment),et=a(),le=c("div"),T(P.$$.fragment),$t=a(),dt=c("p"),dt.textContent=Ye,Ot=a(),V=c("p"),V.innerHTML=xe,Kt=a(),me=c("p"),me.innerHTML=dn,ct=a(),ee=c("div"),T(A.$$.fragment),pt=a(),Ee=c("p"),Ee.innerHTML=St,cn=a(),T(de.$$.fragment),Ie=a(),T(ut.$$.fragment),xt=a(),T(We.$$.fragment),en=a(),T(qe.$$.fragment),tt=a(),ce=c("div"),T(G.$$.fragment),Ce=a(),Ct=c("p"),Ct.textContent=nt,bn=a(),jt=c("p"),jt.innerHTML=se,mt=a(),je=c("p"),je.innerHTML=Zt,ht=a(),_e=c("div"),T(ae.$$.fragment),Qt=a(),X=c("p"),X.innerHTML=It,tn=a(),T(re.$$.fragment),Jt=a(),T(ot.$$.fragment),Ve=a(),T(Wt.$$.fragment),qt=a(),L=c("div"),T(ft.$$.fragment),gt=a(),Fe=c("p"),Fe.textContent=Yt,be=a(),f=c("p"),f.innerHTML=U,ve=a(),S=c("p"),S.innerHTML=Vt,Ae=a(),te=c("div"),T(Te.$$.fragment),Mn=a(),zt=c("p"),zt.innerHTML=kn,ye=a(),T(st.$$.fragment),Fn=a(),T(_t.$$.fragment),vn=a(),T(nn.$$.fragment),on=a(),He=c("div"),T(sn.$$.fragment),pn=a(),Tn=c("p"),Tn.innerHTML=Nn,Et=a(),un=c("p"),un.innerHTML=Pe,an=a(),mn=c("p"),mn.innerHTML=yn,Zn=a(),at=c("div"),T(rt.$$.fragment),$n=a(),bt=c("p"),bt.innerHTML=In,At=a(),T(Ht.$$.fragment),rn=a(),T(Bt.$$.fragment),he=a(),T(Tt.$$.fragment),wn=a(),it=c("div"),T(hn.$$.fragment),xn=a(),Me=c("div"),T(fn.$$.fragment),Cn=a(),Gt=c("p"),Gt.innerHTML=Wn,jn=a(),T(De.$$.fragment),Jn=a(),we=c("p"),we.innerHTML=gn,zn=a(),T(yt.$$.fragment),this.h()},l(u){y(e.$$.fragment,u),h=r(u),n=p(u,"DIV",{class:!0});var C=q(n);y(o.$$.fragment,C),b=r(C),t=p(C,"DIV",{class:!0});var Mt=q(t);y(g.$$.fragment,Mt),Y=r(Mt),N=p(Mt,"P",{"data-svelte-h":!0}),_(N)!=="svelte-tn1a94"&&(N.innerHTML=j),R=r(Mt),y(z.$$.fragment,Mt),J=r(Mt),y(I.$$.fragment,Mt),Mt.forEach(s),C.forEach(s),m=r(u),y(x.$$.fragment,u),pe=r(u),B=p(u,"DIV",{class:!0});var fe=q(B);y(Ft.$$.fragment,fe),lt=r(fe),Se=p(fe,"P",{"data-svelte-h":!0}),_(Se)!=="svelte-1eostie"&&(Se.textContent=_n),Qe=r(fe),ze=p(fe,"P",{"data-svelte-h":!0}),_(ze)!=="svelte-n66nuu"&&(ze.innerHTML=vt),Nt=r(fe),ue=p(fe,"P",{"data-svelte-h":!0}),_(ue)!=="svelte-hswkmf"&&(ue.innerHTML=ln),K=r(fe),E=p(fe,"DIV",{class:!0});var wt=q(E);y(Oe.$$.fragment,wt),Ue=r(wt),Rt=p(wt,"P",{"data-svelte-h":!0}),_(Rt)!=="svelte-a9rxwc"&&(Rt.innerHTML=Pt),Ne=r(wt),y(Ke.$$.fragment,wt),$e=r(wt),y(ie.$$.fragment,wt),wt.forEach(s),fe.forEach(s),Dt=r(u),y(Ze.$$.fragment,u),et=r(u),le=p(u,"DIV",{class:!0});var ge=q(le);y(P.$$.fragment,ge),$t=r(ge),dt=p(ge,"P",{"data-svelte-h":!0}),_(dt)!=="svelte-1rhbm1m"&&(dt.textContent=Ye),Ot=r(ge),V=p(ge,"P",{"data-svelte-h":!0}),_(V)!=="svelte-n66nuu"&&(V.innerHTML=xe),Kt=r(ge),me=p(ge,"P",{"data-svelte-h":!0}),_(me)!=="svelte-hswkmf"&&(me.innerHTML=dn),ct=r(ge),ee=p(ge,"DIV",{class:!0});var Be=q(ee);y(A.$$.fragment,Be),pt=r(Be),Ee=p(Be,"P",{"data-svelte-h":!0}),_(Ee)!=="svelte-wamz80"&&(Ee.innerHTML=St),cn=r(Be),y(de.$$.fragment,Be),Ie=r(Be),y(ut.$$.fragment,Be),xt=r(Be),y(We.$$.fragment,Be),Be.forEach(s),ge.forEach(s),en=r(u),y(qe.$$.fragment,u),tt=r(u),ce=p(u,"DIV",{class:!0});var l=q(ce);y(G.$$.fragment,l),Ce=r(l),Ct=p(l,"P",{"data-svelte-h":!0}),_(Ct)!=="svelte-s65kar"&&(Ct.textContent=nt),bn=r(l),jt=p(l,"P",{"data-svelte-h":!0}),_(jt)!=="svelte-n66nuu"&&(jt.innerHTML=se),mt=r(l),je=p(l,"P",{"data-svelte-h":!0}),_(je)!=="svelte-hswkmf"&&(je.innerHTML=Zt),ht=r(l),_e=p(l,"DIV",{class:!0});var v=q(_e);y(ae.$$.fragment,v),Qt=r(v),X=p(v,"P",{"data-svelte-h":!0}),_(X)!=="svelte-14lt4e0"&&(X.innerHTML=It),tn=r(v),y(re.$$.fragment,v),Jt=r(v),y(ot.$$.fragment,v),v.forEach(s),l.forEach(s),Ve=r(u),y(Wt.$$.fragment,u),qt=r(u),L=p(u,"DIV",{class:!0});var ne=q(L);y(ft.$$.fragment,ne),gt=r(ne),Fe=p(ne,"P",{"data-svelte-h":!0}),_(Fe)!=="svelte-xixmts"&&(Fe.textContent=Yt),be=r(ne),f=p(ne,"P",{"data-svelte-h":!0}),_(f)!=="svelte-n66nuu"&&(f.innerHTML=U),ve=r(ne),S=p(ne,"P",{"data-svelte-h":!0}),_(S)!=="svelte-hswkmf"&&(S.innerHTML=Vt),Ae=r(ne),te=p(ne,"DIV",{class:!0});var D=q(te);y(Te.$$.fragment,D),Mn=r(D),zt=p(D,"P",{"data-svelte-h":!0}),_(zt)!=="svelte-lxm02e"&&(zt.innerHTML=kn),ye=r(D),y(st.$$.fragment,D),Fn=r(D),y(_t.$$.fragment,D),D.forEach(s),ne.forEach(s),vn=r(u),y(nn.$$.fragment,u),on=r(u),He=p(u,"DIV",{class:!0});var oe=q(He);y(sn.$$.fragment,oe),pn=r(oe),Tn=p(oe,"P",{"data-svelte-h":!0}),_(Tn)!=="svelte-jwd8ye"&&(Tn.innerHTML=Nn),Et=r(oe),un=p(oe,"P",{"data-svelte-h":!0}),_(un)!=="svelte-n66nuu"&&(un.innerHTML=Pe),an=r(oe),mn=p(oe,"P",{"data-svelte-h":!0}),_(mn)!=="svelte-hswkmf"&&(mn.innerHTML=yn),Zn=r(oe),at=p(oe,"DIV",{class:!0});var O=q(at);y(rt.$$.fragment,O),$n=r(O),bt=p(O,"P",{"data-svelte-h":!0}),_(bt)!=="svelte-1yvdd0c"&&(bt.innerHTML=In),At=r(O),y(Ht.$$.fragment,O),rn=r(O),y(Bt.$$.fragment,O),O.forEach(s),oe.forEach(s),he=r(u),y(Tt.$$.fragment,u),wn=r(u),it=p(u,"DIV",{class:!0});var ke=q(it);y(hn.$$.fragment,ke),xn=r(ke),Me=p(ke,"DIV",{class:!0});var Q=q(Me);y(fn.$$.fragment,Q),Cn=r(Q),Gt=p(Q,"P",{"data-svelte-h":!0}),_(Gt)!=="svelte-5ycsbk"&&(Gt.innerHTML=Wn),jn=r(Q),y(De.$$.fragment,Q),Jn=r(Q),we=p(Q,"P",{"data-svelte-h":!0}),_(we)!=="svelte-ywkme9"&&(we.innerHTML=gn),zn=r(Q),y(yt.$$.fragment,Q),Q.forEach(s),ke.forEach(s),this.h()},h(){W(t,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(n,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(_e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(at,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(He,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(Me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(it,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(u,C){M(e,u,C),d(u,h,C),d(u,n,C),M(o,n,null),i(n,b),i(n,t),M(g,t,null),i(t,Y),i(t,N),i(t,R),M(z,t,null),i(t,J),M(I,t,null),d(u,m,C),M(x,u,C),d(u,pe,C),d(u,B,C),M(Ft,B,null),i(B,lt),i(B,Se),i(B,Qe),i(B,ze),i(B,Nt),i(B,ue),i(B,K),i(B,E),M(Oe,E,null),i(E,Ue),i(E,Rt),i(E,Ne),M(Ke,E,null),i(E,$e),M(ie,E,null),d(u,Dt,C),M(Ze,u,C),d(u,et,C),d(u,le,C),M(P,le,null),i(le,$t),i(le,dt),i(le,Ot),i(le,V),i(le,Kt),i(le,me),i(le,ct),i(le,ee),M(A,ee,null),i(ee,pt),i(ee,Ee),i(ee,cn),M(de,ee,null),i(ee,Ie),M(ut,ee,null),i(ee,xt),M(We,ee,null),d(u,en,C),M(qe,u,C),d(u,tt,C),d(u,ce,C),M(G,ce,null),i(ce,Ce),i(ce,Ct),i(ce,bn),i(ce,jt),i(ce,mt),i(ce,je),i(ce,ht),i(ce,_e),M(ae,_e,null),i(_e,Qt),i(_e,X),i(_e,tn),M(re,_e,null),i(_e,Jt),M(ot,_e,null),d(u,Ve,C),M(Wt,u,C),d(u,qt,C),d(u,L,C),M(ft,L,null),i(L,gt),i(L,Fe),i(L,be),i(L,f),i(L,ve),i(L,S),i(L,Ae),i(L,te),M(Te,te,null),i(te,Mn),i(te,zt),i(te,ye),M(st,te,null),i(te,Fn),M(_t,te,null),d(u,vn,C),M(nn,u,C),d(u,on,C),d(u,He,C),M(sn,He,null),i(He,pn),i(He,Tn),i(He,Et),i(He,un),i(He,an),i(He,mn),i(He,Zn),i(He,at),M(rt,at,null),i(at,$n),i(at,bt),i(at,At),M(Ht,at,null),i(at,rn),M(Bt,at,null),d(u,he,C),M(Tt,u,C),d(u,wn,C),d(u,it,C),M(hn,it,null),i(it,xn),i(it,Me),M(fn,Me,null),i(Me,Cn),i(Me,Gt),i(Me,jn),M(De,Me,null),i(Me,Jn),i(Me,we),i(Me,zn),M(yt,Me,null),Un=!0},p(u,C){const Mt={};C&2&&(Mt.$$scope={dirty:C,ctx:u}),z.$set(Mt);const fe={};C&2&&(fe.$$scope={dirty:C,ctx:u}),I.$set(fe);const wt={};C&2&&(wt.$$scope={dirty:C,ctx:u}),Ke.$set(wt);const ge={};C&2&&(ge.$$scope={dirty:C,ctx:u}),ie.$set(ge);const Be={};C&2&&(Be.$$scope={dirty:C,ctx:u}),de.$set(Be);const l={};C&2&&(l.$$scope={dirty:C,ctx:u}),ut.$set(l);const v={};C&2&&(v.$$scope={dirty:C,ctx:u}),We.$set(v);const ne={};C&2&&(ne.$$scope={dirty:C,ctx:u}),re.$set(ne);const D={};C&2&&(D.$$scope={dirty:C,ctx:u}),ot.$set(D);const oe={};C&2&&(oe.$$scope={dirty:C,ctx:u}),st.$set(oe);const O={};C&2&&(O.$$scope={dirty:C,ctx:u}),_t.$set(O);const ke={};C&2&&(ke.$$scope={dirty:C,ctx:u}),Ht.$set(ke);const Q={};C&2&&(Q.$$scope={dirty:C,ctx:u}),Bt.$set(Q);const Ut={};C&2&&(Ut.$$scope={dirty:C,ctx:u}),De.$set(Ut);const Ge={};C&2&&(Ge.$$scope={dirty:C,ctx:u}),yt.$set(Ge)},i(u){Un||(w(e.$$.fragment,u),w(o.$$.fragment,u),w(g.$$.fragment,u),w(z.$$.fragment,u),w(I.$$.fragment,u),w(x.$$.fragment,u),w(Ft.$$.fragment,u),w(Oe.$$.fragment,u),w(Ke.$$.fragment,u),w(ie.$$.fragment,u),w(Ze.$$.fragment,u),w(P.$$.fragment,u),w(A.$$.fragment,u),w(de.$$.fragment,u),w(ut.$$.fragment,u),w(We.$$.fragment,u),w(qe.$$.fragment,u),w(G.$$.fragment,u),w(ae.$$.fragment,u),w(re.$$.fragment,u),w(ot.$$.fragment,u),w(Wt.$$.fragment,u),w(ft.$$.fragment,u),w(Te.$$.fragment,u),w(st.$$.fragment,u),w(_t.$$.fragment,u),w(nn.$$.fragment,u),w(sn.$$.fragment,u),w(rt.$$.fragment,u),w(Ht.$$.fragment,u),w(Bt.$$.fragment,u),w(Tt.$$.fragment,u),w(hn.$$.fragment,u),w(fn.$$.fragment,u),w(De.$$.fragment,u),w(yt.$$.fragment,u),Un=!0)},o(u){k(e.$$.fragment,u),k(o.$$.fragment,u),k(g.$$.fragment,u),k(z.$$.fragment,u),k(I.$$.fragment,u),k(x.$$.fragment,u),k(Ft.$$.fragment,u),k(Oe.$$.fragment,u),k(Ke.$$.fragment,u),k(ie.$$.fragment,u),k(Ze.$$.fragment,u),k(P.$$.fragment,u),k(A.$$.fragment,u),k(de.$$.fragment,u),k(ut.$$.fragment,u),k(We.$$.fragment,u),k(qe.$$.fragment,u),k(G.$$.fragment,u),k(ae.$$.fragment,u),k(re.$$.fragment,u),k(ot.$$.fragment,u),k(Wt.$$.fragment,u),k(ft.$$.fragment,u),k(Te.$$.fragment,u),k(st.$$.fragment,u),k(_t.$$.fragment,u),k(nn.$$.fragment,u),k(sn.$$.fragment,u),k(rt.$$.fragment,u),k(Ht.$$.fragment,u),k(Bt.$$.fragment,u),k(Tt.$$.fragment,u),k(hn.$$.fragment,u),k(fn.$$.fragment,u),k(De.$$.fragment,u),k(yt.$$.fragment,u),Un=!1},d(u){u&&(s(h),s(n),s(m),s(pe),s(B),s(Dt),s(et),s(le),s(en),s(tt),s(ce),s(Ve),s(qt),s(L),s(vn),s(on),s(He),s(he),s(wn),s(it)),F(e,u),F(o),F(g),F(z),F(I),F(x,u),F(Ft),F(Oe),F(Ke),F(ie),F(Ze,u),F(P),F(A),F(de),F(ut),F(We),F(qe,u),F(G),F(ae),F(re),F(ot),F(Wt,u),F(ft),F(Te),F(st),F(_t),F(nn,u),F(sn),F(rt),F(Ht),F(Bt),F(Tt,u),F(hn),F(fn),F(De),F(yt)}}}function To($){let e,h;return e=new Yn({props:{$$slots:{default:[bo]},$$scope:{ctx:$}}}),{c(){T(e.$$.fragment)},l(n){y(e.$$.fragment,n)},m(n,o){M(e,n,o),h=!0},p(n,o){const b={};o&2&&(b.$$scope={dirty:o,ctx:n}),e.$set(b)},i(n){h||(w(e.$$.fragment,n),h=!0)},o(n){k(e.$$.fragment,n),h=!1},d(n){F(e,n)}}}function yo($){let e,h="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,o,b="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,g,Y=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models | |
| and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just | |
| pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second | |
| format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with | |
| the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first | |
| positional argument:`,N,j,R=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: | |
| <code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring: | |
| <code>model({"input_ids": input_ids, "token_type_ids": token_type_ids})</code></li>`,z,J,I=`Note that when creating models and layers with | |
| <a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry | |
| about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=h,n=a(),o=c("ul"),o.innerHTML=b,t=a(),g=c("p"),g.innerHTML=Y,N=a(),j=c("ul"),j.innerHTML=R,z=a(),J=c("p"),J.innerHTML=I},l(m){e=p(m,"P",{"data-svelte-h":!0}),_(e)!=="svelte-1ajbfxg"&&(e.innerHTML=h),n=r(m),o=p(m,"UL",{"data-svelte-h":!0}),_(o)!=="svelte-qm1t26"&&(o.innerHTML=b),t=r(m),g=p(m,"P",{"data-svelte-h":!0}),_(g)!=="svelte-1v9qsc5"&&(g.innerHTML=Y),N=r(m),j=p(m,"UL",{"data-svelte-h":!0}),_(j)!=="svelte-15scerc"&&(j.innerHTML=R),z=r(m),J=p(m,"P",{"data-svelte-h":!0}),_(J)!=="svelte-1an3odd"&&(J.innerHTML=I)},m(m,x){d(m,e,x),d(m,n,x),d(m,o,x),d(m,t,x),d(m,g,x),d(m,N,x),d(m,j,x),d(m,z,x),d(m,J,x)},p:Z,d(m){m&&(s(e),s(n),s(o),s(t),s(g),s(N),s(j),s(z),s(J))}}}function Mo($){let e,h=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=h},l(n){e=p(n,"P",{"data-svelte-h":!0}),_(e)!=="svelte-fincs2"&&(e.innerHTML=h)},m(n,o){d(n,e,o)},p:Z,d(n){n&&s(e)}}}function wo($){let e,h="Example:",n,o,b;return o=new Re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkZsYXViZXJ0TW9kZWwlMEFpbXBvcnQlMjB0ZW5zb3JmbG93JTIwYXMlMjB0ZiUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmZsYXViZXJ0JTJGZmxhdWJlcnRfYmFzZV9jYXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMFRGRmxhdWJlcnRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyZmxhdWJlcnQlMkZmbGF1YmVydF9iYXNlX2Nhc2VkJTIyKSUwQSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplciglMjJIZWxsbyUyQyUyMG15JTIwZG9nJTIwaXMlMjBjdXRlJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoaW5wdXRzKSUwQSUwQWxhc3RfaGlkZGVuX3N0YXRlcyUyMCUzRCUyMG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGU=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFFlaubertModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>model = TFFlaubertModel.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"tf"</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(inputs) | |
| <span class="hljs-meta">>>> </span>last_hidden_states = outputs.last_hidden_state`,wrap:!1}}),{c(){e=c("p"),e.textContent=h,n=a(),T(o.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),_(e)!=="svelte-11lpom8"&&(e.textContent=h),n=r(t),y(o.$$.fragment,t)},m(t,g){d(t,e,g),d(t,n,g),M(o,t,g),b=!0},p:Z,i(t){b||(w(o.$$.fragment,t),b=!0)},o(t){k(o.$$.fragment,t),b=!1},d(t){t&&(s(e),s(n)),F(o,t)}}}function ko($){let e,h="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,o,b="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,g,Y=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models | |
| and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just | |
| pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second | |
| format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with | |
| the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first | |
| positional argument:`,N,j,R=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: | |
| <code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring: | |
| <code>model({"input_ids": input_ids, "token_type_ids": token_type_ids})</code></li>`,z,J,I=`Note that when creating models and layers with | |
| <a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry | |
| about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=h,n=a(),o=c("ul"),o.innerHTML=b,t=a(),g=c("p"),g.innerHTML=Y,N=a(),j=c("ul"),j.innerHTML=R,z=a(),J=c("p"),J.innerHTML=I},l(m){e=p(m,"P",{"data-svelte-h":!0}),_(e)!=="svelte-1ajbfxg"&&(e.innerHTML=h),n=r(m),o=p(m,"UL",{"data-svelte-h":!0}),_(o)!=="svelte-qm1t26"&&(o.innerHTML=b),t=r(m),g=p(m,"P",{"data-svelte-h":!0}),_(g)!=="svelte-1v9qsc5"&&(g.innerHTML=Y),N=r(m),j=p(m,"UL",{"data-svelte-h":!0}),_(j)!=="svelte-15scerc"&&(j.innerHTML=R),z=r(m),J=p(m,"P",{"data-svelte-h":!0}),_(J)!=="svelte-1an3odd"&&(J.innerHTML=I)},m(m,x){d(m,e,x),d(m,n,x),d(m,o,x),d(m,t,x),d(m,g,x),d(m,N,x),d(m,j,x),d(m,z,x),d(m,J,x)},p:Z,d(m){m&&(s(e),s(n),s(o),s(t),s(g),s(N),s(j),s(z),s(J))}}}function Fo($){let e,h=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=h},l(n){e=p(n,"P",{"data-svelte-h":!0}),_(e)!=="svelte-fincs2"&&(e.innerHTML=h)},m(n,o){d(n,e,o)},p:Z,d(n){n&&s(e)}}}function vo($){let e,h="Example:",n,o,b;return o=new Re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkZsYXViZXJ0V2l0aExNSGVhZE1vZGVsJTBBaW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJmbGF1YmVydCUyRmZsYXViZXJ0X2Jhc2VfY2FzZWQlMjIpJTBBbW9kZWwlMjAlM0QlMjBURkZsYXViZXJ0V2l0aExNSGVhZE1vZGVsLmZyb21fcHJldHJhaW5lZCglMjJmbGF1YmVydCUyRmZsYXViZXJ0X2Jhc2VfY2FzZWQlMjIpJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUyMkhlbGxvJTJDJTIwbXklMjBkb2clMjBpcyUyMGN1dGUlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbChpbnB1dHMpJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHM=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFFlaubertWithLMHeadModel | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>model = TFFlaubertWithLMHeadModel.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"tf"</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(inputs) | |
| <span class="hljs-meta">>>> </span>logits = outputs.logits`,wrap:!1}}),{c(){e=c("p"),e.textContent=h,n=a(),T(o.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),_(e)!=="svelte-11lpom8"&&(e.textContent=h),n=r(t),y(o.$$.fragment,t)},m(t,g){d(t,e,g),d(t,n,g),M(o,t,g),b=!0},p:Z,i(t){b||(w(o.$$.fragment,t),b=!0)},o(t){k(o.$$.fragment,t),b=!1},d(t){t&&(s(e),s(n)),F(o,t)}}}function $o($){let e,h="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,o,b="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,g,Y=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models | |
| and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just | |
| pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second | |
| format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with | |
| the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first | |
| positional argument:`,N,j,R=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: | |
| <code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring: | |
| <code>model({"input_ids": input_ids, "token_type_ids": token_type_ids})</code></li>`,z,J,I=`Note that when creating models and layers with | |
| <a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry | |
| about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=h,n=a(),o=c("ul"),o.innerHTML=b,t=a(),g=c("p"),g.innerHTML=Y,N=a(),j=c("ul"),j.innerHTML=R,z=a(),J=c("p"),J.innerHTML=I},l(m){e=p(m,"P",{"data-svelte-h":!0}),_(e)!=="svelte-1ajbfxg"&&(e.innerHTML=h),n=r(m),o=p(m,"UL",{"data-svelte-h":!0}),_(o)!=="svelte-qm1t26"&&(o.innerHTML=b),t=r(m),g=p(m,"P",{"data-svelte-h":!0}),_(g)!=="svelte-1v9qsc5"&&(g.innerHTML=Y),N=r(m),j=p(m,"UL",{"data-svelte-h":!0}),_(j)!=="svelte-15scerc"&&(j.innerHTML=R),z=r(m),J=p(m,"P",{"data-svelte-h":!0}),_(J)!=="svelte-1an3odd"&&(J.innerHTML=I)},m(m,x){d(m,e,x),d(m,n,x),d(m,o,x),d(m,t,x),d(m,g,x),d(m,N,x),d(m,j,x),d(m,z,x),d(m,J,x)},p:Z,d(m){m&&(s(e),s(n),s(o),s(t),s(g),s(N),s(j),s(z),s(J))}}}function xo($){let e,h=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=h},l(n){e=p(n,"P",{"data-svelte-h":!0}),_(e)!=="svelte-fincs2"&&(e.innerHTML=h)},m(n,o){d(n,e,o)},p:Z,d(n){n&&s(e)}}}function Co($){let e,h="Example:",n,o,b;return o=new Re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkZsYXViZXJ0Rm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZmxhdWJlcnQlMkZmbGF1YmVydF9iYXNlX2Nhc2VkJTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZGbGF1YmVydEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmZsYXViZXJ0JTJGZmxhdWJlcnRfYmFzZV9jYXNlZCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTIySGVsbG8lMkMlMjBteSUyMGRvZyUyMGlzJTIwY3V0ZSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBJTBBbG9naXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpLmxvZ2l0cyUwQSUwQXByZWRpY3RlZF9jbGFzc19pZCUyMCUzRCUyMGludCh0Zi5tYXRoLmFyZ21heChsb2dpdHMlMkMlMjBheGlzJTNELTEpJTVCMCU1RCk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFFlaubertForSequenceClassification | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>model = TFFlaubertForSequenceClassification.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(<span class="hljs-string">"Hello, my dog is cute"</span>, return_tensors=<span class="hljs-string">"tf"</span>) | |
| <span class="hljs-meta">>>> </span>logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span>predicted_class_id = <span class="hljs-built_in">int</span>(tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>])`,wrap:!1}}),{c(){e=c("p"),e.textContent=h,n=a(),T(o.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),_(e)!=="svelte-11lpom8"&&(e.textContent=h),n=r(t),y(o.$$.fragment,t)},m(t,g){d(t,e,g),d(t,n,g),M(o,t,g),b=!0},p:Z,i(t){b||(w(o.$$.fragment,t),b=!0)},o(t){k(o.$$.fragment,t),b=!1},d(t){t&&(s(e),s(n)),F(o,t)}}}function jo($){let e,h;return e=new Re({props:{code:"JTIzJTIwVG8lMjB0cmFpbiUyMGElMjBtb2RlbCUyMG9uJTIwJTYwbnVtX2xhYmVscyU2MCUyMGNsYXNzZXMlMkMlMjB5b3UlMjBjYW4lMjBwYXNzJTIwJTYwbnVtX2xhYmVscyUzRG51bV9sYWJlbHMlNjAlMjB0byUyMCU2MC5mcm9tX3ByZXRyYWluZWQoLi4uKSU2MCUwQW51bV9sYWJlbHMlMjAlM0QlMjBsZW4obW9kZWwuY29uZmlnLmlkMmxhYmVsKSUwQW1vZGVsJTIwJTNEJTIwVEZGbGF1YmVydEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmZsYXViZXJ0JTJGZmxhdWJlcnRfYmFzZV9jYXNlZCUyMiUyQyUyMG51bV9sYWJlbHMlM0RudW1fbGFiZWxzKSUwQSUwQWxhYmVscyUyMCUzRCUyMHRmLmNvbnN0YW50KDEpJTBBbG9zcyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKS5sb3Nz",highlighted:'<span class="hljs-meta">>>> </span><span class="hljs-comment"># To train a model on `num_labels` classes, you can pass `num_labels=num_labels` to `.from_pretrained(...)`</span>\n<span class="hljs-meta">>>> </span>num_labels = <span class="hljs-built_in">len</span>(model.config.id2label)\n<span class="hljs-meta">>>> </span>model = TFFlaubertForSequenceClassification.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>, num_labels=num_labels)\n\n<span class="hljs-meta">>>> </span>labels = tf.constant(<span class="hljs-number">1</span>)\n<span class="hljs-meta">>>> </span>loss = model(**inputs, labels=labels).loss',wrap:!1}}),{c(){T(e.$$.fragment)},l(n){y(e.$$.fragment,n)},m(n,o){M(e,n,o),h=!0},p:Z,i(n){h||(w(e.$$.fragment,n),h=!0)},o(n){k(e.$$.fragment,n),h=!1},d(n){F(e,n)}}}function Jo($){let e,h="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,o,b="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,g,Y=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models | |
| and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just | |
| pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second | |
| format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with | |
| the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first | |
| positional argument:`,N,j,R=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: | |
| <code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring: | |
| <code>model({"input_ids": input_ids, "token_type_ids": token_type_ids})</code></li>`,z,J,I=`Note that when creating models and layers with | |
| <a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry | |
| about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=h,n=a(),o=c("ul"),o.innerHTML=b,t=a(),g=c("p"),g.innerHTML=Y,N=a(),j=c("ul"),j.innerHTML=R,z=a(),J=c("p"),J.innerHTML=I},l(m){e=p(m,"P",{"data-svelte-h":!0}),_(e)!=="svelte-1ajbfxg"&&(e.innerHTML=h),n=r(m),o=p(m,"UL",{"data-svelte-h":!0}),_(o)!=="svelte-qm1t26"&&(o.innerHTML=b),t=r(m),g=p(m,"P",{"data-svelte-h":!0}),_(g)!=="svelte-1v9qsc5"&&(g.innerHTML=Y),N=r(m),j=p(m,"UL",{"data-svelte-h":!0}),_(j)!=="svelte-15scerc"&&(j.innerHTML=R),z=r(m),J=p(m,"P",{"data-svelte-h":!0}),_(J)!=="svelte-1an3odd"&&(J.innerHTML=I)},m(m,x){d(m,e,x),d(m,n,x),d(m,o,x),d(m,t,x),d(m,g,x),d(m,N,x),d(m,j,x),d(m,z,x),d(m,J,x)},p:Z,d(m){m&&(s(e),s(n),s(o),s(t),s(g),s(N),s(j),s(z),s(J))}}}function zo($){let e,h=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=h},l(n){e=p(n,"P",{"data-svelte-h":!0}),_(e)!=="svelte-fincs2"&&(e.innerHTML=h)},m(n,o){d(n,e,o)},p:Z,d(n){n&&s(e)}}}function Uo($){let e,h="Example:",n,o,b;return o=new Re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkZsYXViZXJ0Rm9yTXVsdGlwbGVDaG9pY2UlMEFpbXBvcnQlMjB0ZW5zb3JmbG93JTIwYXMlMjB0ZiUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmZsYXViZXJ0JTJGZmxhdWJlcnRfYmFzZV9jYXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMFRGRmxhdWJlcnRGb3JNdWx0aXBsZUNob2ljZS5mcm9tX3ByZXRyYWluZWQoJTIyZmxhdWJlcnQlMkZmbGF1YmVydF9iYXNlX2Nhc2VkJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkluJTIwSXRhbHklMkMlMjBwaXp6YSUyMHNlcnZlZCUyMGluJTIwZm9ybWFsJTIwc2V0dGluZ3MlMkMlMjBzdWNoJTIwYXMlMjBhdCUyMGElMjByZXN0YXVyYW50JTJDJTIwaXMlMjBwcmVzZW50ZWQlMjB1bnNsaWNlZC4lMjIlMEFjaG9pY2UwJTIwJTNEJTIwJTIySXQlMjBpcyUyMGVhdGVuJTIwd2l0aCUyMGElMjBmb3JrJTIwYW5kJTIwYSUyMGtuaWZlLiUyMiUwQWNob2ljZTElMjAlM0QlMjAlMjJJdCUyMGlzJTIwZWF0ZW4lMjB3aGlsZSUyMGhlbGQlMjBpbiUyMHRoZSUyMGhhbmQuJTIyJTBBJTBBZW5jb2RpbmclMjAlM0QlMjB0b2tlbml6ZXIoJTVCcHJvbXB0JTJDJTIwcHJvbXB0JTVEJTJDJTIwJTVCY2hvaWNlMCUyQyUyMGNob2ljZTElNUQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyJTJDJTIwcGFkZGluZyUzRFRydWUpJTBBaW5wdXRzJTIwJTNEJTIwJTdCayUzQSUyMHRmLmV4cGFuZF9kaW1zKHYlMkMlMjAwKSUyMGZvciUyMGslMkMlMjB2JTIwaW4lMjBlbmNvZGluZy5pdGVtcygpJTdEJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0cyklMjAlMjAlMjMlMjBiYXRjaCUyMHNpemUlMjBpcyUyMDElMEElMEElMjMlMjB0aGUlMjBsaW5lYXIlMjBjbGFzc2lmaWVyJTIwc3RpbGwlMjBuZWVkcyUyMHRvJTIwYmUlMjB0cmFpbmVkJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHM=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFFlaubertForMultipleChoice | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>model = TFFlaubertForMultipleChoice.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>prompt = <span class="hljs-string">"In Italy, pizza served in formal settings, such as at a restaurant, is presented unsliced."</span> | |
| <span class="hljs-meta">>>> </span>choice0 = <span class="hljs-string">"It is eaten with a fork and a knife."</span> | |
| <span class="hljs-meta">>>> </span>choice1 = <span class="hljs-string">"It is eaten while held in the hand."</span> | |
| <span class="hljs-meta">>>> </span>encoding = tokenizer([prompt, prompt], [choice0, choice1], return_tensors=<span class="hljs-string">"tf"</span>, padding=<span class="hljs-literal">True</span>) | |
| <span class="hljs-meta">>>> </span>inputs = {k: tf.expand_dims(v, <span class="hljs-number">0</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> encoding.items()} | |
| <span class="hljs-meta">>>> </span>outputs = model(inputs) <span class="hljs-comment"># batch size is 1</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># the linear classifier still needs to be trained</span> | |
| <span class="hljs-meta">>>> </span>logits = outputs.logits`,wrap:!1}}),{c(){e=c("p"),e.textContent=h,n=a(),T(o.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),_(e)!=="svelte-11lpom8"&&(e.textContent=h),n=r(t),y(o.$$.fragment,t)},m(t,g){d(t,e,g),d(t,n,g),M(o,t,g),b=!0},p:Z,i(t){b||(w(o.$$.fragment,t),b=!0)},o(t){k(o.$$.fragment,t),b=!1},d(t){t&&(s(e),s(n)),F(o,t)}}}function No($){let e,h="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,o,b="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,g,Y=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models | |
| and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just | |
| pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second | |
| format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with | |
| the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first | |
| positional argument:`,N,j,R=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: | |
| <code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring: | |
| <code>model({"input_ids": input_ids, "token_type_ids": token_type_ids})</code></li>`,z,J,I=`Note that when creating models and layers with | |
| <a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry | |
| about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=h,n=a(),o=c("ul"),o.innerHTML=b,t=a(),g=c("p"),g.innerHTML=Y,N=a(),j=c("ul"),j.innerHTML=R,z=a(),J=c("p"),J.innerHTML=I},l(m){e=p(m,"P",{"data-svelte-h":!0}),_(e)!=="svelte-1ajbfxg"&&(e.innerHTML=h),n=r(m),o=p(m,"UL",{"data-svelte-h":!0}),_(o)!=="svelte-qm1t26"&&(o.innerHTML=b),t=r(m),g=p(m,"P",{"data-svelte-h":!0}),_(g)!=="svelte-1v9qsc5"&&(g.innerHTML=Y),N=r(m),j=p(m,"UL",{"data-svelte-h":!0}),_(j)!=="svelte-15scerc"&&(j.innerHTML=R),z=r(m),J=p(m,"P",{"data-svelte-h":!0}),_(J)!=="svelte-1an3odd"&&(J.innerHTML=I)},m(m,x){d(m,e,x),d(m,n,x),d(m,o,x),d(m,t,x),d(m,g,x),d(m,N,x),d(m,j,x),d(m,z,x),d(m,J,x)},p:Z,d(m){m&&(s(e),s(n),s(o),s(t),s(g),s(N),s(j),s(z),s(J))}}}function Zo($){let e,h=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=h},l(n){e=p(n,"P",{"data-svelte-h":!0}),_(e)!=="svelte-fincs2"&&(e.innerHTML=h)},m(n,o){d(n,e,o)},p:Z,d(n){n&&s(e)}}}function Io($){let e,h="Example:",n,o,b;return o=new Re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkZsYXViZXJ0Rm9yVG9rZW5DbGFzc2lmaWNhdGlvbiUwQWltcG9ydCUyMHRlbnNvcmZsb3clMjBhcyUyMHRmJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZmxhdWJlcnQlMkZmbGF1YmVydF9iYXNlX2Nhc2VkJTIyKSUwQW1vZGVsJTIwJTNEJTIwVEZGbGF1YmVydEZvclRva2VuQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmZsYXViZXJ0JTJGZmxhdWJlcnRfYmFzZV9jYXNlZCUyMiklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTBBJTIwJTIwJTIwJTIwJTIySHVnZ2luZ0ZhY2UlMjBpcyUyMGElMjBjb21wYW55JTIwYmFzZWQlMjBpbiUyMFBhcmlzJTIwYW5kJTIwTmV3JTIwWW9yayUyMiUyQyUyMGFkZF9zcGVjaWFsX3Rva2VucyUzREZhbHNlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiUwQSklMEElMEFsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyUyMCUzRCUyMHRmLm1hdGguYXJnbWF4KGxvZ2l0cyUyQyUyMGF4aXMlM0QtMSklMEElMEElMjMlMjBOb3RlJTIwdGhhdCUyMHRva2VucyUyMGFyZSUyMGNsYXNzaWZpZWQlMjByYXRoZXIlMjB0aGVuJTIwaW5wdXQlMjB3b3JkcyUyMHdoaWNoJTIwbWVhbnMlMjB0aGF0JTBBJTIzJTIwdGhlcmUlMjBtaWdodCUyMGJlJTIwbW9yZSUyMHByZWRpY3RlZCUyMHRva2VuJTIwY2xhc3NlcyUyMHRoYW4lMjB3b3Jkcy4lMEElMjMlMjBNdWx0aXBsZSUyMHRva2VuJTIwY2xhc3NlcyUyMG1pZ2h0JTIwYWNjb3VudCUyMGZvciUyMHRoZSUyMHNhbWUlMjB3b3JkJTBBcHJlZGljdGVkX3Rva2Vuc19jbGFzc2VzJTIwJTNEJTIwJTVCbW9kZWwuY29uZmlnLmlkMmxhYmVsJTVCdCU1RCUyMGZvciUyMHQlMjBpbiUyMHByZWRpY3RlZF90b2tlbl9jbGFzc19pZHMlNUIwJTVELm51bXB5KCkudG9saXN0KCklNUQ=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFFlaubertForTokenClassification | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>model = TFFlaubertForTokenClassification.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"HuggingFace is a company based in Paris and New York"</span>, add_special_tokens=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">"tf"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>logits = model(**inputs).logits | |
| <span class="hljs-meta">>>> </span>predicted_token_class_ids = tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Note that tokens are classified rather then input words which means that</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># there might be more predicted token classes than words.</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Multiple token classes might account for the same word</span> | |
| <span class="hljs-meta">>>> </span>predicted_tokens_classes = [model.config.id2label[t] <span class="hljs-keyword">for</span> t <span class="hljs-keyword">in</span> predicted_token_class_ids[<span class="hljs-number">0</span>].numpy().tolist()]`,wrap:!1}}),{c(){e=c("p"),e.textContent=h,n=a(),T(o.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),_(e)!=="svelte-11lpom8"&&(e.textContent=h),n=r(t),y(o.$$.fragment,t)},m(t,g){d(t,e,g),d(t,n,g),M(o,t,g),b=!0},p:Z,i(t){b||(w(o.$$.fragment,t),b=!0)},o(t){k(o.$$.fragment,t),b=!1},d(t){t&&(s(e),s(n)),F(o,t)}}}function Wo($){let e,h;return e=new Re({props:{code:"bGFiZWxzJTIwJTNEJTIwcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyUwQWxvc3MlMjAlM0QlMjB0Zi5tYXRoLnJlZHVjZV9tZWFuKG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKS5sb3NzKQ==",highlighted:`<span class="hljs-meta">>>> </span>labels = predicted_token_class_ids | |
| <span class="hljs-meta">>>> </span>loss = tf.math.reduce_mean(model(**inputs, labels=labels).loss)`,wrap:!1}}),{c(){T(e.$$.fragment)},l(n){y(e.$$.fragment,n)},m(n,o){M(e,n,o),h=!0},p:Z,i(n){h||(w(e.$$.fragment,n),h=!0)},o(n){k(e.$$.fragment,n),h=!1},d(n){F(e,n)}}}function qo($){let e,h="TensorFlow models and layers in <code>transformers</code> accept two formats as input:",n,o,b="<li>having all inputs as keyword arguments (like PyTorch models), or</li> <li>having all inputs as a list, tuple or dict in the first positional argument.</li>",t,g,Y=`The reason the second format is supported is that Keras methods prefer this format when passing inputs to models | |
| and layers. Because of this support, when using methods like <code>model.fit()</code> things should “just work” for you - just | |
| pass your inputs and labels in any format that <code>model.fit()</code> supports! If, however, you want to use the second | |
| format outside of Keras methods like <code>fit()</code> and <code>predict()</code>, such as when creating your own layers or models with | |
| the Keras <code>Functional</code> API, there are three possibilities you can use to gather all the input Tensors in the first | |
| positional argument:`,N,j,R=`<li>a single Tensor with <code>input_ids</code> only and nothing else: <code>model(input_ids)</code></li> <li>a list of varying length with one or several input Tensors IN THE ORDER given in the docstring: | |
| <code>model([input_ids, attention_mask])</code> or <code>model([input_ids, attention_mask, token_type_ids])</code></li> <li>a dictionary with one or several input Tensors associated to the input names given in the docstring: | |
| <code>model({"input_ids": input_ids, "token_type_ids": token_type_ids})</code></li>`,z,J,I=`Note that when creating models and layers with | |
| <a href="https://keras.io/guides/making_new_layers_and_models_via_subclassing/" rel="nofollow">subclassing</a> then you don’t need to worry | |
| about any of this, as you can just pass inputs like you would to any other Python function!`;return{c(){e=c("p"),e.innerHTML=h,n=a(),o=c("ul"),o.innerHTML=b,t=a(),g=c("p"),g.innerHTML=Y,N=a(),j=c("ul"),j.innerHTML=R,z=a(),J=c("p"),J.innerHTML=I},l(m){e=p(m,"P",{"data-svelte-h":!0}),_(e)!=="svelte-1ajbfxg"&&(e.innerHTML=h),n=r(m),o=p(m,"UL",{"data-svelte-h":!0}),_(o)!=="svelte-qm1t26"&&(o.innerHTML=b),t=r(m),g=p(m,"P",{"data-svelte-h":!0}),_(g)!=="svelte-1v9qsc5"&&(g.innerHTML=Y),N=r(m),j=p(m,"UL",{"data-svelte-h":!0}),_(j)!=="svelte-15scerc"&&(j.innerHTML=R),z=r(m),J=p(m,"P",{"data-svelte-h":!0}),_(J)!=="svelte-1an3odd"&&(J.innerHTML=I)},m(m,x){d(m,e,x),d(m,n,x),d(m,o,x),d(m,t,x),d(m,g,x),d(m,N,x),d(m,j,x),d(m,z,x),d(m,J,x)},p:Z,d(m){m&&(s(e),s(n),s(o),s(t),s(g),s(N),s(j),s(z),s(J))}}}function Vo($){let e,h=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code> | |
| instance afterwards instead of this since the former takes care of running the pre and post processing steps while | |
| the latter silently ignores them.`;return{c(){e=c("p"),e.innerHTML=h},l(n){e=p(n,"P",{"data-svelte-h":!0}),_(e)!=="svelte-fincs2"&&(e.innerHTML=h)},m(n,o){d(n,e,o)},p:Z,d(n){n&&s(e)}}}function Ho($){let e,h="Example:",n,o,b;return o=new Re({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBURkZsYXViZXJ0Rm9yUXVlc3Rpb25BbnN3ZXJpbmdTaW1wbGUlMEFpbXBvcnQlMjB0ZW5zb3JmbG93JTIwYXMlMjB0ZiUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmZsYXViZXJ0JTJGZmxhdWJlcnRfYmFzZV9jYXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMFRGRmxhdWJlcnRGb3JRdWVzdGlvbkFuc3dlcmluZ1NpbXBsZS5mcm9tX3ByZXRyYWluZWQoJTIyZmxhdWJlcnQlMkZmbGF1YmVydF9iYXNlX2Nhc2VkJTIyKSUwQSUwQXF1ZXN0aW9uJTJDJTIwdGV4dCUyMCUzRCUyMCUyMldobyUyMHdhcyUyMEppbSUyMEhlbnNvbiUzRiUyMiUyQyUyMCUyMkppbSUyMEhlbnNvbiUyMHdhcyUyMGElMjBuaWNlJTIwcHVwcGV0JTIyJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHF1ZXN0aW9uJTJDJTIwdGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUwQWFuc3dlcl9zdGFydF9pbmRleCUyMCUzRCUyMGludCh0Zi5tYXRoLmFyZ21heChvdXRwdXRzLnN0YXJ0X2xvZ2l0cyUyQyUyMGF4aXMlM0QtMSklNUIwJTVEKSUwQWFuc3dlcl9lbmRfaW5kZXglMjAlM0QlMjBpbnQodGYubWF0aC5hcmdtYXgob3V0cHV0cy5lbmRfbG9naXRzJTJDJTIwYXhpcyUzRC0xKSU1QjAlNUQpJTBBJTBBcHJlZGljdF9hbnN3ZXJfdG9rZW5zJTIwJTNEJTIwaW5wdXRzLmlucHV0X2lkcyU1QjAlMkMlMjBhbnN3ZXJfc3RhcnRfaW5kZXglMjAlM0ElMjBhbnN3ZXJfZW5kX2luZGV4JTIwJTJCJTIwMSU1RA==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TFFlaubertForQuestionAnsweringSimple | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf | |
| <span class="hljs-meta">>>> </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>model = TFFlaubertForQuestionAnsweringSimple.from_pretrained(<span class="hljs-string">"flaubert/flaubert_base_cased"</span>) | |
| <span class="hljs-meta">>>> </span>question, text = <span class="hljs-string">"Who was Jim Henson?"</span>, <span class="hljs-string">"Jim Henson was a nice puppet"</span> | |
| <span class="hljs-meta">>>> </span>inputs = tokenizer(question, text, return_tensors=<span class="hljs-string">"tf"</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs) | |
| <span class="hljs-meta">>>> </span>answer_start_index = <span class="hljs-built_in">int</span>(tf.math.argmax(outputs.start_logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>]) | |
| <span class="hljs-meta">>>> </span>answer_end_index = <span class="hljs-built_in">int</span>(tf.math.argmax(outputs.end_logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>]) | |
| <span class="hljs-meta">>>> </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>]`,wrap:!1}}),{c(){e=c("p"),e.textContent=h,n=a(),T(o.$$.fragment)},l(t){e=p(t,"P",{"data-svelte-h":!0}),_(e)!=="svelte-11lpom8"&&(e.textContent=h),n=r(t),y(o.$$.fragment,t)},m(t,g){d(t,e,g),d(t,n,g),M(o,t,g),b=!0},p:Z,i(t){b||(w(o.$$.fragment,t),b=!0)},o(t){k(o.$$.fragment,t),b=!1},d(t){t&&(s(e),s(n)),F(o,t)}}}function Bo($){let e,h;return e=new Re({props:{code:"JTIzJTIwdGFyZ2V0JTIwaXMlMjAlMjJuaWNlJTIwcHVwcGV0JTIyJTBBdGFyZ2V0X3N0YXJ0X2luZGV4JTIwJTNEJTIwdGYuY29uc3RhbnQoJTVCMTQlNUQpJTBBdGFyZ2V0X2VuZF9pbmRleCUyMCUzRCUyMHRmLmNvbnN0YW50KCU1QjE1JTVEKSUwQSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyUyQyUyMHN0YXJ0X3Bvc2l0aW9ucyUzRHRhcmdldF9zdGFydF9pbmRleCUyQyUyMGVuZF9wb3NpdGlvbnMlM0R0YXJnZXRfZW5kX2luZGV4KSUwQWxvc3MlMjAlM0QlMjB0Zi5tYXRoLnJlZHVjZV9tZWFuKG91dHB1dHMubG9zcyk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-comment"># target is "nice puppet"</span> | |
| <span class="hljs-meta">>>> </span>target_start_index = tf.constant([<span class="hljs-number">14</span>]) | |
| <span class="hljs-meta">>>> </span>target_end_index = tf.constant([<span class="hljs-number">15</span>]) | |
| <span class="hljs-meta">>>> </span>outputs = model(**inputs, start_positions=target_start_index, end_positions=target_end_index) | |
| <span class="hljs-meta">>>> </span>loss = tf.math.reduce_mean(outputs.loss)`,wrap:!1}}),{c(){T(e.$$.fragment)},l(n){y(e.$$.fragment,n)},m(n,o){M(e,n,o),h=!0},p:Z,i(n){h||(w(e.$$.fragment,n),h=!0)},o(n){k(e.$$.fragment,n),h=!1},d(n){F(e,n)}}}function Go($){let e,h,n,o,b,t,g="The bare Flaubert Model transformer outputting raw hidden-states without any specific head on top.",Y,N,j=`This model inherits from <a href="/docs/transformers/pr_33512/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,R,z,J=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it | |
| as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and | |
| behavior.`,I,m,x,pe,B,Ft,lt,Se='The <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.TFFlaubertModel">TFFlaubertModel</a> forward method, overrides the <code>__call__</code> special method.',_n,Qe,ze,vt,Nt,ue,ln,K,E,Oe,Ue,Rt=`The Flaubert Model transformer with a language modeling head on top (linear layer with weights tied to the input | |
| embeddings).`,Pt,Ne,Ke=`This model inherits from <a href="/docs/transformers/pr_33512/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,$e,ie,Dt=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it | |
| as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and | |
| behavior.`,Ze,et,le,P,$t,dt,Ye,Ot='The <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.TFFlaubertWithLMHeadModel">TFFlaubertWithLMHeadModel</a> forward method, overrides the <code>__call__</code> special method.',V,xe,Kt,me,dn,ct,ee,A,pt,Ee,St,cn=`Flaubert Model with a sequence classification/regression head on top (a linear layer on top of the pooled output) | |
| e.g. for GLUE tasks.`,de,Ie,ut=`This model inherits from <a href="/docs/transformers/pr_33512/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,xt,We,en=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it | |
| as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and | |
| behavior.`,qe,tt,ce,G,Ce,Ct,nt,bn='The <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.TFFlaubertForSequenceClassification">TFFlaubertForSequenceClassification</a> forward method, overrides the <code>__call__</code> special method.',jt,se,mt,je,Zt,ht,_e,ae,Qt,X,It,tn,re,Jt=`Flaubert 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.`,ot,Ve,Wt=`This model inherits from <a href="/docs/transformers/pr_33512/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,qt,L,ft=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it | |
| as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and | |
| behavior.`,gt,Fe,Yt,be,f,U,ve,S='The <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.TFFlaubertForMultipleChoice">TFFlaubertForMultipleChoice</a> forward method, overrides the <code>__call__</code> special method.',Vt,Ae,te,Te,Mn,zt,kn,ye,st,Fn,_t,vn=`Flaubert 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.`,nn,on,He=`This model inherits from <a href="/docs/transformers/pr_33512/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,sn,pn,Tn=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it | |
| as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and | |
| behavior.`,Nn,Et,un,Pe,an,mn,yn,Zn='The <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.TFFlaubertForTokenClassification">TFFlaubertForTokenClassification</a> forward method, overrides the <code>__call__</code> special method.',at,rt,$n,bt,In,At,Ht,rn,Bt,he,Tt,wn,it,hn=`Flaubert Model with a span classification head on top for extractive question-answering tasks like SQuAD (a linear | |
| layer on top of the hidden-states output to compute <code>span start logits</code> and <code>span end logits</code>).`,xn,Me,fn=`This model inherits from <a href="/docs/transformers/pr_33512/en/main_classes/model#transformers.TFPreTrainedModel">TFPreTrainedModel</a>. Check the superclass documentation for the generic methods the | |
| library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads | |
| etc.)`,Cn,Gt,Wn=`This model is also a <a href="https://www.tensorflow.org/api_docs/python/tf/keras/Model" rel="nofollow">keras.Model</a> subclass. Use it | |
| as a regular TF 2.0 Keras Model and refer to the TF 2.0 documentation for all matter related to general usage and | |
| behavior.`,jn,De,Jn,we,gn,zn,yt,Un='The <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.TFFlaubertForQuestionAnsweringSimple">TFFlaubertForQuestionAnsweringSimple</a> forward method, overrides the <code>__call__</code> special method.',u,C,Mt,fe,wt,ge,Be;return e=new Le({props:{title:"TFFlaubertModel",local:"transformers.TFFlaubertModel",headingTag:"h2"}}),o=new H({props:{name:"class transformers.TFFlaubertModel",anchor:"transformers.TFFlaubertModel",parameters:[{name:"config",val:""},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFFlaubertModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig">FlaubertConfig</a>) — 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/pr_33512/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/vr_33512/src/transformers/models/flaubert/modeling_tf_flaubert.py#L240"}}),m=new Je({props:{$$slots:{default:[yo]},$$scope:{ctx:$}}}),B=new H({props:{name:"call",anchor:"transformers.TFFlaubertModel.call",parameters:[{name:"input_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"langs",val:": np.ndarray | tf.Tensor | None = None"},{name:"token_type_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"lengths",val:": np.ndarray | tf.Tensor | None = None"},{name:"cache",val:": Optional[Dict[str, tf.Tensor]] = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFFlaubertModel.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_33512/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and | |
| <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFFlaubertModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>1</code> for tokens that are <strong>not masked</strong>,</li> | |
| <li><code>0</code> 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.TFFlaubertModel.call.langs",description:`<strong>langs</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| A parallel sequence of tokens to be used to indicate the language of each token in the input. Indices are | |
| languages ids which can be obtained from the language names by using two conversion mappings provided in | |
| the configuration of the model (only provided for multilingual models). More precisely, the <em>language name | |
| to language id</em> mapping is in <code>model.config.lang2id</code> (which is a dictionary string to int) and the | |
| <em>language id to language name</em> mapping is in <code>model.config.id2lang</code> (dictionary int to string).</p> | |
| <p>See usage examples detailed in the <a href="../multilingual">multilingual documentation</a>.`,name:"langs"},{anchor:"transformers.TFFlaubertModel.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>0</code> corresponds to a <em>sentence A</em> token,</li> | |
| <li><code>1</code> 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.TFFlaubertModel.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.TFFlaubertModel.call.lengths",description:`<strong>lengths</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Length of each sentence that can be used to avoid performing attention on padding token indices. You can | |
| also use <em>attention_mask</em> for the same result (see above), kept here for compatibility Indices selected in | |
| <code>[0, ..., input_ids.size(-1)]</code>:`,name:"lengths"},{anchor:"transformers.TFFlaubertModel.call.cache",description:`<strong>cache</strong> (<code>Dict[str, tf.Tensor]</code>, <em>optional</em>) — | |
| Dictionary string to <code>tf.FloatTensor</code> that contains precomputed hidden states (key and values in the | |
| attention blocks) as computed by the model (see <code>cache</code> output below). Can be used to speed up sequential | |
| decoding.</p> | |
| <p>The dictionary object will be modified in-place during the forward pass to add newly computed | |
| hidden-states.`,name:"cache"},{anchor:"transformers.TFFlaubertModel.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>1</code> indicates the head is <strong>not masked</strong>,</li> | |
| <li><code>0</code> indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.TFFlaubertModel.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFFlaubertModel.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the | |
| config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFFlaubertModel.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail. This argument can be used only in eager mode, in graph mode the value in the config will be | |
| used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFFlaubertModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_33512/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in | |
| eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFFlaubertModel.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to use the model in training mode (some modules like dropout modules have different | |
| behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/vr_33512/src/transformers/models/flaubert/modeling_tf_flaubert.py#L249",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutput" | |
| >transformers.modeling_tf_outputs.TFBaseModelOutput</a> or a tuple of <code>tf.Tensor</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/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig" | |
| >FlaubertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>last_hidden_state</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) — Sequence of hidden-states at the output of the last layer of the model.</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(tf.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + 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 initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</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:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutput" | |
| >transformers.modeling_tf_outputs.TFBaseModelOutput</a> or <code>tuple(tf.Tensor)</code></p> | |
| `}}),Qe=new Je({props:{$$slots:{default:[Mo]},$$scope:{ctx:$}}}),vt=new Xe({props:{anchor:"transformers.TFFlaubertModel.call.example",$$slots:{default:[wo]},$$scope:{ctx:$}}}),ue=new Le({props:{title:"TFFlaubertWithLMHeadModel",local:"transformers.TFFlaubertWithLMHeadModel",headingTag:"h2"}}),E=new H({props:{name:"class transformers.TFFlaubertWithLMHeadModel",anchor:"transformers.TFFlaubertWithLMHeadModel",parameters:[{name:"config",val:""},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFFlaubertWithLMHeadModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig">FlaubertConfig</a>) — 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/pr_33512/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/vr_33512/src/transformers/models/flaubert/modeling_tf_flaubert.py#L816"}}),et=new Je({props:{$$slots:{default:[ko]},$$scope:{ctx:$}}}),$t=new H({props:{name:"call",anchor:"transformers.TFFlaubertWithLMHeadModel.call",parameters:[{name:"input_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"langs",val:": np.ndarray | tf.Tensor | None = None"},{name:"token_type_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"lengths",val:": np.ndarray | tf.Tensor | None = None"},{name:"cache",val:": Optional[Dict[str, tf.Tensor]] = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFFlaubertWithLMHeadModel.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_33512/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and | |
| <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFFlaubertWithLMHeadModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>1</code> for tokens that are <strong>not masked</strong>,</li> | |
| <li><code>0</code> 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.TFFlaubertWithLMHeadModel.call.langs",description:`<strong>langs</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| A parallel sequence of tokens to be used to indicate the language of each token in the input. Indices are | |
| languages ids which can be obtained from the language names by using two conversion mappings provided in | |
| the configuration of the model (only provided for multilingual models). More precisely, the <em>language name | |
| to language id</em> mapping is in <code>model.config.lang2id</code> (which is a dictionary string to int) and the | |
| <em>language id to language name</em> mapping is in <code>model.config.id2lang</code> (dictionary int to string).</p> | |
| <p>See usage examples detailed in the <a href="../multilingual">multilingual documentation</a>.`,name:"langs"},{anchor:"transformers.TFFlaubertWithLMHeadModel.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>0</code> corresponds to a <em>sentence A</em> token,</li> | |
| <li><code>1</code> 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.TFFlaubertWithLMHeadModel.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.TFFlaubertWithLMHeadModel.call.lengths",description:`<strong>lengths</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Length of each sentence that can be used to avoid performing attention on padding token indices. You can | |
| also use <em>attention_mask</em> for the same result (see above), kept here for compatibility Indices selected in | |
| <code>[0, ..., input_ids.size(-1)]</code>:`,name:"lengths"},{anchor:"transformers.TFFlaubertWithLMHeadModel.call.cache",description:`<strong>cache</strong> (<code>Dict[str, tf.Tensor]</code>, <em>optional</em>) — | |
| Dictionary string to <code>tf.FloatTensor</code> that contains precomputed hidden states (key and values in the | |
| attention blocks) as computed by the model (see <code>cache</code> output below). Can be used to speed up sequential | |
| decoding.</p> | |
| <p>The dictionary object will be modified in-place during the forward pass to add newly computed | |
| hidden-states.`,name:"cache"},{anchor:"transformers.TFFlaubertWithLMHeadModel.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>1</code> indicates the head is <strong>not masked</strong>,</li> | |
| <li><code>0</code> indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.TFFlaubertWithLMHeadModel.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFFlaubertWithLMHeadModel.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the | |
| config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFFlaubertWithLMHeadModel.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail. This argument can be used only in eager mode, in graph mode the value in the config will be | |
| used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFFlaubertWithLMHeadModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_33512/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in | |
| eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFFlaubertWithLMHeadModel.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to use the model in training mode (some modules like dropout modules have different | |
| behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/vr_33512/src/transformers/models/flaubert/modeling_tf_flaubert.py#L852",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <code>transformers.models.flaubert.modeling_tf_flaubert.TFFlaubertWithLMHeadModelOutput</code> or a tuple of <code>tf.Tensor</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/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig" | |
| >FlaubertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) — Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + 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 initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</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:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>transformers.models.flaubert.modeling_tf_flaubert.TFFlaubertWithLMHeadModelOutput</code> or <code>tuple(tf.Tensor)</code></p> | |
| `}}),xe=new Je({props:{$$slots:{default:[Fo]},$$scope:{ctx:$}}}),me=new Xe({props:{anchor:"transformers.TFFlaubertWithLMHeadModel.call.example",$$slots:{default:[vo]},$$scope:{ctx:$}}}),ct=new Le({props:{title:"TFFlaubertForSequenceClassification",local:"transformers.TFFlaubertForSequenceClassification",headingTag:"h2"}}),pt=new H({props:{name:"class transformers.TFFlaubertForSequenceClassification",anchor:"transformers.TFFlaubertForSequenceClassification",parameters:[{name:"config",val:""},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFFlaubertForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig">FlaubertConfig</a>) — 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/pr_33512/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/vr_33512/src/transformers/models/flaubert/modeling_tf_flaubert.py#L912"}}),tt=new Je({props:{$$slots:{default:[$o]},$$scope:{ctx:$}}}),Ce=new H({props:{name:"call",anchor:"transformers.TFFlaubertForSequenceClassification.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"langs",val:": np.ndarray | tf.Tensor | None = None"},{name:"token_type_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"lengths",val:": np.ndarray | tf.Tensor | None = None"},{name:"cache",val:": Optional[Dict[str, tf.Tensor]] = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFFlaubertForSequenceClassification.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_33512/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and | |
| <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFFlaubertForSequenceClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>1</code> for tokens that are <strong>not masked</strong>,</li> | |
| <li><code>0</code> 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.TFFlaubertForSequenceClassification.call.langs",description:`<strong>langs</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| A parallel sequence of tokens to be used to indicate the language of each token in the input. Indices are | |
| languages ids which can be obtained from the language names by using two conversion mappings provided in | |
| the configuration of the model (only provided for multilingual models). More precisely, the <em>language name | |
| to language id</em> mapping is in <code>model.config.lang2id</code> (which is a dictionary string to int) and the | |
| <em>language id to language name</em> mapping is in <code>model.config.id2lang</code> (dictionary int to string).</p> | |
| <p>See usage examples detailed in the <a href="../multilingual">multilingual documentation</a>.`,name:"langs"},{anchor:"transformers.TFFlaubertForSequenceClassification.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>0</code> corresponds to a <em>sentence A</em> token,</li> | |
| <li><code>1</code> 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.TFFlaubertForSequenceClassification.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.TFFlaubertForSequenceClassification.call.lengths",description:`<strong>lengths</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Length of each sentence that can be used to avoid performing attention on padding token indices. You can | |
| also use <em>attention_mask</em> for the same result (see above), kept here for compatibility Indices selected in | |
| <code>[0, ..., input_ids.size(-1)]</code>:`,name:"lengths"},{anchor:"transformers.TFFlaubertForSequenceClassification.call.cache",description:`<strong>cache</strong> (<code>Dict[str, tf.Tensor]</code>, <em>optional</em>) — | |
| Dictionary string to <code>tf.FloatTensor</code> that contains precomputed hidden states (key and values in the | |
| attention blocks) as computed by the model (see <code>cache</code> output below). Can be used to speed up sequential | |
| decoding.</p> | |
| <p>The dictionary object will be modified in-place during the forward pass to add newly computed | |
| hidden-states.`,name:"cache"},{anchor:"transformers.TFFlaubertForSequenceClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>1</code> indicates the head is <strong>not masked</strong>,</li> | |
| <li><code>0</code> indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.TFFlaubertForSequenceClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFFlaubertForSequenceClassification.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the | |
| config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFFlaubertForSequenceClassification.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail. This argument can be used only in eager mode, in graph mode the value in the config will be | |
| used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFFlaubertForSequenceClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_33512/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in | |
| eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFFlaubertForSequenceClassification.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to use the model in training mode (some modules like dropout modules have different | |
| behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFFlaubertForSequenceClassification.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| 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 > 1</code> a classification loss is computed (Cross-Entropy).`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/vr_33512/src/transformers/models/flaubert/modeling_tf_flaubert.py#L928",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput" | |
| >transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or a tuple of <code>tf.Tensor</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/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig" | |
| >FlaubertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, )</code>, <em>optional</em>, returned when <code>labels</code> is provided) — Classification (or regression if config.num_labels==1) loss.</p> | |
| </li> | |
| <li> | |
| <p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, config.num_labels)</code>) — Classification (or regression if config.num_labels==1) scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + 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 initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</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:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput" | |
| >transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p> | |
| `}}),se=new Je({props:{$$slots:{default:[xo]},$$scope:{ctx:$}}}),je=new Xe({props:{anchor:"transformers.TFFlaubertForSequenceClassification.call.example",$$slots:{default:[Co]},$$scope:{ctx:$}}}),ht=new Xe({props:{anchor:"transformers.TFFlaubertForSequenceClassification.call.example-2",$$slots:{default:[jo]},$$scope:{ctx:$}}}),ae=new Le({props:{title:"TFFlaubertForMultipleChoice",local:"transformers.TFFlaubertForMultipleChoice",headingTag:"h2"}}),It=new H({props:{name:"class transformers.TFFlaubertForMultipleChoice",anchor:"transformers.TFFlaubertForMultipleChoice",parameters:[{name:"config",val:""},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFFlaubertForMultipleChoice.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig">FlaubertConfig</a>) — 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/pr_33512/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/vr_33512/src/transformers/models/flaubert/modeling_tf_flaubert.py#L1199"}}),Fe=new Je({props:{$$slots:{default:[Jo]},$$scope:{ctx:$}}}),f=new H({props:{name:"call",anchor:"transformers.TFFlaubertForMultipleChoice.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"langs",val:": np.ndarray | tf.Tensor | None = None"},{name:"token_type_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"lengths",val:": np.ndarray | tf.Tensor | None = None"},{name:"cache",val:": Optional[Dict[str, tf.Tensor]] = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFFlaubertForMultipleChoice.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_33512/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and | |
| <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFFlaubertForMultipleChoice.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>1</code> for tokens that are <strong>not masked</strong>,</li> | |
| <li><code>0</code> 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.TFFlaubertForMultipleChoice.call.langs",description:`<strong>langs</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| A parallel sequence of tokens to be used to indicate the language of each token in the input. Indices are | |
| languages ids which can be obtained from the language names by using two conversion mappings provided in | |
| the configuration of the model (only provided for multilingual models). More precisely, the <em>language name | |
| to language id</em> mapping is in <code>model.config.lang2id</code> (which is a dictionary string to int) and the | |
| <em>language id to language name</em> mapping is in <code>model.config.id2lang</code> (dictionary int to string).</p> | |
| <p>See usage examples detailed in the <a href="../multilingual">multilingual documentation</a>.`,name:"langs"},{anchor:"transformers.TFFlaubertForMultipleChoice.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>0</code> corresponds to a <em>sentence A</em> token,</li> | |
| <li><code>1</code> 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.TFFlaubertForMultipleChoice.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.TFFlaubertForMultipleChoice.call.lengths",description:`<strong>lengths</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Length of each sentence that can be used to avoid performing attention on padding token indices. You can | |
| also use <em>attention_mask</em> for the same result (see above), kept here for compatibility Indices selected in | |
| <code>[0, ..., input_ids.size(-1)]</code>:`,name:"lengths"},{anchor:"transformers.TFFlaubertForMultipleChoice.call.cache",description:`<strong>cache</strong> (<code>Dict[str, tf.Tensor]</code>, <em>optional</em>) — | |
| Dictionary string to <code>tf.FloatTensor</code> that contains precomputed hidden states (key and values in the | |
| attention blocks) as computed by the model (see <code>cache</code> output below). Can be used to speed up sequential | |
| decoding.</p> | |
| <p>The dictionary object will be modified in-place during the forward pass to add newly computed | |
| hidden-states.`,name:"cache"},{anchor:"transformers.TFFlaubertForMultipleChoice.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>1</code> indicates the head is <strong>not masked</strong>,</li> | |
| <li><code>0</code> indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.TFFlaubertForMultipleChoice.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFFlaubertForMultipleChoice.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the | |
| config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFFlaubertForMultipleChoice.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail. This argument can be used only in eager mode, in graph mode the value in the config will be | |
| used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFFlaubertForMultipleChoice.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_33512/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in | |
| eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFFlaubertForMultipleChoice.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to use the model in training mode (some modules like dropout modules have different | |
| behaviors between training and evaluation).`,name:"training"}],source:"https://github.com/huggingface/transformers/blob/vr_33512/src/transformers/models/flaubert/modeling_tf_flaubert.py#L1237",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_tf_outputs.TFMultipleChoiceModelOutput" | |
| >transformers.modeling_tf_outputs.TFMultipleChoiceModelOutput</a> or a tuple of <code>tf.Tensor</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/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig" | |
| >FlaubertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>loss</strong> (<code>tf.Tensor</code> of shape <em>(batch_size, )</em>, <em>optional</em>, returned when <code>labels</code> is provided) — Classification loss.</p> | |
| </li> | |
| <li> | |
| <p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, num_choices)</code>) — <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(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + 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 initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</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:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_tf_outputs.TFMultipleChoiceModelOutput" | |
| >transformers.modeling_tf_outputs.TFMultipleChoiceModelOutput</a> or <code>tuple(tf.Tensor)</code></p> | |
| `}}),Ae=new Je({props:{$$slots:{default:[zo]},$$scope:{ctx:$}}}),Te=new Xe({props:{anchor:"transformers.TFFlaubertForMultipleChoice.call.example",$$slots:{default:[Uo]},$$scope:{ctx:$}}}),zt=new Le({props:{title:"TFFlaubertForTokenClassification",local:"transformers.TFFlaubertForTokenClassification",headingTag:"h2"}}),st=new H({props:{name:"class transformers.TFFlaubertForTokenClassification",anchor:"transformers.TFFlaubertForTokenClassification",parameters:[{name:"config",val:""},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFFlaubertForTokenClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig">FlaubertConfig</a>) — 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/pr_33512/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/vr_33512/src/transformers/models/flaubert/modeling_tf_flaubert.py#L1106"}}),Et=new Je({props:{$$slots:{default:[No]},$$scope:{ctx:$}}}),an=new H({props:{name:"call",anchor:"transformers.TFFlaubertForTokenClassification.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"langs",val:": np.ndarray | tf.Tensor | None = None"},{name:"token_type_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"lengths",val:": np.ndarray | tf.Tensor | None = None"},{name:"cache",val:": Optional[Dict[str, tf.Tensor]] = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFFlaubertForTokenClassification.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_33512/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and | |
| <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFFlaubertForTokenClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>1</code> for tokens that are <strong>not masked</strong>,</li> | |
| <li><code>0</code> 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.TFFlaubertForTokenClassification.call.langs",description:`<strong>langs</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| A parallel sequence of tokens to be used to indicate the language of each token in the input. Indices are | |
| languages ids which can be obtained from the language names by using two conversion mappings provided in | |
| the configuration of the model (only provided for multilingual models). More precisely, the <em>language name | |
| to language id</em> mapping is in <code>model.config.lang2id</code> (which is a dictionary string to int) and the | |
| <em>language id to language name</em> mapping is in <code>model.config.id2lang</code> (dictionary int to string).</p> | |
| <p>See usage examples detailed in the <a href="../multilingual">multilingual documentation</a>.`,name:"langs"},{anchor:"transformers.TFFlaubertForTokenClassification.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>0</code> corresponds to a <em>sentence A</em> token,</li> | |
| <li><code>1</code> 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.TFFlaubertForTokenClassification.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.TFFlaubertForTokenClassification.call.lengths",description:`<strong>lengths</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Length of each sentence that can be used to avoid performing attention on padding token indices. You can | |
| also use <em>attention_mask</em> for the same result (see above), kept here for compatibility Indices selected in | |
| <code>[0, ..., input_ids.size(-1)]</code>:`,name:"lengths"},{anchor:"transformers.TFFlaubertForTokenClassification.call.cache",description:`<strong>cache</strong> (<code>Dict[str, tf.Tensor]</code>, <em>optional</em>) — | |
| Dictionary string to <code>tf.FloatTensor</code> that contains precomputed hidden states (key and values in the | |
| attention blocks) as computed by the model (see <code>cache</code> output below). Can be used to speed up sequential | |
| decoding.</p> | |
| <p>The dictionary object will be modified in-place during the forward pass to add newly computed | |
| hidden-states.`,name:"cache"},{anchor:"transformers.TFFlaubertForTokenClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>1</code> indicates the head is <strong>not masked</strong>,</li> | |
| <li><code>0</code> indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.TFFlaubertForTokenClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFFlaubertForTokenClassification.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the | |
| config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFFlaubertForTokenClassification.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail. This argument can be used only in eager mode, in graph mode the value in the config will be | |
| used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFFlaubertForTokenClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_33512/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in | |
| eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFFlaubertForTokenClassification.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to use the model in training mode (some modules like dropout modules have different | |
| behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFFlaubertForTokenClassification.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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/vr_33512/src/transformers/models/flaubert/modeling_tf_flaubert.py#L1126",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_tf_outputs.TFTokenClassifierOutput" | |
| >transformers.modeling_tf_outputs.TFTokenClassifierOutput</a> or a tuple of <code>tf.Tensor</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/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig" | |
| >FlaubertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(n,)</code>, <em>optional</em>, where n is the number of unmasked labels, returned when <code>labels</code> is provided) — Classification loss.</p> | |
| </li> | |
| <li> | |
| <p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.num_labels)</code>) — Classification scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + 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 initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</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:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_tf_outputs.TFTokenClassifierOutput" | |
| >transformers.modeling_tf_outputs.TFTokenClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p> | |
| `}}),rt=new Je({props:{$$slots:{default:[Zo]},$$scope:{ctx:$}}}),bt=new Xe({props:{anchor:"transformers.TFFlaubertForTokenClassification.call.example",$$slots:{default:[Io]},$$scope:{ctx:$}}}),At=new Xe({props:{anchor:"transformers.TFFlaubertForTokenClassification.call.example-2",$$slots:{default:[Wo]},$$scope:{ctx:$}}}),rn=new Le({props:{title:"TFFlaubertForQuestionAnsweringSimple",local:"transformers.TFFlaubertForQuestionAnsweringSimple",headingTag:"h2"}}),Tt=new H({props:{name:"class transformers.TFFlaubertForQuestionAnsweringSimple",anchor:"transformers.TFFlaubertForQuestionAnsweringSimple",parameters:[{name:"config",val:""},{name:"*inputs",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFFlaubertForQuestionAnsweringSimple.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig">FlaubertConfig</a>) — 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/pr_33512/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/vr_33512/src/transformers/models/flaubert/modeling_tf_flaubert.py#L1002"}}),De=new Je({props:{$$slots:{default:[qo]},$$scope:{ctx:$}}}),gn=new H({props:{name:"call",anchor:"transformers.TFFlaubertForQuestionAnsweringSimple.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"langs",val:": np.ndarray | tf.Tensor | None = None"},{name:"token_type_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"position_ids",val:": np.ndarray | tf.Tensor | None = None"},{name:"lengths",val:": np.ndarray | tf.Tensor | None = None"},{name:"cache",val:": Optional[Dict[str, tf.Tensor]] = None"},{name:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"output_attentions",val:": Optional[bool] = None"},{name:"output_hidden_states",val:": Optional[bool] = None"},{name:"return_dict",val:": Optional[bool] = None"},{name:"start_positions",val:": np.ndarray | tf.Tensor | None = None"},{name:"end_positions",val:": np.ndarray | tf.Tensor | None = None"},{name:"training",val:": bool = False"}],parametersDescription:[{anchor:"transformers.TFFlaubertForQuestionAnsweringSimple.call.input_ids",description:`<strong>input_ids</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — | |
| Indices of input sequence tokens in the vocabulary.</p> | |
| <p>Indices can be obtained using <a href="/docs/transformers/pr_33512/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and | |
| <a href="/docs/transformers/pr_33512/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> for details.</p> | |
| <p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TFFlaubertForQuestionAnsweringSimple.call.attention_mask",description:`<strong>attention_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>1</code> for tokens that are <strong>not masked</strong>,</li> | |
| <li><code>0</code> 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.TFFlaubertForQuestionAnsweringSimple.call.langs",description:`<strong>langs</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| A parallel sequence of tokens to be used to indicate the language of each token in the input. Indices are | |
| languages ids which can be obtained from the language names by using two conversion mappings provided in | |
| the configuration of the model (only provided for multilingual models). More precisely, the <em>language name | |
| to language id</em> mapping is in <code>model.config.lang2id</code> (which is a dictionary string to int) and the | |
| <em>language id to language name</em> mapping is in <code>model.config.id2lang</code> (dictionary int to string).</p> | |
| <p>See usage examples detailed in the <a href="../multilingual">multilingual documentation</a>.`,name:"langs"},{anchor:"transformers.TFFlaubertForQuestionAnsweringSimple.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| Segment token indices to indicate first and second portions of the inputs. Indices are selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>0</code> corresponds to a <em>sentence A</em> token,</li> | |
| <li><code>1</code> 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.TFFlaubertForQuestionAnsweringSimple.call.position_ids",description:`<strong>position_ids</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) — | |
| 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.TFFlaubertForQuestionAnsweringSimple.call.lengths",description:`<strong>lengths</strong> (<code>tf.Tensor</code> or <code>Numpy array</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| Length of each sentence that can be used to avoid performing attention on padding token indices. You can | |
| also use <em>attention_mask</em> for the same result (see above), kept here for compatibility Indices selected in | |
| <code>[0, ..., input_ids.size(-1)]</code>:`,name:"lengths"},{anchor:"transformers.TFFlaubertForQuestionAnsweringSimple.call.cache",description:`<strong>cache</strong> (<code>Dict[str, tf.Tensor]</code>, <em>optional</em>) — | |
| Dictionary string to <code>tf.FloatTensor</code> that contains precomputed hidden states (key and values in the | |
| attention blocks) as computed by the model (see <code>cache</code> output below). Can be used to speed up sequential | |
| decoding.</p> | |
| <p>The dictionary object will be modified in-place during the forward pass to add newly computed | |
| hidden-states.`,name:"cache"},{anchor:"transformers.TFFlaubertForQuestionAnsweringSimple.call.head_mask",description:`<strong>head_mask</strong> (<code>Numpy array</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) — | |
| Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p> | |
| <ul> | |
| <li><code>1</code> indicates the head is <strong>not masked</strong>,</li> | |
| <li><code>0</code> indicates the head is <strong>masked</strong>.</li> | |
| </ul>`,name:"head_mask"},{anchor:"transformers.TFFlaubertForQuestionAnsweringSimple.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) — | |
| Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This | |
| is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the | |
| model’s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFFlaubertForQuestionAnsweringSimple.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned | |
| tensors for more detail. This argument can be used only in eager mode, in graph mode the value in the | |
| config will be used instead.`,name:"output_attentions"},{anchor:"transformers.TFFlaubertForQuestionAnsweringSimple.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for | |
| more detail. This argument can be used only in eager mode, in graph mode the value in the config will be | |
| used instead.`,name:"output_hidden_states"},{anchor:"transformers.TFFlaubertForQuestionAnsweringSimple.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) — | |
| Whether or not to return a <a href="/docs/transformers/pr_33512/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in | |
| eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFFlaubertForQuestionAnsweringSimple.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to use the model in training mode (some modules like dropout modules have different | |
| behaviors between training and evaluation).`,name:"training"},{anchor:"transformers.TFFlaubertForQuestionAnsweringSimple.call.start_positions",description:`<strong>start_positions</strong> (<code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| 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.TFFlaubertForQuestionAnsweringSimple.call.end_positions",description:`<strong>end_positions</strong> (<code>tf.Tensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) — | |
| 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/vr_33512/src/transformers/models/flaubert/modeling_tf_flaubert.py#L1019",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A <a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput" | |
| >transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput</a> or a tuple of <code>tf.Tensor</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/pr_33512/en/model_doc/flaubert#transformers.FlaubertConfig" | |
| >FlaubertConfig</a>) and inputs.</p> | |
| <ul> | |
| <li> | |
| <p><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, )</code>, <em>optional</em>, returned when <code>start_positions</code> and <code>end_positions</code> are provided) — 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>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — Span-start scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>end_logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) — Span-end scores (before SoftMax).</p> | |
| </li> | |
| <li> | |
| <p><strong>hidden_states</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) — Tuple of <code>tf.Tensor</code> (one for the output of the embeddings + 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 initial embedding outputs.</p> | |
| </li> | |
| <li> | |
| <p><strong>attentions</strong> (<code>tuple(tf.Tensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) — Tuple of <code>tf.Tensor</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:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/transformers/pr_33512/en/main_classes/output#transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput" | |
| >transformers.modeling_tf_outputs.TFQuestionAnsweringModelOutput</a> or <code>tuple(tf.Tensor)</code></p> | |
| `}}),C=new Je({props:{$$slots:{default:[Vo]},$$scope:{ctx:$}}}),fe=new Xe({props:{anchor:"transformers.TFFlaubertForQuestionAnsweringSimple.call.example",$$slots:{default:[Ho]},$$scope:{ctx:$}}}),ge=new Xe({props:{anchor:"transformers.TFFlaubertForQuestionAnsweringSimple.call.example-2",$$slots:{default:[Bo]},$$scope:{ctx:$}}}),{c(){T(e.$$.fragment),h=a(),n=c("div"),T(o.$$.fragment),b=a(),t=c("p"),t.textContent=g,Y=a(),N=c("p"),N.innerHTML=j,R=a(),z=c("p"),z.innerHTML=J,I=a(),T(m.$$.fragment),x=a(),pe=c("div"),T(B.$$.fragment),Ft=a(),lt=c("p"),lt.innerHTML=Se,_n=a(),T(Qe.$$.fragment),ze=a(),T(vt.$$.fragment),Nt=a(),T(ue.$$.fragment),ln=a(),K=c("div"),T(E.$$.fragment),Oe=a(),Ue=c("p"),Ue.textContent=Rt,Pt=a(),Ne=c("p"),Ne.innerHTML=Ke,$e=a(),ie=c("p"),ie.innerHTML=Dt,Ze=a(),T(et.$$.fragment),le=a(),P=c("div"),T($t.$$.fragment),dt=a(),Ye=c("p"),Ye.innerHTML=Ot,V=a(),T(xe.$$.fragment),Kt=a(),T(me.$$.fragment),dn=a(),T(ct.$$.fragment),ee=a(),A=c("div"),T(pt.$$.fragment),Ee=a(),St=c("p"),St.textContent=cn,de=a(),Ie=c("p"),Ie.innerHTML=ut,xt=a(),We=c("p"),We.innerHTML=en,qe=a(),T(tt.$$.fragment),ce=a(),G=c("div"),T(Ce.$$.fragment),Ct=a(),nt=c("p"),nt.innerHTML=bn,jt=a(),T(se.$$.fragment),mt=a(),T(je.$$.fragment),Zt=a(),T(ht.$$.fragment),_e=a(),T(ae.$$.fragment),Qt=a(),X=c("div"),T(It.$$.fragment),tn=a(),re=c("p"),re.textContent=Jt,ot=a(),Ve=c("p"),Ve.innerHTML=Wt,qt=a(),L=c("p"),L.innerHTML=ft,gt=a(),T(Fe.$$.fragment),Yt=a(),be=c("div"),T(f.$$.fragment),U=a(),ve=c("p"),ve.innerHTML=S,Vt=a(),T(Ae.$$.fragment),te=a(),T(Te.$$.fragment),Mn=a(),T(zt.$$.fragment),kn=a(),ye=c("div"),T(st.$$.fragment),Fn=a(),_t=c("p"),_t.textContent=vn,nn=a(),on=c("p"),on.innerHTML=He,sn=a(),pn=c("p"),pn.innerHTML=Tn,Nn=a(),T(Et.$$.fragment),un=a(),Pe=c("div"),T(an.$$.fragment),mn=a(),yn=c("p"),yn.innerHTML=Zn,at=a(),T(rt.$$.fragment),$n=a(),T(bt.$$.fragment),In=a(),T(At.$$.fragment),Ht=a(),T(rn.$$.fragment),Bt=a(),he=c("div"),T(Tt.$$.fragment),wn=a(),it=c("p"),it.innerHTML=hn,xn=a(),Me=c("p"),Me.innerHTML=fn,Cn=a(),Gt=c("p"),Gt.innerHTML=Wn,jn=a(),T(De.$$.fragment),Jn=a(),we=c("div"),T(gn.$$.fragment),zn=a(),yt=c("p"),yt.innerHTML=Un,u=a(),T(C.$$.fragment),Mt=a(),T(fe.$$.fragment),wt=a(),T(ge.$$.fragment),this.h()},l(l){y(e.$$.fragment,l),h=r(l),n=p(l,"DIV",{class:!0});var v=q(n);y(o.$$.fragment,v),b=r(v),t=p(v,"P",{"data-svelte-h":!0}),_(t)!=="svelte-1cb8s3w"&&(t.textContent=g),Y=r(v),N=p(v,"P",{"data-svelte-h":!0}),_(N)!=="svelte-670nxi"&&(N.innerHTML=j),R=r(v),z=p(v,"P",{"data-svelte-h":!0}),_(z)!=="svelte-1be7e3c"&&(z.innerHTML=J),I=r(v),y(m.$$.fragment,v),x=r(v),pe=p(v,"DIV",{class:!0});var ne=q(pe);y(B.$$.fragment,ne),Ft=r(ne),lt=p(ne,"P",{"data-svelte-h":!0}),_(lt)!=="svelte-15q1hg0"&&(lt.innerHTML=Se),_n=r(ne),y(Qe.$$.fragment,ne),ze=r(ne),y(vt.$$.fragment,ne),ne.forEach(s),v.forEach(s),Nt=r(l),y(ue.$$.fragment,l),ln=r(l),K=p(l,"DIV",{class:!0});var D=q(K);y(E.$$.fragment,D),Oe=r(D),Ue=p(D,"P",{"data-svelte-h":!0}),_(Ue)!=="svelte-1eostie"&&(Ue.textContent=Rt),Pt=r(D),Ne=p(D,"P",{"data-svelte-h":!0}),_(Ne)!=="svelte-670nxi"&&(Ne.innerHTML=Ke),$e=r(D),ie=p(D,"P",{"data-svelte-h":!0}),_(ie)!=="svelte-1be7e3c"&&(ie.innerHTML=Dt),Ze=r(D),y(et.$$.fragment,D),le=r(D),P=p(D,"DIV",{class:!0});var oe=q(P);y($t.$$.fragment,oe),dt=r(oe),Ye=p(oe,"P",{"data-svelte-h":!0}),_(Ye)!=="svelte-qc1h24"&&(Ye.innerHTML=Ot),V=r(oe),y(xe.$$.fragment,oe),Kt=r(oe),y(me.$$.fragment,oe),oe.forEach(s),D.forEach(s),dn=r(l),y(ct.$$.fragment,l),ee=r(l),A=p(l,"DIV",{class:!0});var O=q(A);y(pt.$$.fragment,O),Ee=r(O),St=p(O,"P",{"data-svelte-h":!0}),_(St)!=="svelte-1rhbm1m"&&(St.textContent=cn),de=r(O),Ie=p(O,"P",{"data-svelte-h":!0}),_(Ie)!=="svelte-670nxi"&&(Ie.innerHTML=ut),xt=r(O),We=p(O,"P",{"data-svelte-h":!0}),_(We)!=="svelte-1be7e3c"&&(We.innerHTML=en),qe=r(O),y(tt.$$.fragment,O),ce=r(O),G=p(O,"DIV",{class:!0});var ke=q(G);y(Ce.$$.fragment,ke),Ct=r(ke),nt=p(ke,"P",{"data-svelte-h":!0}),_(nt)!=="svelte-1meab2s"&&(nt.innerHTML=bn),jt=r(ke),y(se.$$.fragment,ke),mt=r(ke),y(je.$$.fragment,ke),Zt=r(ke),y(ht.$$.fragment,ke),ke.forEach(s),O.forEach(s),_e=r(l),y(ae.$$.fragment,l),Qt=r(l),X=p(l,"DIV",{class:!0});var Q=q(X);y(It.$$.fragment,Q),tn=r(Q),re=p(Q,"P",{"data-svelte-h":!0}),_(re)!=="svelte-s65kar"&&(re.textContent=Jt),ot=r(Q),Ve=p(Q,"P",{"data-svelte-h":!0}),_(Ve)!=="svelte-670nxi"&&(Ve.innerHTML=Wt),qt=r(Q),L=p(Q,"P",{"data-svelte-h":!0}),_(L)!=="svelte-1be7e3c"&&(L.innerHTML=ft),gt=r(Q),y(Fe.$$.fragment,Q),Yt=r(Q),be=p(Q,"DIV",{class:!0});var Ut=q(be);y(f.$$.fragment,Ut),U=r(Ut),ve=p(Ut,"P",{"data-svelte-h":!0}),_(ve)!=="svelte-qpxow4"&&(ve.innerHTML=S),Vt=r(Ut),y(Ae.$$.fragment,Ut),te=r(Ut),y(Te.$$.fragment,Ut),Ut.forEach(s),Q.forEach(s),Mn=r(l),y(zt.$$.fragment,l),kn=r(l),ye=p(l,"DIV",{class:!0});var Ge=q(ye);y(st.$$.fragment,Ge),Fn=r(Ge),_t=p(Ge,"P",{"data-svelte-h":!0}),_(_t)!=="svelte-xixmts"&&(_t.textContent=vn),nn=r(Ge),on=p(Ge,"P",{"data-svelte-h":!0}),_(on)!=="svelte-670nxi"&&(on.innerHTML=He),sn=r(Ge),pn=p(Ge,"P",{"data-svelte-h":!0}),_(pn)!=="svelte-1be7e3c"&&(pn.innerHTML=Tn),Nn=r(Ge),y(Et.$$.fragment,Ge),un=r(Ge),Pe=p(Ge,"DIV",{class:!0});var Xt=q(Pe);y(an.$$.fragment,Xt),mn=r(Xt),yn=p(Xt,"P",{"data-svelte-h":!0}),_(yn)!=="svelte-1kwpq2i"&&(yn.innerHTML=Zn),at=r(Xt),y(rt.$$.fragment,Xt),$n=r(Xt),y(bt.$$.fragment,Xt),In=r(Xt),y(At.$$.fragment,Xt),Xt.forEach(s),Ge.forEach(s),Ht=r(l),y(rn.$$.fragment,l),Bt=r(l),he=p(l,"DIV",{class:!0});var kt=q(he);y(Tt.$$.fragment,kt),wn=r(kt),it=p(kt,"P",{"data-svelte-h":!0}),_(it)!=="svelte-t1jv55"&&(it.innerHTML=hn),xn=r(kt),Me=p(kt,"P",{"data-svelte-h":!0}),_(Me)!=="svelte-670nxi"&&(Me.innerHTML=fn),Cn=r(kt),Gt=p(kt,"P",{"data-svelte-h":!0}),_(Gt)!=="svelte-1be7e3c"&&(Gt.innerHTML=Wn),jn=r(kt),y(De.$$.fragment,kt),Jn=r(kt),we=p(kt,"DIV",{class:!0});var Lt=q(we);y(gn.$$.fragment,Lt),zn=r(Lt),yt=p(Lt,"P",{"data-svelte-h":!0}),_(yt)!=="svelte-10y9a40"&&(yt.innerHTML=Un),u=r(Lt),y(C.$$.fragment,Lt),Mt=r(Lt),y(fe.$$.fragment,Lt),wt=r(Lt),y(ge.$$.fragment,Lt),Lt.forEach(s),kt.forEach(s),this.h()},h(){W(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(n,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(Pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(l,v){M(e,l,v),d(l,h,v),d(l,n,v),M(o,n,null),i(n,b),i(n,t),i(n,Y),i(n,N),i(n,R),i(n,z),i(n,I),M(m,n,null),i(n,x),i(n,pe),M(B,pe,null),i(pe,Ft),i(pe,lt),i(pe,_n),M(Qe,pe,null),i(pe,ze),M(vt,pe,null),d(l,Nt,v),M(ue,l,v),d(l,ln,v),d(l,K,v),M(E,K,null),i(K,Oe),i(K,Ue),i(K,Pt),i(K,Ne),i(K,$e),i(K,ie),i(K,Ze),M(et,K,null),i(K,le),i(K,P),M($t,P,null),i(P,dt),i(P,Ye),i(P,V),M(xe,P,null),i(P,Kt),M(me,P,null),d(l,dn,v),M(ct,l,v),d(l,ee,v),d(l,A,v),M(pt,A,null),i(A,Ee),i(A,St),i(A,de),i(A,Ie),i(A,xt),i(A,We),i(A,qe),M(tt,A,null),i(A,ce),i(A,G),M(Ce,G,null),i(G,Ct),i(G,nt),i(G,jt),M(se,G,null),i(G,mt),M(je,G,null),i(G,Zt),M(ht,G,null),d(l,_e,v),M(ae,l,v),d(l,Qt,v),d(l,X,v),M(It,X,null),i(X,tn),i(X,re),i(X,ot),i(X,Ve),i(X,qt),i(X,L),i(X,gt),M(Fe,X,null),i(X,Yt),i(X,be),M(f,be,null),i(be,U),i(be,ve),i(be,Vt),M(Ae,be,null),i(be,te),M(Te,be,null),d(l,Mn,v),M(zt,l,v),d(l,kn,v),d(l,ye,v),M(st,ye,null),i(ye,Fn),i(ye,_t),i(ye,nn),i(ye,on),i(ye,sn),i(ye,pn),i(ye,Nn),M(Et,ye,null),i(ye,un),i(ye,Pe),M(an,Pe,null),i(Pe,mn),i(Pe,yn),i(Pe,at),M(rt,Pe,null),i(Pe,$n),M(bt,Pe,null),i(Pe,In),M(At,Pe,null),d(l,Ht,v),M(rn,l,v),d(l,Bt,v),d(l,he,v),M(Tt,he,null),i(he,wn),i(he,it),i(he,xn),i(he,Me),i(he,Cn),i(he,Gt),i(he,jn),M(De,he,null),i(he,Jn),i(he,we),M(gn,we,null),i(we,zn),i(we,yt),i(we,u),M(C,we,null),i(we,Mt),M(fe,we,null),i(we,wt),M(ge,we,null),Be=!0},p(l,v){const ne={};v&2&&(ne.$$scope={dirty:v,ctx:l}),m.$set(ne);const D={};v&2&&(D.$$scope={dirty:v,ctx:l}),Qe.$set(D);const oe={};v&2&&(oe.$$scope={dirty:v,ctx:l}),vt.$set(oe);const O={};v&2&&(O.$$scope={dirty:v,ctx:l}),et.$set(O);const ke={};v&2&&(ke.$$scope={dirty:v,ctx:l}),xe.$set(ke);const Q={};v&2&&(Q.$$scope={dirty:v,ctx:l}),me.$set(Q);const Ut={};v&2&&(Ut.$$scope={dirty:v,ctx:l}),tt.$set(Ut);const Ge={};v&2&&(Ge.$$scope={dirty:v,ctx:l}),se.$set(Ge);const Xt={};v&2&&(Xt.$$scope={dirty:v,ctx:l}),je.$set(Xt);const kt={};v&2&&(kt.$$scope={dirty:v,ctx:l}),ht.$set(kt);const Lt={};v&2&&(Lt.$$scope={dirty:v,ctx:l}),Fe.$set(Lt);const qn={};v&2&&(qn.$$scope={dirty:v,ctx:l}),Ae.$set(qn);const Vn={};v&2&&(Vn.$$scope={dirty:v,ctx:l}),Te.$set(Vn);const Hn={};v&2&&(Hn.$$scope={dirty:v,ctx:l}),Et.$set(Hn);const Bn={};v&2&&(Bn.$$scope={dirty:v,ctx:l}),rt.$set(Bn);const Gn={};v&2&&(Gn.$$scope={dirty:v,ctx:l}),bt.$set(Gn);const Xn={};v&2&&(Xn.$$scope={dirty:v,ctx:l}),At.$set(Xn);const Ln={};v&2&&(Ln.$$scope={dirty:v,ctx:l}),De.$set(Ln);const Rn={};v&2&&(Rn.$$scope={dirty:v,ctx:l}),C.$set(Rn);const Sn={};v&2&&(Sn.$$scope={dirty:v,ctx:l}),fe.$set(Sn);const Qn={};v&2&&(Qn.$$scope={dirty:v,ctx:l}),ge.$set(Qn)},i(l){Be||(w(e.$$.fragment,l),w(o.$$.fragment,l),w(m.$$.fragment,l),w(B.$$.fragment,l),w(Qe.$$.fragment,l),w(vt.$$.fragment,l),w(ue.$$.fragment,l),w(E.$$.fragment,l),w(et.$$.fragment,l),w($t.$$.fragment,l),w(xe.$$.fragment,l),w(me.$$.fragment,l),w(ct.$$.fragment,l),w(pt.$$.fragment,l),w(tt.$$.fragment,l),w(Ce.$$.fragment,l),w(se.$$.fragment,l),w(je.$$.fragment,l),w(ht.$$.fragment,l),w(ae.$$.fragment,l),w(It.$$.fragment,l),w(Fe.$$.fragment,l),w(f.$$.fragment,l),w(Ae.$$.fragment,l),w(Te.$$.fragment,l),w(zt.$$.fragment,l),w(st.$$.fragment,l),w(Et.$$.fragment,l),w(an.$$.fragment,l),w(rt.$$.fragment,l),w(bt.$$.fragment,l),w(At.$$.fragment,l),w(rn.$$.fragment,l),w(Tt.$$.fragment,l),w(De.$$.fragment,l),w(gn.$$.fragment,l),w(C.$$.fragment,l),w(fe.$$.fragment,l),w(ge.$$.fragment,l),Be=!0)},o(l){k(e.$$.fragment,l),k(o.$$.fragment,l),k(m.$$.fragment,l),k(B.$$.fragment,l),k(Qe.$$.fragment,l),k(vt.$$.fragment,l),k(ue.$$.fragment,l),k(E.$$.fragment,l),k(et.$$.fragment,l),k($t.$$.fragment,l),k(xe.$$.fragment,l),k(me.$$.fragment,l),k(ct.$$.fragment,l),k(pt.$$.fragment,l),k(tt.$$.fragment,l),k(Ce.$$.fragment,l),k(se.$$.fragment,l),k(je.$$.fragment,l),k(ht.$$.fragment,l),k(ae.$$.fragment,l),k(It.$$.fragment,l),k(Fe.$$.fragment,l),k(f.$$.fragment,l),k(Ae.$$.fragment,l),k(Te.$$.fragment,l),k(zt.$$.fragment,l),k(st.$$.fragment,l),k(Et.$$.fragment,l),k(an.$$.fragment,l),k(rt.$$.fragment,l),k(bt.$$.fragment,l),k(At.$$.fragment,l),k(rn.$$.fragment,l),k(Tt.$$.fragment,l),k(De.$$.fragment,l),k(gn.$$.fragment,l),k(C.$$.fragment,l),k(fe.$$.fragment,l),k(ge.$$.fragment,l),Be=!1},d(l){l&&(s(h),s(n),s(Nt),s(ln),s(K),s(dn),s(ee),s(A),s(_e),s(Qt),s(X),s(Mn),s(kn),s(ye),s(Ht),s(Bt),s(he)),F(e,l),F(o),F(m),F(B),F(Qe),F(vt),F(ue,l),F(E),F(et),F($t),F(xe),F(me),F(ct,l),F(pt),F(tt),F(Ce),F(se),F(je),F(ht),F(ae,l),F(It),F(Fe),F(f),F(Ae),F(Te),F(zt,l),F(st),F(Et),F(an),F(rt),F(bt),F(At),F(rn,l),F(Tt),F(De),F(gn),F(C),F(fe),F(ge)}}}function Xo($){let e,h;return e=new Yn({props:{$$slots:{default:[Go]},$$scope:{ctx:$}}}),{c(){T(e.$$.fragment)},l(n){y(e.$$.fragment,n)},m(n,o){M(e,n,o),h=!0},p(n,o){const b={};o&2&&(b.$$scope={dirty:o,ctx:n}),e.$set(b)},i(n){h||(w(e.$$.fragment,n),h=!0)},o(n){k(e.$$.fragment,n),h=!1},d(n){F(e,n)}}}function Lo($){let e,h,n,o,b,t,g,Y='<a href="https://huggingface.co/models?filter=flaubert"><img alt="Models" src="https://img.shields.io/badge/All_model_pages-flaubert-blueviolet"/></a> <a href="https://huggingface.co/spaces/docs-demos/flaubert_small_cased"><img alt="Spaces" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-Spaces-blue"/></a>',N,j,R,z,J=`The FlauBERT model was proposed in the paper <a href="https://arxiv.org/abs/1912.05372" rel="nofollow">FlauBERT: Unsupervised Language Model Pre-training for French</a> by Hang Le et al. It’s a transformer model pretrained using a masked language | |
| modeling (MLM) objective (like BERT).`,I,m,x="The abstract from the paper is the following:",pe,B,Ft=`<em>Language models have become a key step to achieve state-of-the art results in many different Natural Language | |
| Processing (NLP) tasks. Leveraging the huge amount of unlabeled texts nowadays available, they provide an efficient way | |
| to pre-train continuous word representations that can be fine-tuned for a downstream task, along with their | |
| contextualization at the sentence level. This has been widely demonstrated for English using contextualized | |
| representations (Dai and Le, 2015; Peters et al., 2018; Howard and Ruder, 2018; Radford et al., 2018; Devlin et al., | |
| 2019; Yang et al., 2019b). In this paper, we introduce and share FlauBERT, a model learned on a very large and | |
| heterogeneous French corpus. Models of different sizes are trained using the new CNRS (French National Centre for | |
| Scientific Research) Jean Zay supercomputer. We apply our French language models to diverse NLP tasks (text | |
| classification, paraphrasing, natural language inference, parsing, word sense disambiguation) and show that most of the | |
| time they outperform other pretraining approaches. Different versions of FlauBERT as well as a unified evaluation | |
| protocol for the downstream tasks, called FLUE (French Language Understanding Evaluation), are shared to the research | |
| community for further reproducible experiments in French NLP.</em>`,lt,Se,_n='This model was contributed by <a href="https://huggingface.co/formiel" rel="nofollow">formiel</a>. The original code can be found <a href="https://github.com/getalp/Flaubert" rel="nofollow">here</a>.',Qe,ze,vt="Tips:",Nt,ue,ln="<li>Like RoBERTa, without the sentence ordering prediction (so just trained on the MLM objective).</li>",K,E,Oe,Ue,Rt='<li><a href="../tasks/sequence_classification">Text classification task guide</a></li> <li><a href="../tasks/token_classification">Token classification task guide</a></li> <li><a href="../tasks/question_answering">Question answering task guide</a></li> <li><a href="../tasks/masked_language_modeling">Masked language modeling task guide</a></li> <li><a href="../tasks/multiple_choice">Multiple choice task guide</a></li>',Pt,Ne,Ke,$e,ie,Dt,Ze,et=`This is the configuration class to store the configuration of a <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertModel">FlaubertModel</a> or a <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.TFFlaubertModel">TFFlaubertModel</a>. It is | |
| used to instantiate a FlauBERT 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 FlauBERT | |
| <a href="https://huggingface.co/flaubert/flaubert_base_uncased" rel="nofollow">flaubert/flaubert_base_uncased</a> architecture.`,le,P,$t=`Configuration objects inherit from <a href="/docs/transformers/pr_33512/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the | |
| documentation from <a href="/docs/transformers/pr_33512/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,dt,Ye,Ot,V,xe,Kt,me,dn="Construct a Flaubert tokenizer. Based on Byte-Pair Encoding. The tokenization process is the following:",ct,ee,A=`<li>Moses preprocessing and tokenization.</li> <li>Normalizing all inputs text.</li> <li>The arguments <code>special_tokens</code> and the function <code>set_special_tokens</code>, can be used to add additional symbols (like | |
| ”<strong>classify</strong>”) to a vocabulary.</li> <li>The argument <code>do_lowercase</code> controls lower casing (automatically set for pretrained vocabularies).</li>`,pt,Ee,St=`This tokenizer inherits from <a href="/docs/transformers/pr_33512/en/main_classes/tokenizer#transformers.PreTrainedTokenizer">PreTrainedTokenizer</a> which contains most of the main methods. Users should refer to | |
| this superclass for more information regarding those methods.`,cn,de,Ie,ut,xt,We=`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and | |
| adding special tokens. An XLM sequence has the following format:`,en,qe,tt="<li>single sequence: <code><s> X </s></code></li> <li>pair of sequences: <code><s> A </s> B </s></code></li>",ce,G,Ce,Ct,nt,bn="Converts a sequence of tokens (string) in a single string.",jt,se,mt,je,Zt,ht="Create a mask from the two sequences passed to be used in a sequence-pair classification task. An XLM sequence",_e,ae,Qt,X,It="If <code>token_ids_1</code> is <code>None</code>, this method only returns the first portion of the mask (0s).",tn,re,Jt,ot,Ve,Wt=`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding | |
| special tokens using the tokenizer <code>prepare_for_model</code> method.`,qt,L,ft,gt,Fe,Yt,be;return b=new Le({props:{title:"FlauBERT",local:"flaubert",headingTag:"h1"}}),j=new Le({props:{title:"Overview",local:"overview",headingTag:"h2"}}),E=new Le({props:{title:"Resources",local:"resources",headingTag:"h2"}}),Ne=new Le({props:{title:"FlaubertConfig",local:"transformers.FlaubertConfig",headingTag:"h2"}}),ie=new H({props:{name:"class transformers.FlaubertConfig",anchor:"transformers.FlaubertConfig",parameters:[{name:"pre_norm",val:" = False"},{name:"layerdrop",val:" = 0.0"},{name:"vocab_size",val:" = 30145"},{name:"emb_dim",val:" = 2048"},{name:"n_layers",val:" = 12"},{name:"n_heads",val:" = 16"},{name:"dropout",val:" = 0.1"},{name:"attention_dropout",val:" = 0.1"},{name:"gelu_activation",val:" = True"},{name:"sinusoidal_embeddings",val:" = False"},{name:"causal",val:" = False"},{name:"asm",val:" = False"},{name:"n_langs",val:" = 1"},{name:"use_lang_emb",val:" = True"},{name:"max_position_embeddings",val:" = 512"},{name:"embed_init_std",val:" = 0.02209708691207961"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"init_std",val:" = 0.02"},{name:"bos_index",val:" = 0"},{name:"eos_index",val:" = 1"},{name:"pad_index",val:" = 2"},{name:"unk_index",val:" = 3"},{name:"mask_index",val:" = 5"},{name:"is_encoder",val:" = True"},{name:"summary_type",val:" = 'first'"},{name:"summary_use_proj",val:" = True"},{name:"summary_activation",val:" = None"},{name:"summary_proj_to_labels",val:" = True"},{name:"summary_first_dropout",val:" = 0.1"},{name:"start_n_top",val:" = 5"},{name:"end_n_top",val:" = 5"},{name:"mask_token_id",val:" = 0"},{name:"lang_id",val:" = 0"},{name:"pad_token_id",val:" = 2"},{name:"bos_token_id",val:" = 0"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaubertConfig.pre_norm",description:`<strong>pre_norm</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to apply the layer normalization before or after the feed forward layer following the attention in | |
| each layer (Vaswani et al., Tensor2Tensor for Neural Machine Translation. 2018)`,name:"pre_norm"},{anchor:"transformers.FlaubertConfig.layerdrop",description:`<strong>layerdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) — | |
| Probability to drop layers during training (Fan et al., Reducing Transformer Depth on Demand with | |
| Structured Dropout. ICLR 2020)`,name:"layerdrop"},{anchor:"transformers.FlaubertConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30145) — | |
| Vocabulary size of the FlauBERT model. Defines the number of different tokens that can be represented by | |
| the <code>inputs_ids</code> passed when calling <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.FlaubertModel">FlaubertModel</a> or <a href="/docs/transformers/pr_33512/en/model_doc/flaubert#transformers.TFFlaubertModel">TFFlaubertModel</a>.`,name:"vocab_size"},{anchor:"transformers.FlaubertConfig.emb_dim",description:`<strong>emb_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 2048) — | |
| Dimensionality of the encoder layers and the pooler layer.`,name:"emb_dim"},{anchor:"transformers.FlaubertConfig.n_layer",description:`<strong>n_layer</strong> (<code>int</code>, <em>optional</em>, defaults to 12) — | |
| Number of hidden layers in the Transformer encoder.`,name:"n_layer"},{anchor:"transformers.FlaubertConfig.n_head",description:`<strong>n_head</strong> (<code>int</code>, <em>optional</em>, defaults to 16) — | |
| Number of attention heads for each attention layer in the Transformer encoder.`,name:"n_head"},{anchor:"transformers.FlaubertConfig.dropout",description:`<strong>dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) — | |
| The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout"},{anchor:"transformers.FlaubertConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) — | |
| The dropout probability for the attention mechanism`,name:"attention_dropout"},{anchor:"transformers.FlaubertConfig.gelu_activation",description:`<strong>gelu_activation</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to use a <em>gelu</em> activation instead of <em>relu</em>.`,name:"gelu_activation"},{anchor:"transformers.FlaubertConfig.sinusoidal_embeddings",description:`<strong>sinusoidal_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to use sinusoidal positional embeddings instead of absolute positional embeddings.`,name:"sinusoidal_embeddings"},{anchor:"transformers.FlaubertConfig.causal",description:`<strong>causal</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not the model should behave in a causal manner. Causal models use a triangular attention mask in | |
| order to only attend to the left-side context instead if a bidirectional context.`,name:"causal"},{anchor:"transformers.FlaubertConfig.asm",description:`<strong>asm</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether or not to use an adaptive log softmax projection layer instead of a linear layer for the prediction | |
| layer.`,name:"asm"},{anchor:"transformers.FlaubertConfig.n_langs",description:`<strong>n_langs</strong> (<code>int</code>, <em>optional</em>, defaults to 1) — | |
| The number of languages the model handles. Set to 1 for monolingual models.`,name:"n_langs"},{anchor:"transformers.FlaubertConfig.use_lang_emb",description:`<strong>use_lang_emb</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to use language embeddings. Some models use additional language embeddings, see <a href="http://huggingface.co/transformers/multilingual.html#xlm-language-embeddings" rel="nofollow">the multilingual | |
| models page</a> for information | |
| on how to use them.`,name:"use_lang_emb"},{anchor:"transformers.FlaubertConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 512) — | |
| The maximum sequence length that this model might ever be used with. Typically set this to something large | |
| just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.FlaubertConfig.embed_init_std",description:`<strong>embed_init_std</strong> (<code>float</code>, <em>optional</em>, defaults to 2048^-0.5) — | |
| The standard deviation of the truncated_normal_initializer for initializing the embedding matrices.`,name:"embed_init_std"},{anchor:"transformers.FlaubertConfig.init_std",description:`<strong>init_std</strong> (<code>int</code>, <em>optional</em>, defaults to 50257) — | |
| The standard deviation of the truncated_normal_initializer for initializing all weight matrices except the | |
| embedding matrices.`,name:"init_std"},{anchor:"transformers.FlaubertConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) — | |
| The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.FlaubertConfig.bos_index",description:`<strong>bos_index</strong> (<code>int</code>, <em>optional</em>, defaults to 0) — | |
| The index of the beginning of sentence token in the vocabulary.`,name:"bos_index"},{anchor:"transformers.FlaubertConfig.eos_index",description:`<strong>eos_index</strong> (<code>int</code>, <em>optional</em>, defaults to 1) — | |
| The index of the end of sentence token in the vocabulary.`,name:"eos_index"},{anchor:"transformers.FlaubertConfig.pad_index",description:`<strong>pad_index</strong> (<code>int</code>, <em>optional</em>, defaults to 2) — | |
| The index of the padding token in the vocabulary.`,name:"pad_index"},{anchor:"transformers.FlaubertConfig.unk_index",description:`<strong>unk_index</strong> (<code>int</code>, <em>optional</em>, defaults to 3) — | |
| The index of the unknown token in the vocabulary.`,name:"unk_index"},{anchor:"transformers.FlaubertConfig.mask_index",description:`<strong>mask_index</strong> (<code>int</code>, <em>optional</em>, defaults to 5) — | |
| The index of the masking token in the vocabulary.`,name:"mask_index"},{anchor:"transformers.FlaubertConfig.is_encoder(bool,",description:`<strong>is_encoder(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not the initialized model should be a transformer encoder or decoder as seen in Vaswani et al.`,name:"is_encoder(bool,"},{anchor:"transformers.FlaubertConfig.summary_type",description:`<strong>summary_type</strong> (<code>string</code>, <em>optional</em>, defaults to “first”) — | |
| Argument used when doing sequence summary. Used in the sequence classification and multiple choice models.</p> | |
| <p>Has to be one of the following options:</p> | |
| <ul> | |
| <li><code>"last"</code>: Take the last token hidden state (like XLNet).</li> | |
| <li><code>"first"</code>: Take the first token hidden state (like BERT).</li> | |
| <li><code>"mean"</code>: Take the mean of all tokens hidden states.</li> | |
| <li><code>"cls_index"</code>: Supply a Tensor of classification token position (like GPT/GPT-2).</li> | |
| <li><code>"attn"</code>: Not implemented now, use multi-head attention.</li> | |
| </ul>`,name:"summary_type"},{anchor:"transformers.FlaubertConfig.summary_use_proj",description:`<strong>summary_use_proj</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Argument used when doing sequence summary. Used in the sequence classification and multiple choice models.</p> | |
| <p>Whether or not to add a projection after the vector extraction.`,name:"summary_use_proj"},{anchor:"transformers.FlaubertConfig.summary_activation",description:`<strong>summary_activation</strong> (<code>str</code>, <em>optional</em>) — | |
| Argument used when doing sequence summary. Used in the sequence classification and multiple choice models.</p> | |
| <p>Pass <code>"tanh"</code> for a tanh activation to the output, any other value will result in no activation.`,name:"summary_activation"},{anchor:"transformers.FlaubertConfig.summary_proj_to_labels",description:`<strong>summary_proj_to_labels</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Used in the sequence classification and multiple choice models.</p> | |
| <p>Whether the projection outputs should have <code>config.num_labels</code> or <code>config.hidden_size</code> classes.`,name:"summary_proj_to_labels"},{anchor:"transformers.FlaubertConfig.summary_first_dropout",description:`<strong>summary_first_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) — | |
| Used in the sequence classification and multiple choice models.</p> | |
| <p>The dropout ratio to be used after the projection and activation.`,name:"summary_first_dropout"},{anchor:"transformers.FlaubertConfig.start_n_top",description:`<strong>start_n_top</strong> (<code>int</code>, <em>optional</em>, defaults to 5) — | |
| Used in the SQuAD evaluation script.`,name:"start_n_top"},{anchor:"transformers.FlaubertConfig.end_n_top",description:`<strong>end_n_top</strong> (<code>int</code>, <em>optional</em>, defaults to 5) — | |
| Used in the SQuAD evaluation script.`,name:"end_n_top"},{anchor:"transformers.FlaubertConfig.mask_token_id",description:`<strong>mask_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) — | |
| Model agnostic parameter to identify masked tokens when generating text in an MLM context.`,name:"mask_token_id"},{anchor:"transformers.FlaubertConfig.lang_id",description:`<strong>lang_id</strong> (<code>int</code>, <em>optional</em>, defaults to 1) — | |
| The ID of the language used by the model. This parameter is used when generating text in a given language.`,name:"lang_id"}],source:"https://github.com/huggingface/transformers/blob/vr_33512/src/transformers/models/flaubert/configuration_flaubert.py#L28"}}),Ye=new Le({props:{title:"FlaubertTokenizer",local:"transformers.FlaubertTokenizer",headingTag:"h2"}}),xe=new H({props:{name:"class transformers.FlaubertTokenizer",anchor:"transformers.FlaubertTokenizer",parameters:[{name:"vocab_file",val:""},{name:"merges_file",val:""},{name:"do_lowercase",val:" = False"},{name:"unk_token",val:" = '<unk>'"},{name:"bos_token",val:" = '<s>'"},{name:"sep_token",val:" = '</s>'"},{name:"pad_token",val:" = '<pad>'"},{name:"cls_token",val:" = '</s>'"},{name:"mask_token",val:" = '<special1>'"},{name:"additional_special_tokens",val:" = ['<special0>', '<special1>', '<special2>', '<special3>', '<special4>', '<special5>', '<special6>', '<special7>', '<special8>', '<special9>']"},{name:"lang2id",val:" = None"},{name:"id2lang",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.FlaubertTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) — | |
| Vocabulary file.`,name:"vocab_file"},{anchor:"transformers.FlaubertTokenizer.merges_file",description:`<strong>merges_file</strong> (<code>str</code>) — | |
| Merges file.`,name:"merges_file"},{anchor:"transformers.FlaubertTokenizer.do_lowercase",description:`<strong>do_lowercase</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Controls lower casing.`,name:"do_lowercase"},{anchor:"transformers.FlaubertTokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"<unk>"</code>) — | |
| The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this | |
| token instead.`,name:"unk_token"},{anchor:"transformers.FlaubertTokenizer.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"<s>"</code>) — | |
| The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.</p> | |
| <div class="course-tip bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400"> | |
| <p>When building a sequence using special tokens, this is not the token that is used for the beginning of | |
| sequence. The token used is the <code>cls_token</code>.</p> | |
| </div>`,name:"bos_token"},{anchor:"transformers.FlaubertTokenizer.sep_token",description:`<strong>sep_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"</s>"</code>) — | |
| The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for | |
| sequence classification or for a text and a question for question answering. It is also used as the last | |
| token of a sequence built with special tokens.`,name:"sep_token"},{anchor:"transformers.FlaubertTokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"<pad>"</code>) — | |
| The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.FlaubertTokenizer.cls_token",description:`<strong>cls_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"</s>"</code>) — | |
| The classifier token which is used when doing sequence classification (classification of the whole sequence | |
| instead of per-token classification). It is the first token of the sequence when built with special tokens.`,name:"cls_token"},{anchor:"transformers.FlaubertTokenizer.mask_token",description:`<strong>mask_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"<special1>"</code>) — | |
| The token used for masking values. This is the token used when training this model with masked language | |
| modeling. This is the token which the model will try to predict.`,name:"mask_token"},{anchor:"transformers.FlaubertTokenizer.additional_special_tokens",description:`<strong>additional_special_tokens</strong> (<code>List[str]</code>, <em>optional</em>, defaults to <code>['<special0>', '<special1>', '<special2>', '<special3>', '<special4>', '<special5>', '<special6>', '<special7>', '<special8>', '<special9>']</code>) — | |
| List of additional special tokens.`,name:"additional_special_tokens"},{anchor:"transformers.FlaubertTokenizer.lang2id",description:`<strong>lang2id</strong> (<code>Dict[str, int]</code>, <em>optional</em>) — | |
| Dictionary mapping languages string identifiers to their IDs.`,name:"lang2id"},{anchor:"transformers.FlaubertTokenizer.id2lang",description:`<strong>id2lang</strong> (<code>Dict[int, str]</code>, <em>optional</em>) — | |
| Dictionary mapping language IDs to their string identifiers.`,name:"id2lang"}],source:"https://github.com/huggingface/transformers/blob/vr_33512/src/transformers/models/flaubert/tokenization_flaubert.py#L123"}}),Ie=new H({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.FlaubertTokenizer.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.FlaubertTokenizer.build_inputs_with_special_tokens.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) — | |
| List of IDs to which the special tokens will be added.`,name:"token_ids_0"},{anchor:"transformers.FlaubertTokenizer.build_inputs_with_special_tokens.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) — | |
| Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/vr_33512/src/transformers/models/flaubert/tokenization_flaubert.py#L432",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>List[int]</code></p> | |
| `}}),Ce=new H({props:{name:"convert_tokens_to_string",anchor:"transformers.FlaubertTokenizer.convert_tokens_to_string",parameters:[{name:"tokens",val:""}],source:"https://github.com/huggingface/transformers/blob/vr_33512/src/transformers/models/flaubert/tokenization_flaubert.py#L426"}}),mt=new H({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.FlaubertTokenizer.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = None"}],parametersDescription:[{anchor:"transformers.FlaubertTokenizer.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) — | |
| List of IDs.`,name:"token_ids_0"},{anchor:"transformers.FlaubertTokenizer.create_token_type_ids_from_sequences.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) — | |
| Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/vr_33512/src/transformers/models/flaubert/tokenization_flaubert.py#L489",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>List of <a href="../glossary#token-type-ids">token type IDs</a> according to the given sequence(s).</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>List[int]</code></p> | |
| `}}),ae=new Xe({props:{anchor:"transformers.FlaubertTokenizer.create_token_type_ids_from_sequences.example",$$slots:{default:[to]},$$scope:{ctx:$}}}),Jt=new H({props:{name:"get_special_tokens_mask",anchor:"transformers.FlaubertTokenizer.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": List"},{name:"token_ids_1",val:": Optional = None"},{name:"already_has_special_tokens",val:": bool = False"}],parametersDescription:[{anchor:"transformers.FlaubertTokenizer.get_special_tokens_mask.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) — | |
| List of IDs.`,name:"token_ids_0"},{anchor:"transformers.FlaubertTokenizer.get_special_tokens_mask.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) — | |
| Optional second list of IDs for sequence pairs.`,name:"token_ids_1"},{anchor:"transformers.FlaubertTokenizer.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>) — | |
| 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/vr_33512/src/transformers/models/flaubert/tokenization_flaubert.py#L460",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>List[int]</code></p> | |
| `}}),L=new Kn({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Xo],pytorch:[To]},$$scope:{ctx:$}}}),gt=new eo({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/model_doc/flaubert.md"}}),{c(){e=c("meta"),h=a(),n=c("p"),o=a(),T(b.$$.fragment),t=a(),g=c("div"),g.innerHTML=Y,N=a(),T(j.$$.fragment),R=a(),z=c("p"),z.innerHTML=J,I=a(),m=c("p"),m.textContent=x,pe=a(),B=c("p"),B.innerHTML=Ft,lt=a(),Se=c("p"),Se.innerHTML=_n,Qe=a(),ze=c("p"),ze.textContent=vt,Nt=a(),ue=c("ul"),ue.innerHTML=ln,K=a(),T(E.$$.fragment),Oe=a(),Ue=c("ul"),Ue.innerHTML=Rt,Pt=a(),T(Ne.$$.fragment),Ke=a(),$e=c("div"),T(ie.$$.fragment),Dt=a(),Ze=c("p"),Ze.innerHTML=et,le=a(),P=c("p"),P.innerHTML=$t,dt=a(),T(Ye.$$.fragment),Ot=a(),V=c("div"),T(xe.$$.fragment),Kt=a(),me=c("p"),me.textContent=dn,ct=a(),ee=c("ul"),ee.innerHTML=A,pt=a(),Ee=c("p"),Ee.innerHTML=St,cn=a(),de=c("div"),T(Ie.$$.fragment),ut=a(),xt=c("p"),xt.textContent=We,en=a(),qe=c("ul"),qe.innerHTML=tt,ce=a(),G=c("div"),T(Ce.$$.fragment),Ct=a(),nt=c("p"),nt.textContent=bn,jt=a(),se=c("div"),T(mt.$$.fragment),je=a(),Zt=c("p"),Zt.textContent=ht,_e=a(),T(ae.$$.fragment),Qt=a(),X=c("p"),X.innerHTML=It,tn=a(),re=c("div"),T(Jt.$$.fragment),ot=a(),Ve=c("p"),Ve.innerHTML=Wt,qt=a(),T(L.$$.fragment),ft=a(),T(gt.$$.fragment),Fe=a(),Yt=c("p"),this.h()},l(f){const U=On("svelte-u9bgzb",document.head);e=p(U,"META",{name:!0,content:!0}),U.forEach(s),h=r(f),n=p(f,"P",{}),q(n).forEach(s),o=r(f),y(b.$$.fragment,f),t=r(f),g=p(f,"DIV",{class:!0,"data-svelte-h":!0}),_(g)!=="svelte-b0lg0r"&&(g.innerHTML=Y),N=r(f),y(j.$$.fragment,f),R=r(f),z=p(f,"P",{"data-svelte-h":!0}),_(z)!=="svelte-gg909g"&&(z.innerHTML=J),I=r(f),m=p(f,"P",{"data-svelte-h":!0}),_(m)!=="svelte-vfdo9a"&&(m.textContent=x),pe=r(f),B=p(f,"P",{"data-svelte-h":!0}),_(B)!=="svelte-1h7yb8w"&&(B.innerHTML=Ft),lt=r(f),Se=p(f,"P",{"data-svelte-h":!0}),_(Se)!=="svelte-6p2q5n"&&(Se.innerHTML=_n),Qe=r(f),ze=p(f,"P",{"data-svelte-h":!0}),_(ze)!=="svelte-axv494"&&(ze.textContent=vt),Nt=r(f),ue=p(f,"UL",{"data-svelte-h":!0}),_(ue)!=="svelte-4aw53t"&&(ue.innerHTML=ln),K=r(f),y(E.$$.fragment,f),Oe=r(f),Ue=p(f,"UL",{"data-svelte-h":!0}),_(Ue)!=="svelte-mgusi3"&&(Ue.innerHTML=Rt),Pt=r(f),y(Ne.$$.fragment,f),Ke=r(f),$e=p(f,"DIV",{class:!0});var ve=q($e);y(ie.$$.fragment,ve),Dt=r(ve),Ze=p(ve,"P",{"data-svelte-h":!0}),_(Ze)!=="svelte-1rp9urs"&&(Ze.innerHTML=et),le=r(ve),P=p(ve,"P",{"data-svelte-h":!0}),_(P)!=="svelte-l31ql3"&&(P.innerHTML=$t),ve.forEach(s),dt=r(f),y(Ye.$$.fragment,f),Ot=r(f),V=p(f,"DIV",{class:!0});var S=q(V);y(xe.$$.fragment,S),Kt=r(S),me=p(S,"P",{"data-svelte-h":!0}),_(me)!=="svelte-to8yl7"&&(me.textContent=dn),ct=r(S),ee=p(S,"UL",{"data-svelte-h":!0}),_(ee)!=="svelte-kxyfiq"&&(ee.innerHTML=A),pt=r(S),Ee=p(S,"P",{"data-svelte-h":!0}),_(Ee)!=="svelte-11p952w"&&(Ee.innerHTML=St),cn=r(S),de=p(S,"DIV",{class:!0});var Vt=q(de);y(Ie.$$.fragment,Vt),ut=r(Vt),xt=p(Vt,"P",{"data-svelte-h":!0}),_(xt)!=="svelte-1xo6smc"&&(xt.textContent=We),en=r(Vt),qe=p(Vt,"UL",{"data-svelte-h":!0}),_(qe)!=="svelte-1w73b42"&&(qe.innerHTML=tt),Vt.forEach(s),ce=r(S),G=p(S,"DIV",{class:!0});var Ae=q(G);y(Ce.$$.fragment,Ae),Ct=r(Ae),nt=p(Ae,"P",{"data-svelte-h":!0}),_(nt)!=="svelte-b3k2yi"&&(nt.textContent=bn),Ae.forEach(s),jt=r(S),se=p(S,"DIV",{class:!0});var te=q(se);y(mt.$$.fragment,te),je=r(te),Zt=p(te,"P",{"data-svelte-h":!0}),_(Zt)!=="svelte-17m549d"&&(Zt.textContent=ht),_e=r(te),y(ae.$$.fragment,te),Qt=r(te),X=p(te,"P",{"data-svelte-h":!0}),_(X)!=="svelte-owoxgn"&&(X.innerHTML=It),te.forEach(s),tn=r(S),re=p(S,"DIV",{class:!0});var Te=q(re);y(Jt.$$.fragment,Te),ot=r(Te),Ve=p(Te,"P",{"data-svelte-h":!0}),_(Ve)!=="svelte-1f4f5kp"&&(Ve.innerHTML=Wt),Te.forEach(s),S.forEach(s),qt=r(f),y(L.$$.fragment,f),ft=r(f),y(gt.$$.fragment,f),Fe=r(f),Yt=p(f,"P",{}),q(Yt).forEach(s),this.h()},h(){W(e,"name","hf:doc:metadata"),W(e,"content",Ro),W(g,"class","flex flex-wrap space-x-1"),W($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),W(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(f,U){i(document.head,e),d(f,h,U),d(f,n,U),d(f,o,U),M(b,f,U),d(f,t,U),d(f,g,U),d(f,N,U),M(j,f,U),d(f,R,U),d(f,z,U),d(f,I,U),d(f,m,U),d(f,pe,U),d(f,B,U),d(f,lt,U),d(f,Se,U),d(f,Qe,U),d(f,ze,U),d(f,Nt,U),d(f,ue,U),d(f,K,U),M(E,f,U),d(f,Oe,U),d(f,Ue,U),d(f,Pt,U),M(Ne,f,U),d(f,Ke,U),d(f,$e,U),M(ie,$e,null),i($e,Dt),i($e,Ze),i($e,le),i($e,P),d(f,dt,U),M(Ye,f,U),d(f,Ot,U),d(f,V,U),M(xe,V,null),i(V,Kt),i(V,me),i(V,ct),i(V,ee),i(V,pt),i(V,Ee),i(V,cn),i(V,de),M(Ie,de,null),i(de,ut),i(de,xt),i(de,en),i(de,qe),i(V,ce),i(V,G),M(Ce,G,null),i(G,Ct),i(G,nt),i(V,jt),i(V,se),M(mt,se,null),i(se,je),i(se,Zt),i(se,_e),M(ae,se,null),i(se,Qt),i(se,X),i(V,tn),i(V,re),M(Jt,re,null),i(re,ot),i(re,Ve),d(f,qt,U),M(L,f,U),d(f,ft,U),M(gt,f,U),d(f,Fe,U),d(f,Yt,U),be=!0},p(f,[U]){const ve={};U&2&&(ve.$$scope={dirty:U,ctx:f}),ae.$set(ve);const S={};U&2&&(S.$$scope={dirty:U,ctx:f}),L.$set(S)},i(f){be||(w(b.$$.fragment,f),w(j.$$.fragment,f),w(E.$$.fragment,f),w(Ne.$$.fragment,f),w(ie.$$.fragment,f),w(Ye.$$.fragment,f),w(xe.$$.fragment,f),w(Ie.$$.fragment,f),w(Ce.$$.fragment,f),w(mt.$$.fragment,f),w(ae.$$.fragment,f),w(Jt.$$.fragment,f),w(L.$$.fragment,f),w(gt.$$.fragment,f),be=!0)},o(f){k(b.$$.fragment,f),k(j.$$.fragment,f),k(E.$$.fragment,f),k(Ne.$$.fragment,f),k(ie.$$.fragment,f),k(Ye.$$.fragment,f),k(xe.$$.fragment,f),k(Ie.$$.fragment,f),k(Ce.$$.fragment,f),k(mt.$$.fragment,f),k(ae.$$.fragment,f),k(Jt.$$.fragment,f),k(L.$$.fragment,f),k(gt.$$.fragment,f),be=!1},d(f){f&&(s(h),s(n),s(o),s(t),s(g),s(N),s(R),s(z),s(I),s(m),s(pe),s(B),s(lt),s(Se),s(Qe),s(ze),s(Nt),s(ue),s(K),s(Oe),s(Ue),s(Pt),s(Ke),s($e),s(dt),s(Ot),s(V),s(qt),s(ft),s(Fe),s(Yt)),s(e),F(b,f),F(j,f),F(E,f),F(Ne,f),F(ie),F(Ye,f),F(xe),F(Ie),F(Ce),F(mt),F(ae),F(Jt),F(L,f),F(gt,f)}}}const Ro='{"title":"FlauBERT","local":"flaubert","sections":[{"title":"Overview","local":"overview","sections":[],"depth":2},{"title":"Resources","local":"resources","sections":[],"depth":2},{"title":"FlaubertConfig","local":"transformers.FlaubertConfig","sections":[],"depth":2},{"title":"FlaubertTokenizer","local":"transformers.FlaubertTokenizer","sections":[],"depth":2},{"title":"FlaubertModel","local":"transformers.FlaubertModel","sections":[],"depth":2},{"title":"FlaubertWithLMHeadModel","local":"transformers.FlaubertWithLMHeadModel","sections":[],"depth":2},{"title":"FlaubertForSequenceClassification","local":"transformers.FlaubertForSequenceClassification","sections":[],"depth":2},{"title":"FlaubertForMultipleChoice","local":"transformers.FlaubertForMultipleChoice","sections":[],"depth":2},{"title":"FlaubertForTokenClassification","local":"transformers.FlaubertForTokenClassification","sections":[],"depth":2},{"title":"FlaubertForQuestionAnsweringSimple","local":"transformers.FlaubertForQuestionAnsweringSimple","sections":[],"depth":2},{"title":"FlaubertForQuestionAnswering","local":"transformers.FlaubertForQuestionAnswering","sections":[],"depth":2},{"title":"TFFlaubertModel","local":"transformers.TFFlaubertModel","sections":[],"depth":2},{"title":"TFFlaubertWithLMHeadModel","local":"transformers.TFFlaubertWithLMHeadModel","sections":[],"depth":2},{"title":"TFFlaubertForSequenceClassification","local":"transformers.TFFlaubertForSequenceClassification","sections":[],"depth":2},{"title":"TFFlaubertForMultipleChoice","local":"transformers.TFFlaubertForMultipleChoice","sections":[],"depth":2},{"title":"TFFlaubertForTokenClassification","local":"transformers.TFFlaubertForTokenClassification","sections":[],"depth":2},{"title":"TFFlaubertForQuestionAnsweringSimple","local":"transformers.TFFlaubertForQuestionAnsweringSimple","sections":[],"depth":2}],"depth":1}';function So($){return An(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class es extends Pn{constructor(e){super(),Dn(this,e,So,Lo,En,{})}}export{es as component}; | |
Xet Storage Details
- Size:
- 280 kB
- Xet hash:
- a3d3d0164de35c94d1d833456e12f24537e9835830694167e26de42adfed1f63
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.