import{S as Gb,i as Nb,s as Qb,e as o,k as p,w as b,t as s,M as Rb,c as n,d as t,m as h,a as l,x as j,h as a,b as m,N as Sb,G as e,g as u,y as v,q as J,o as U,B as k,v as xb,L as It}from"../../chunks/vendor-hf-doc-builder.js";import{T as Qs}from"../../chunks/Tip-hf-doc-builder.js";import{D as rt}from"../../chunks/Docstring-hf-doc-builder.js";import{C as ht}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Zt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{F as Dp,M as wn}from"../../chunks/Markdown-hf-doc-builder.js";import{E as yo}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Vb(A){let i,M,d,f,y,c,g,I,E,S,$,Y,ae,w,X,L;return f=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRhcGFzQ29uZmlnJTJDJTIwVGFwYXNGb3JRdWVzdGlvbkFuc3dlcmluZyUwQSUwQSUyMyUyMGZvciUyMGV4YW1wbGUlMkMlMjB0aGUlMjBiYXNlJTIwc2l6ZWQlMjBtb2RlbCUyMHdpdGglMjBkZWZhdWx0JTIwU1FBJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwVGFwYXNGb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGdGFwYXMtYmFzZSUyMiklMEElMEElMjMlMjBvciUyQyUyMHRoZSUyMGJhc2UlMjBzaXplZCUyMG1vZGVsJTIwd2l0aCUyMFdUUSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWclMjAlM0QlMjBUYXBhc0NvbmZpZy5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGdGFwYXMtYmFzZS1maW5ldHVuZWQtd3RxJTIyKSUwQW1vZGVsJTIwJTNEJTIwVGFwYXNGb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGdGFwYXMtYmFzZSUyMiUyQyUyMGNvbmZpZyUzRGNvbmZpZyklMEElMEElMjMlMjBvciUyQyUyMHRoZSUyMGJhc2UlMjBzaXplZCUyMG1vZGVsJTIwd2l0aCUyMFdpa2lTUUwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlnJTIwJTNEJTIwVGFwYXNDb25maWcoJTIyZ29vZ2xlLWJhc2UtZmluZXR1bmVkLXdpa2lzcWwtc3VwZXJ2aXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMFRhcGFzRm9yUXVlc3Rpb25BbnN3ZXJpbmcuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnRhcGFzLWJhc2UlMjIlMkMlMjBjb25maWclM0Rjb25maWcp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TapasConfig, TapasForQuestionAnswering

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># for example, the base sized model with default SQA configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TapasForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># or, the base sized model with WTQ configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config = TapasConfig.from_pretrained(<span class="hljs-string">&quot;google/tapas-base-finetuned-wtq&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TapasForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>, config=config)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># or, the base sized model with WikiSQL configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config = TapasConfig(<span class="hljs-string">&quot;google-base-finetuned-wikisql-supervised&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TapasForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>, config=config)`}}),X=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRhcGFzQ29uZmlnJTJDJTIwVGFwYXNGb3JRdWVzdGlvbkFuc3dlcmluZyUwQSUwQSUyMyUyMHlvdSUyMGNhbiUyMGluaXRpYWxpemUlMjB0aGUlMjBjbGFzc2lmaWNhdGlvbiUyMGhlYWRzJTIwYW55JTIwd2F5JTIweW91JTIwd2FudCUyMChzZWUlMjBkb2NzJTIwb2YlMjBUYXBhc0NvbmZpZyklMEFjb25maWclMjAlM0QlMjBUYXBhc0NvbmZpZyhudW1fYWdncmVnYXRpb25fbGFiZWxzJTNEMyUyQyUyMGF2ZXJhZ2VfbG9naXRzX3Blcl9jZWxsJTNEVHJ1ZSklMEElMjMlMjBpbml0aWFsaXppbmclMjB0aGUlMjBwcmUtdHJhaW5lZCUyMGJhc2UlMjBzaXplZCUyMG1vZGVsJTIwd2l0aCUyMG91ciUyMGN1c3RvbSUyMGNsYXNzaWZpY2F0aW9uJTIwaGVhZHMlMEFtb2RlbCUyMCUzRCUyMFRhcGFzRm9yUXVlc3Rpb25BbnN3ZXJpbmcuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnRhcGFzLWJhc2UlMjIlMkMlMjBjb25maWclM0Rjb25maWcp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TapasConfig, TapasForQuestionAnswering

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># you can initialize the classification heads any way you want (see docs of TapasConfig)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config = TapasConfig(num_aggregation_labels=<span class="hljs-number">3</span>, average_logits_per_cell=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># initializing the pre-trained base sized model with our custom classification heads</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TapasForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>, config=config)`}}),{c(){i=o("p"),M=s("Initializing a model with a pre-trained base and randomly initialized classification heads from the hub can be done as shown below."),d=p(),b(f.$$.fragment),y=p(),c=o("p"),g=s("Of course, you don\u2019t necessarily have to follow one of these three ways in which TAPAS was fine-tuned. You can also experiment by defining any hyperparameters you want when initializing "),I=o("a"),E=s("TapasConfig"),S=s(", and then create a "),$=o("a"),Y=s("TapasForQuestionAnswering"),ae=s(" based on that configuration. For example, if you have a dataset that has both conversational questions and questions that might involve aggregation, then you can do it this way. Here\u2019s an example:"),w=p(),b(X.$$.fragment),this.h()},l(W){i=n(W,"P",{});var x=l(i);M=a(x,"Initializing a model with a pre-trained base and randomly initialized classification heads from the hub can be done as shown below."),x.forEach(t),d=h(W),j(f.$$.fragment,W),y=h(W),c=n(W,"P",{});var z=l(c);g=a(z,"Of course, you don\u2019t necessarily have to follow one of these three ways in which TAPAS was fine-tuned. You can also experiment by defining any hyperparameters you want when initializing "),I=n(z,"A",{href:!0});var F=l(I);E=a(F,"TapasConfig"),F.forEach(t),S=a(z,", and then create a "),$=n(z,"A",{href:!0});var R=l($);Y=a(R,"TapasForQuestionAnswering"),R.forEach(t),ae=a(z," based on that configuration. For example, if you have a dataset that has both conversational questions and questions that might involve aggregation, then you can do it this way. Here\u2019s an example:"),z.forEach(t),w=h(W),j(X.$$.fragment,W),this.h()},h(){m(I,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig"),m($,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering")},m(W,x){u(W,i,x),e(i,M),u(W,d,x),v(f,W,x),u(W,y,x),u(W,c,x),e(c,g),e(c,I),e(I,E),e(c,S),e(c,$),e($,Y),e(c,ae),u(W,w,x),v(X,W,x),L=!0},p:It,i(W){L||(J(f.$$.fragment,W),J(X.$$.fragment,W),L=!0)},o(W){U(f.$$.fragment,W),U(X.$$.fragment,W),L=!1},d(W){W&&t(i),W&&t(d),k(f,W),W&&t(y),W&&t(c),W&&t(w),k(X,W)}}}function Xb(A){let i,M;return i=new wn({props:{$$slots:{default:[Vb]},$$scope:{ctx:A}}}),{c(){b(i.$$.fragment)},l(d){j(i.$$.fragment,d)},m(d,f){v(i,d,f),M=!0},p(d,f){const y={};f&2&&(y.$$scope={dirty:f,ctx:d}),i.$set(y)},i(d){M||(J(i.$$.fragment,d),M=!0)},o(d){U(i.$$.fragment,d),M=!1},d(d){k(i,d)}}}function Yb(A){let i,M,d,f,y,c,g,I,E,S,$,Y,ae,w,X,L,W,x,z;return g=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRhcGFzQ29uZmlnJTJDJTIwVEZUYXBhc0ZvclF1ZXN0aW9uQW5zd2VyaW5nJTBBJTBBJTIzJTIwZm9yJTIwZXhhbXBsZSUyQyUyMHRoZSUyMGJhc2UlMjBzaXplZCUyMG1vZGVsJTIwd2l0aCUyMGRlZmF1bHQlMjBTUUElMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBURlRhcGFzRm9yUXVlc3Rpb25BbnN3ZXJpbmcuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnRhcGFzLWJhc2UlMjIpJTBBJTBBJTIzJTIwb3IlMkMlMjB0aGUlMjBiYXNlJTIwc2l6ZWQlMjBtb2RlbCUyMHdpdGglMjBXVFElMjBjb25maWd1cmF0aW9uJTBBY29uZmlnJTIwJTNEJTIwVGFwYXNDb25maWcuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnRhcGFzLWJhc2UtZmluZXR1bmVkLXd0cSUyMiklMEFtb2RlbCUyMCUzRCUyMFRGVGFwYXNGb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGdGFwYXMtYmFzZSUyMiUyQyUyMGNvbmZpZyUzRGNvbmZpZyklMEElMEElMjMlMjBvciUyQyUyMHRoZSUyMGJhc2UlMjBzaXplZCUyMG1vZGVsJTIwd2l0aCUyMFdpa2lTUUwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlnJTIwJTNEJTIwVGFwYXNDb25maWcoJTIyZ29vZ2xlLWJhc2UtZmluZXR1bmVkLXdpa2lzcWwtc3VwZXJ2aXNlZCUyMiklMEFtb2RlbCUyMCUzRCUyMFRGVGFwYXNGb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIyZ29vZ2xlJTJGdGFwYXMtYmFzZSUyMiUyQyUyMGNvbmZpZyUzRGNvbmZpZyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TapasConfig, TFTapasForQuestionAnswering

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># for example, the base sized model with default SQA configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFTapasForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># or, the base sized model with WTQ configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config = TapasConfig.from_pretrained(<span class="hljs-string">&quot;google/tapas-base-finetuned-wtq&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFTapasForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>, config=config)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># or, the base sized model with WikiSQL configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config = TapasConfig(<span class="hljs-string">&quot;google-base-finetuned-wikisql-supervised&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFTapasForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>, config=config)`}}),x=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRhcGFzQ29uZmlnJTJDJTIwVEZUYXBhc0ZvclF1ZXN0aW9uQW5zd2VyaW5nJTBBJTBBJTIzJTIweW91JTIwY2FuJTIwaW5pdGlhbGl6ZSUyMHRoZSUyMGNsYXNzaWZpY2F0aW9uJTIwaGVhZHMlMjBhbnklMjB3YXklMjB5b3UlMjB3YW50JTIwKHNlZSUyMGRvY3MlMjBvZiUyMFRhcGFzQ29uZmlnKSUwQWNvbmZpZyUyMCUzRCUyMFRhcGFzQ29uZmlnKG51bV9hZ2dyZWdhdGlvbl9sYWJlbHMlM0QzJTJDJTIwYXZlcmFnZV9sb2dpdHNfcGVyX2NlbGwlM0RUcnVlKSUwQSUyMyUyMGluaXRpYWxpemluZyUyMHRoZSUyMHByZS10cmFpbmVkJTIwYmFzZSUyMHNpemVkJTIwbW9kZWwlMjB3aXRoJTIwb3VyJTIwY3VzdG9tJTIwY2xhc3NpZmljYXRpb24lMjBoZWFkcyUwQW1vZGVsJTIwJTNEJTIwVEZUYXBhc0ZvclF1ZXN0aW9uQW5zd2VyaW5nLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ0YXBhcy1iYXNlJTIyJTJDJTIwY29uZmlnJTNEY29uZmlnKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TapasConfig, TFTapasForQuestionAnswering

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># you can initialize the classification heads any way you want (see docs of TapasConfig)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config = TapasConfig(num_aggregation_labels=<span class="hljs-number">3</span>, average_logits_per_cell=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># initializing the pre-trained base sized model with our custom classification heads</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFTapasForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>, config=config)`}}),{c(){i=o("p"),M=s("Initializing a model with a pre-trained base and randomly initialized classification heads from the hub can be done as shown below. Be sure to have installed the "),d=o("a"),f=s("tensorflow_probability"),y=s(" dependency:"),c=p(),b(g.$$.fragment),I=p(),E=o("p"),S=s("Of course, you don\u2019t necessarily have to follow one of these three ways in which TAPAS was fine-tuned. You can also experiment by defining any hyperparameters you want when initializing "),$=o("a"),Y=s("TapasConfig"),ae=s(", and then create a "),w=o("a"),X=s("TFTapasForQuestionAnswering"),L=s(" based on that configuration. For example, if you have a dataset that has both conversational questions and questions that might involve aggregation, then you can do it this way. Here\u2019s an example:"),W=p(),b(x.$$.fragment),this.h()},l(F){i=n(F,"P",{});var R=l(i);M=a(R,"Initializing a model with a pre-trained base and randomly initialized classification heads from the hub can be done as shown below. Be sure to have installed the "),d=n(R,"A",{href:!0,rel:!0});var P=l(d);f=a(P,"tensorflow_probability"),P.forEach(t),y=a(R," dependency:"),R.forEach(t),c=h(F),j(g.$$.fragment,F),I=h(F),E=n(F,"P",{});var ie=l(E);S=a(ie,"Of course, you don\u2019t necessarily have to follow one of these three ways in which TAPAS was fine-tuned. You can also experiment by defining any hyperparameters you want when initializing "),$=n(ie,"A",{href:!0});var me=l($);Y=a(me,"TapasConfig"),me.forEach(t),ae=a(ie,", and then create a "),w=n(ie,"A",{href:!0});var K=l(w);X=a(K,"TFTapasForQuestionAnswering"),K.forEach(t),L=a(ie," based on that configuration. For example, if you have a dataset that has both conversational questions and questions that might involve aggregation, then you can do it this way. Here\u2019s an example:"),ie.forEach(t),W=h(F),j(x.$$.fragment,F),this.h()},h(){m(d,"href","https://github.com/tensorflow/probability"),m(d,"rel","nofollow"),m($,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig"),m(w,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TFTapasForQuestionAnswering")},m(F,R){u(F,i,R),e(i,M),e(i,d),e(d,f),e(i,y),u(F,c,R),v(g,F,R),u(F,I,R),u(F,E,R),e(E,S),e(E,$),e($,Y),e(E,ae),e(E,w),e(w,X),e(E,L),u(F,W,R),v(x,F,R),z=!0},p:It,i(F){z||(J(g.$$.fragment,F),J(x.$$.fragment,F),z=!0)},o(F){U(g.$$.fragment,F),U(x.$$.fragment,F),z=!1},d(F){F&&t(i),F&&t(c),k(g,F),F&&t(I),F&&t(E),F&&t(W),k(x,F)}}}function Db(A){let i,M;return i=new wn({props:{$$slots:{default:[Yb]},$$scope:{ctx:A}}}),{c(){b(i.$$.fragment)},l(d){j(i.$$.fragment,d)},m(d,f){v(i,d,f),M=!0},p(d,f){const y={};f&2&&(y.$$scope={dirty:f,ctx:d}),i.$set(y)},i(d){M||(J(i.$$.fragment,d),M=!0)},o(d){U(i.$$.fragment,d),M=!1},d(d){k(i,d)}}}function Hb(A){let i,M,d,f,y,c,g,I,E,S,$,Y,ae,w,X,L,W,x,z,F,R,P,ie,me,K,ge,pe,ee,Te,q,G,Q,Z,D,V,we,Ce,he,fe,Ee,se,je,Me,Ze,Fe,ve,Be,Ue,ce,We,be,O,Je,H,Re,oe,Se,xe,_,B,He,ye,Pe,Oe,N,Ge,ot,Ne,Qe,Le,de,ke,Ke,Ae,ne,et,Ve,le,Xe,Ie,tt,Bt,Wt,Rs,zt,ys,ts,qt,_s,ut,ze,Ss,$t,re,yt,ss,xs,Gt,ns,Vs,Nt,Qt,Xs,Rt,ls,Ys,St,rs,Ds,xt,Hs,st,Vt,is,Ps,Xt,ds,Os,cs,it,ps,qe,hs,_t,Ls,Yt,Dt,Ks,ea,dt,ta,us,ms,gt,Ht;return it=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRhcGFzVG9rZW5pemVyJTBBaW1wb3J0JTIwcGFuZGFzJTIwYXMlMjBwZCUwQSUwQW1vZGVsX25hbWUlMjAlM0QlMjAlMjJnb29nbGUlMkZ0YXBhcy1iYXNlJTIyJTBBdG9rZW5pemVyJTIwJTNEJTIwVGF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V0cyUyMCUzRCUyMHRva2VuaXplciglMEElMjAlMjAlMjAlMjB0YWJsZSUzRHRhYmxlJTJDJTBBJTIwJTIwJTIwJTIwcXVlcmllcyUzRHF1ZXJpZXMlMkMlMEElMjAlMjAlMjAlMjBhbnN3ZXJfY29vcmRpbmF0ZXMlM0RhbnN3ZXJfY29vcmRpbmF0ZXMlMkMlMEElMjAlMjAlMjAlMjBhbnN3ZXJfdGV4dCUzRGFuc3dlcl90ZXh0JTJDJTBBJTIwJTIwJTIwJTIwcGFkZGluZyUzRCUyMm1heF9sZW5ndGglMjIlMkMlMEElMjAlMjAlMjAlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyJTJDJTBBKSUwQWlucHV0cw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TapasTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

<span class="hljs-meta">&gt;&gt;&gt; </span>model_name = <span class="hljs-string">&quot;google/tapas-base&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = TapasTokenizer.from_pretrained(model_name)

<span class="hljs-meta">&gt;&gt;&gt; </span>data = {<span class="hljs-string">&quot;Actors&quot;</span>: [<span class="hljs-string">&quot;Brad Pitt&quot;</span>, <span class="hljs-string">&quot;Leonardo Di Caprio&quot;</span>, <span class="hljs-string">&quot;George Clooney&quot;</span>], <span class="hljs-string">&quot;Number of movies&quot;</span>: [<span class="hljs-string">&quot;87&quot;</span>, <span class="hljs-string">&quot;53&quot;</span>, <span class="hljs-string">&quot;69&quot;</span>]}
<span class="hljs-meta">&gt;&gt;&gt; </span>queries = [
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;What is the name of the first actor?&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;How many movies has George Clooney played in?&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;What is the total number of movies?&quot;</span>,
<span class="hljs-meta">... </span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>answer_coordinates = [[(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>)], [(<span class="hljs-number">2</span>, <span class="hljs-number">1</span>)], [(<span class="hljs-number">0</span>, <span class="hljs-number">1</span>), (<span class="hljs-number">1</span>, <span class="hljs-number">1</span>), (<span class="hljs-number">2</span>, <span class="hljs-number">1</span>)]]
<span class="hljs-meta">&gt;&gt;&gt; </span>answer_text = [[<span class="hljs-string">&quot;Brad Pitt&quot;</span>], [<span class="hljs-string">&quot;69&quot;</span>], [<span class="hljs-string">&quot;209&quot;</span>]]
<span class="hljs-meta">&gt;&gt;&gt; </span>table = pd.DataFrame.from_dict(data)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(
<span class="hljs-meta">... </span>    table=table,
<span class="hljs-meta">... </span>    queries=queries,
<span class="hljs-meta">... </span>    answer_coordinates=answer_coordinates,
<span class="hljs-meta">... </span>    answer_text=answer_text,
<span class="hljs-meta">... </span>    padding=<span class="hljs-string">&quot;max_length&quot;</span>,
<span class="hljs-meta">... </span>    return_tensors=<span class="hljs-string">&quot;pt&quot;</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs
{<span class="hljs-string">&#x27;input_ids&#x27;</span>: tensor([[ ... ]]), <span class="hljs-string">&#x27;attention_mask&#x27;</span>: tensor([[...]]), <span class="hljs-string">&#x27;token_type_ids&#x27;</span>: tensor([[[...]]]),
<span class="hljs-string">&#x27;numeric_values&#x27;</span>: tensor([[ ... ]]), <span class="hljs-string">&#x27;numeric_values_scale: tensor([[ ... ]]), labels: tensor([[ ... ]])}</span>`}}),gt=new ht({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBwYW5kYXMlMjBhcyUyMHBkJTBBJTBBdHN2X3BhdGglMjAlM0QlMjAlMjJ5b3VyX3BhdGhfdG9fdGhlX3R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m9yJTIwYWdncmVnYXRpb24lMjBjYXNlKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGVuY29kaW5nJTVCJTIyZmxvYXRfYW5zd2VyJTIyJTVEJTIwJTNEJTIwdG9yY2gudGVuc29yKGl0ZW0uZmxvYXRfYW5zd2VyKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMGVuY29kaW5nJTBBJTBBJTIwJTIwJTIwJTIwZGVmJTIwX19sZW5fXyhzZWxmKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMGxlbihzZWxmLmRhdGEpJTBBJTBBJTBBZGF0YSUyMCUzRCUyMHBkLnJlYWRfY3N2KHRzdl9wYXRoJTJDJTIwc2VwJTNEJTIyJTVDdCUyMiklMEF0cmFpbl9kYXRhc2V0JTIwJTNEJTIwVGFibGVEYXRhc2V0KGRhdGElMkMlMjB0b2tlbml6ZXIpJTBBdHJhaW5fZGF0YWxvYWRlciUyMCUzRCUyMHRvcmNoLnV0aWxzLmRhdGEuRGF0YUxvYWRlcih0cmFpbl9kYXRhc2V0JTJDJTIwYmF0Y2hfc2l6ZSUzRDMyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

<span class="hljs-meta">&gt;&gt;&gt; </span>tsv_path = <span class="hljs-string">&quot;your_path_to_the_tsv_file&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>table_csv_path = <span class="hljs-string">&quot;your_path_to_a_directory_containing_all_csv_files&quot;</span>


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">class</span> <span class="hljs-title class_">TableDataset</span>(torch.utils.data.Dataset):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__init__</span>(<span class="hljs-params">self, data, tokenizer</span>):
<span class="hljs-meta">... </span>        self.data = data
<span class="hljs-meta">... </span>        self.tokenizer = tokenizer

<span class="hljs-meta">... </span>    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__getitem__</span>(<span class="hljs-params">self, idx</span>):
<span class="hljs-meta">... </span>        item = data.iloc[idx]
<span class="hljs-meta">... </span>        table = pd.read_csv(table_csv_path + item.table_file).astype(
<span class="hljs-meta">... </span>            <span class="hljs-built_in">str</span>
<span class="hljs-meta">... </span>        )  <span class="hljs-comment"># be sure to make your table data text only</span>
<span class="hljs-meta">... </span>        encoding = self.tokenizer(
<span class="hljs-meta">... </span>            table=table,
<span class="hljs-meta">... </span>            queries=item.question,
<span class="hljs-meta">... </span>            answer_coordinates=item.answer_coordinates,
<span class="hljs-meta">... </span>            answer_text=item.answer_text,
<span class="hljs-meta">... </span>            truncation=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>            padding=<span class="hljs-string">&quot;max_length&quot;</span>,
<span class="hljs-meta">... </span>            return_tensors=<span class="hljs-string">&quot;pt&quot;</span>,
<span class="hljs-meta">... </span>        )
<span class="hljs-meta">... </span>        <span class="hljs-comment"># remove the batch dimension which the tokenizer adds by default</span>
<span class="hljs-meta">... </span>        encoding = {key: val.squeeze(<span class="hljs-number">0</span>) <span class="hljs-keyword">for</span> key, val <span class="hljs-keyword">in</span> encoding.items()}
<span class="hljs-meta">... </span>        <span class="hljs-comment"># add the float_answer which is also required (weak supervision for aggregation case)</span>
<span class="hljs-meta">... </span>        encoding[<span class="hljs-string">&quot;float_answer&quot;</span>] = torch.tensor(item.float_answer)
<span class="hljs-meta">... </span>        <span class="hljs-keyword">return</span> encoding

<span class="hljs-meta">... </span>    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__len__</span>(<span class="hljs-params">self</span>):
<span class="hljs-meta">... </span>        <span class="hljs-keyword">return</span> <span class="hljs-built_in">len</span>(self.data)


<span class="hljs-meta">&gt;&gt;&gt; </span>data = pd.read_csv(tsv_path, sep=<span class="hljs-string">&quot;\\t&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>train_dataset = TableDataset(data, tokenizer)
<span class="hljs-meta">&gt;&gt;&gt; </span>train_dataloader = torch.utils.data.DataLoader(train_dataset, batch_size=<span class="hljs-number">32</span>)`}}),{c(){i=o("p"),M=s("Third, given that you\u2019ve prepared your data in this TSV/CSV format (and corresponding CSV files containing the tabular data), you can then use "),d=o("a"),f=s("TapasTokenizer"),y=s(" to convert table-question pairs into "),c=o("code"),g=s("input_ids"),I=s(", "),E=o("code"),S=s("attention_mask"),$=s(", "),Y=o("code"),ae=s("token_type_ids"),w=s(" and so on. Again, based on which of the three cases you picked above, "),X=o("a"),L=s("TapasForQuestionAnswering"),W=s(` requires different
inputs to be fine-tuned:`),x=p(),z=o("table"),F=o("thead"),R=o("tr"),P=o("th"),ie=o("strong"),me=s("Task"),K=p(),ge=o("th"),pe=o("strong"),ee=s("Required inputs"),Te=p(),q=o("tbody"),G=o("tr"),Q=o("td"),Z=s("Conversational"),D=p(),V=o("td"),we=o("code"),Ce=s("input_ids"),he=s(", "),fe=o("code"),Ee=s("attention_mask"),se=s(", "),je=o("code"),Me=s("token_type_ids"),Ze=s(", "),Fe=o("code"),ve=s("labels"),Be=p(),Ue=o("tr"),ce=o("td"),We=s("Weak supervision for aggregation"),be=p(),O=o("td"),Je=o("code"),H=s("input_ids"),Re=s(", "),oe=o("code"),Se=s("attention_mask"),xe=s(", "),_=o("code"),B=s("token_type_ids"),He=s(", "),ye=o("code"),Pe=s("labels"),Oe=s(", "),N=o("code"),Ge=s("numeric_values"),ot=s(", "),Ne=o("code"),Qe=s("numeric_values_scale"),Le=s(", "),de=o("code"),ke=s("float_answer"),Ke=p(),Ae=o("tr"),ne=o("td"),et=s("Strong supervision for aggregation"),Ve=p(),le=o("td"),Xe=o("code"),Ie=s("input ids"),tt=s(", "),Bt=o("code"),Wt=s("attention mask"),Rs=s(", "),zt=o("code"),ys=s("token type ids"),ts=s(", "),qt=o("code"),_s=s("labels"),ut=s(", "),ze=o("code"),Ss=s("aggregation_labels"),$t=p(),re=o("p"),yt=o("a"),ss=s("TapasTokenizer"),xs=s(" creates the "),Gt=o("code"),ns=s("labels"),Vs=s(", "),Nt=o("code"),Qt=s("numeric_values"),Xs=s(" and "),Rt=o("code"),ls=s("numeric_values_scale"),Ys=s(" based on the "),St=o("code"),rs=s("answer_coordinates"),Ds=s(" and "),xt=o("code"),Hs=s("answer_text"),st=s(" columns of the TSV file. The "),Vt=o("code"),is=s("float_answer"),Ps=s(" and "),Xt=o("code"),ds=s("aggregation_labels"),Os=s(" are already in the TSV file of step 2. Here\u2019s an example:"),cs=p(),b(it.$$.fragment),ps=p(),qe=o("p"),hs=s("Note that "),_t=o("a"),Ls=s("TapasTokenizer"),Yt=s(" expects the data of the table to be "),Dt=o("strong"),Ks=s("text-only"),ea=s(". You can use "),dt=o("code"),ta=s(".astype(str)"),us=s(` on a dataframe to turn it into text-only data.
Of course, this only shows how to encode a single training example. It is advised to create a dataloader to iterate over batches:`),ms=p(),b(gt.$$.fragment),this.h()},l(C){i=n(C,"P",{});var te=l(i);M=a(te,"Third, given that you\u2019ve prepared your data in this TSV/CSV format (and corresponding CSV files containing the tabular data), you can then use "),d=n(te,"A",{href:!0});var ja=l(d);f=a(ja,"TapasTokenizer"),ja.forEach(t),y=a(te," to convert table-question pairs into "),c=n(te,"CODE",{});var sa=l(c);g=a(sa,"input_ids"),sa.forEach(t),I=a(te,", "),E=n(te,"CODE",{});var va=l(E);S=a(va,"attention_mask"),va.forEach(t),$=a(te,", "),Y=n(te,"CODE",{});var ha=l(Y);ae=a(ha,"token_type_ids"),ha.forEach(t),w=a(te," and so on. Again, based on which of the three cases you picked above, "),X=n(te,"A",{href:!0});var Pt=l(X);L=a(Pt,"TapasForQuestionAnswering"),Pt.forEach(t),W=a(te,` requires different
inputs to be fine-tuned:`),te.forEach(t),x=h(C),z=n(C,"TABLE",{});var Tt=l(z);F=n(Tt,"THEAD",{});var aa=l(F);R=n(aa,"TR",{});var wt=l(R);P=n(wt,"TH",{});var Ja=l(P);ie=n(Ja,"STRONG",{});var oa=l(ie);me=a(oa,"Task"),oa.forEach(t),Ja.forEach(t),K=h(wt),ge=n(wt,"TH",{});var Ua=l(ge);pe=n(Ua,"STRONG",{});var ua=l(pe);ee=a(ua,"Required inputs"),ua.forEach(t),Ua.forEach(t),wt.forEach(t),aa.forEach(t),Te=h(Tt),q=n(Tt,"TBODY",{});var nt=l(q);G=n(nt,"TR",{});var fs=l(G);Q=n(fs,"TD",{});var ws=l(Q);Z=a(ws,"Conversational"),ws.forEach(t),D=h(fs),V=n(fs,"TD",{});var ct=l(V);we=n(ct,"CODE",{});var ka=l(we);Ce=a(ka,"input_ids"),ka.forEach(t),he=a(ct,", "),fe=n(ct,"CODE",{});var ma=l(fe);Ee=a(ma,"attention_mask"),ma.forEach(t),se=a(ct,", "),je=n(ct,"CODE",{});var bs=l(je);Me=a(bs,"token_type_ids"),bs.forEach(t),Ze=a(ct,", "),Fe=n(ct,"CODE",{});var na=l(Fe);ve=a(na,"labels"),na.forEach(t),ct.forEach(t),fs.forEach(t),Be=h(nt),Ue=n(nt,"TR",{});var gs=l(Ue);ce=n(gs,"TD",{});var fa=l(ce);We=a(fa,"Weak supervision for aggregation"),fa.forEach(t),be=h(gs),O=n(gs,"TD",{});var _e=l(O);Je=n(_e,"CODE",{});var Ia=l(Je);H=a(Ia,"input_ids"),Ia.forEach(t),Re=a(_e,", "),oe=n(_e,"CODE",{});var js=l(oe);Se=a(js,"attention_mask"),js.forEach(t),xe=a(_e,", "),_=n(_e,"CODE",{});var Ea=l(_);B=a(Ea,"token_type_ids"),Ea.forEach(t),He=a(_e,", "),ye=n(_e,"CODE",{});var Ca=l(ye);Pe=a(Ca,"labels"),Ca.forEach(t),Oe=a(_e,", "),N=n(_e,"CODE",{});var ga=l(N);Ge=a(ga,"numeric_values"),ga.forEach(t),ot=a(_e,", "),Ne=n(_e,"CODE",{});var Et=l(Ne);Qe=a(Et,"numeric_values_scale"),Et.forEach(t),Le=a(_e,", "),de=n(_e,"CODE",{});var la=l(de);ke=a(la,"float_answer"),la.forEach(t),_e.forEach(t),gs.forEach(t),Ke=h(nt),Ae=n(nt,"TR",{});var Ts=l(Ae);ne=n(Ts,"TD",{});var Aa=l(ne);et=a(Aa,"Strong supervision for aggregation"),Aa.forEach(t),Ve=h(Ts),le=n(Ts,"TD",{});var $e=l(le);Xe=n($e,"CODE",{});var Fa=l(Xe);Ie=a(Fa,"input ids"),Fa.forEach(t),tt=a($e,", "),Bt=n($e,"CODE",{});var ra=l(Bt);Wt=a(ra,"attention mask"),ra.forEach(t),Rs=a($e,", "),zt=n($e,"CODE",{});var Za=l(zt);ys=a(Za,"token type ids"),Za.forEach(t),ts=a($e,", "),qt=n($e,"CODE",{});var Ba=l(qt);_s=a(Ba,"labels"),Ba.forEach(t),ut=a($e,", "),ze=n($e,"CODE",{});var Wa=l(ze);Ss=a(Wa,"aggregation_labels"),Wa.forEach(t),$e.forEach(t),Ts.forEach(t),nt.forEach(t),Tt.forEach(t),$t=h(C),re=n(C,"P",{});var ue=l(re);yt=n(ue,"A",{href:!0});var za=l(yt);ss=a(za,"TapasTokenizer"),za.forEach(t),xs=a(ue," creates the "),Gt=n(ue,"CODE",{});var ia=l(Gt);ns=a(ia,"labels"),ia.forEach(t),Vs=a(ue,", "),Nt=n(ue,"CODE",{});var qa=l(Nt);Qt=a(qa,"numeric_values"),qa.forEach(t),Xs=a(ue," and "),Rt=n(ue,"CODE",{});var $a=l(Rt);ls=a($a,"numeric_values_scale"),$a.forEach(t),Ys=a(ue," based on the "),St=n(ue,"CODE",{});var Ta=l(St);rs=a(Ta,"answer_coordinates"),Ta.forEach(t),Ds=a(ue," and "),xt=n(ue,"CODE",{});var vs=l(xt);Hs=a(vs,"answer_text"),vs.forEach(t),st=a(ue," columns of the TSV file. The "),Vt=n(ue,"CODE",{});var Ga=l(Vt);is=a(Ga,"float_answer"),Ga.forEach(t),Ps=a(ue," and "),Xt=n(ue,"CODE",{});var Ma=l(Xt);ds=a(Ma,"aggregation_labels"),Ma.forEach(t),Os=a(ue," are already in the TSV file of step 2. Here\u2019s an example:"),ue.forEach(t),cs=h(C),j(it.$$.fragment,C),ps=h(C),qe=n(C,"P",{});var Ye=l(qe);hs=a(Ye,"Note that "),_t=n(Ye,"A",{href:!0});var da=l(_t);Ls=a(da,"TapasTokenizer"),da.forEach(t),Yt=a(Ye," expects the data of the table to be "),Dt=n(Ye,"STRONG",{});var Ot=l(Dt);Ks=a(Ot,"text-only"),Ot.forEach(t),ea=a(Ye,". You can use "),dt=n(Ye,"CODE",{});var ca=l(dt);ta=a(ca,".astype(str)"),ca.forEach(t),us=a(Ye,` on a dataframe to turn it into text-only data.
Of course, this only shows how to encode a single training example. It is advised to create a dataloader to iterate over batches:`),Ye.forEach(t),ms=h(C),j(gt.$$.fragment,C),this.h()},h(){m(d,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasTokenizer"),m(X,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering"),m(yt,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasTokenizer"),m(_t,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasTokenizer")},m(C,te){u(C,i,te),e(i,M),e(i,d),e(d,f),e(i,y),e(i,c),e(c,g),e(i,I),e(i,E),e(E,S),e(i,$),e(i,Y),e(Y,ae),e(i,w),e(i,X),e(X,L),e(i,W),u(C,x,te),u(C,z,te),e(z,F),e(F,R),e(R,P),e(P,ie),e(ie,me),e(R,K),e(R,ge),e(ge,pe),e(pe,ee),e(z,Te),e(z,q),e(q,G),e(G,Q),e(Q,Z),e(G,D),e(G,V),e(V,we),e(we,Ce),e(V,he),e(V,fe),e(fe,Ee),e(V,se),e(V,je),e(je,Me),e(V,Ze),e(V,Fe),e(Fe,ve),e(q,Be),e(q,Ue),e(Ue,ce),e(ce,We),e(Ue,be),e(Ue,O),e(O,Je),e(Je,H),e(O,Re),e(O,oe),e(oe,Se),e(O,xe),e(O,_),e(_,B),e(O,He),e(O,ye),e(ye,Pe),e(O,Oe),e(O,N),e(N,Ge),e(O,ot),e(O,Ne),e(Ne,Qe),e(O,Le),e(O,de),e(de,ke),e(q,Ke),e(q,Ae),e(Ae,ne),e(ne,et),e(Ae,Ve),e(Ae,le),e(le,Xe),e(Xe,Ie),e(le,tt),e(le,Bt),e(Bt,Wt),e(le,Rs),e(le,zt),e(zt,ys),e(le,ts),e(le,qt),e(qt,_s),e(le,ut),e(le,ze),e(ze,Ss),u(C,$t,te),u(C,re,te),e(re,yt),e(yt,ss),e(re,xs),e(re,Gt),e(Gt,ns),e(re,Vs),e(re,Nt),e(Nt,Qt),e(re,Xs),e(re,Rt),e(Rt,ls),e(re,Ys),e(re,St),e(St,rs),e(re,Ds),e(re,xt),e(xt,Hs),e(re,st),e(re,Vt),e(Vt,is),e(re,Ps),e(re,Xt),e(Xt,ds),e(re,Os),u(C,cs,te),v(it,C,te),u(C,ps,te),u(C,qe,te),e(qe,hs),e(qe,_t),e(_t,Ls),e(qe,Yt),e(qe,Dt),e(Dt,Ks),e(qe,ea),e(qe,dt),e(dt,ta),e(qe,us),u(C,ms,te),v(gt,C,te),Ht=!0},p:It,i(C){Ht||(J(it.$$.fragment,C),J(gt.$$.fragment,C),Ht=!0)},o(C){U(it.$$.fragment,C),U(gt.$$.fragment,C),Ht=!1},d(C){C&&t(i),C&&t(x),C&&t(z),C&&t($t),C&&t(re),C&&t(cs),k(it,C),C&&t(ps),C&&t(qe),C&&t(ms),k(gt,C)}}}function Pb(A){let i,M;return i=new wn({props:{$$slots:{default:[Hb]},$$scope:{ctx:A}}}),{c(){b(i.$$.fragment)},l(d){j(i.$$.fragment,d)},m(d,f){v(i,d,f),M=!0},p(d,f){const y={};f&2&&(y.$$scope={dirty:f,ctx:d}),i.$set(y)},i(d){M||(J(i.$$.fragment,d),M=!0)},o(d){U(i.$$.fragment,d),M=!1},d(d){k(i,d)}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word">from</span> transformers <span class="hljs-keyword">import</span> TapasTokenizer
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

<span class="hljs-meta">&gt;&gt;&gt; </span>model_name = <span class="hljs-string">&quot;google/tapas-base&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = TapasTokenizer.from_pretrained(model_name)

<span class="hljs-meta">&gt;&gt;&gt; </span>data = {<span class="hljs-string">&quot;Actors&quot;</span>: [<span class="hljs-string">&quot;Brad Pitt&quot;</span>, <span class="hljs-string">&quot;Leonardo Di Caprio&quot;</span>, <span class="hljs-string">&quot;George Clooney&quot;</span>], <span class="hljs-string">&quot;Number of movies&quot;</span>: [<span class="hljs-string">&quot;87&quot;</span>, <span class="hljs-string">&quot;53&quot;</span>, <span class="hljs-string">&quot;69&quot;</span>]}
<span class="hljs-meta">&gt;&gt;&gt; </span>queries = [
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;What is the name of the first actor?&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;How many movies has George Clooney played in?&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;What is the total number of movies?&quot;</span>,
<span class="hljs-meta">... </span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>answer_coordinates = [[(<span class="hljs-number">0</span>, <span class="hljs-number">0</span>)], [(<span class="hljs-number">2</span>, <span class="hljs-number">1</span>)], [(<span class="hljs-number">0</span>, <span class="hljs-number">1</span>), (<span class="hljs-number">1</span>, <span class="hljs-number">1</span>), (<span class="hljs-number">2</span>, <span class="hljs-number">1</span>)]]
<span class="hljs-meta">&gt;&gt;&gt; </span>answer_text = [[<span class="hljs-string">&quot;Brad Pitt&quot;</span>], [<span class="hljs-string">&quot;69&quot;</span>], [<span class="hljs-string">&quot;209&quot;</span>]]
<span class="hljs-meta">&gt;&gt;&gt; </span>table = pd.DataFrame.from_dict(data)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(
<span class="hljs-meta">... </span>    table=table,
<span class="hljs-meta">... </span>    queries=queries,
<span class="hljs-meta">... </span>    answer_coordinates=answer_coordinates,
<span class="hljs-meta">... </span>    answer_text=answer_text,
<span class="hljs-meta">... </span>    padding=<span class="hljs-string">&quot;max_length&quot;</span>,
<span class="hljs-meta">... </span>    return_tensors=<span class="hljs-string">&quot;tf&quot;</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs
{<span class="hljs-string">&#x27;input_ids&#x27;</span>: tensor([[ ... ]]), <span class="hljs-string">&#x27;attention_mask&#x27;</span>: tensor([[...]]), <span class="hljs-string">&#x27;token_type_ids&#x27;</span>: tensor([[[...]]]),
<span class="hljs-string">&#x27;numeric_values&#x27;</span>: tensor([[ ... ]]), <span class="hljs-string">&#x27;numeric_values_scale: tensor([[ ... ]]), labels: tensor([[ ... ]])}</span>`}}),gt=new ht({props:{code:" ",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

<span class="hljs-meta">&gt;&gt;&gt; </span>tsv_path = <span class="hljs-string">&quot;your_path_to_the_tsv_file&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>table_csv_path = <span class="hljs-string">&quot;your_path_to_a_directory_containing_all_csv_files&quot;</span>


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">class</span> <span class="hljs-title class_">TableDataset</span>:
<span class="hljs-meta">... </span>    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__init__</span>(<span class="hljs-params">self, data, tokenizer</span>):
<span class="hljs-meta">... </span>        self.data = data
<span class="hljs-meta">... </span>        self.tokenizer = tokenizer

<span class="hljs-meta">... </span>    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__iter__</span>(<span class="hljs-params">self</span>):
<span class="hljs-meta">... </span>        <span class="hljs-keyword">for</span> idx <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(self.__len__()):
<span class="hljs-meta">... </span>            item = self.data.iloc[idx]
<span class="hljs-meta">... </span>            table = pd.read_csv(table_csv_path + item.table_file).astype(
<span class="hljs-meta">... </span>                <span class="hljs-built_in">str</span>
<span class="hljs-meta">... </span>            )  <span class="hljs-comment"># be sure to make your table data text only</span>
<span class="hljs-meta">... </span>            encoding = self.tokenizer(
<span class="hljs-meta">... </span>                table=table,
<span class="hljs-meta">... </span>                queries=item.question,
<span class="hljs-meta">... </span>                answer_coordinates=item.answer_coordinates,
<span class="hljs-meta">... </span>                answer_text=item.answer_text,
<span class="hljs-meta">... </span>                truncation=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>                padding=<span class="hljs-string">&quot;max_length&quot;</span>,
<span class="hljs-meta">... </span>                return_tensors=<span class="hljs-string">&quot;tf&quot;</span>,
<span class="hljs-meta">... </span>            )
<span class="hljs-meta">... </span>            <span class="hljs-comment"># remove the batch dimension which the tokenizer adds by default</span>
<span class="hljs-meta">... </span>            encoding = {key: tf.squeeze(val, <span class="hljs-number">0</span>) <span class="hljs-keyword">for</span> key, val <span class="hljs-keyword">in</span> encoding.items()}
<span class="hljs-meta">... </span>            <span class="hljs-comment"># add the float_answer which is also required (weak supervision for aggregation case)</span>
<span class="hljs-meta">... </span>            encoding[<span class="hljs-string">&quot;float_answer&quot;</span>] = tf.convert_to_tensor(item.float_answer, dtype=tf.float32)
<span class="hljs-meta">... </span>            <span class="hljs-keyword">yield</span> encoding[<span class="hljs-string">&quot;input_ids&quot;</span>], encoding[<span class="hljs-string">&quot;attention_mask&quot;</span>], encoding[<span class="hljs-string">&quot;numeric_values&quot;</span>], encoding[
<span class="hljs-meta">... </span>                <span class="hljs-string">&quot;numeric_values_scale&quot;</span>
<span class="hljs-meta">... </span>            ], encoding[<span class="hljs-string">&quot;token_type_ids&quot;</span>], encoding[<span class="hljs-string">&quot;labels&quot;</span>], encoding[<span class="hljs-string">&quot;float_answer&quot;</span>]

<span class="hljs-meta">... </span>    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__len__</span>(<span class="hljs-params">self</span>):
<span class="hljs-meta">... </span>        <span class="hljs-keyword">return</span> <span class="hljs-built_in">len</span>(self.data)


<span class="hljs-meta">&gt;&gt;&gt; </span>data = pd.read_csv(tsv_path, sep=<span class="hljs-string">&quot;\\t&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>train_dataset = TableDataset(data, tokenizer)
<span class="hljs-meta">&gt;&gt;&gt; </span>output_signature = (
<span class="hljs-meta">... </span>    tf.TensorSpec(shape=(<span class="hljs-number">512</span>,), dtype=tf.int32),
<span class="hljs-meta">... </span>    tf.TensorSpec(shape=(<span class="hljs-number">512</span>,), dtype=tf.int32),
<span class="hljs-meta">... </span>    tf.TensorSpec(shape=(<span class="hljs-number">512</span>,), dtype=tf.float32),
<span class="hljs-meta">... </span>    tf.TensorSpec(shape=(<span class="hljs-number">512</span>,), dtype=tf.float32),
<span class="hljs-meta">... </span>    tf.TensorSpec(shape=(<span class="hljs-number">512</span>, <span class="hljs-number">7</span>), dtype=tf.int32),
<span class="hljs-meta">... </span>    tf.TensorSpec(shape=(<span class="hljs-number">512</span>,), dtype=tf.int32),
<span class="hljs-meta">... </span>    tf.TensorSpec(shape=(<span class="hljs-number">512</span>,), dtype=tf.float32),
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>train_dataloader = tf.data.Dataset.from_generator(train_dataset, output_signature=output_signature).batch(<span class="hljs-number">32</span>)`}}),{c(){i=o("p"),M=s("Third, given that you\u2019ve prepared your data in this TSV/CSV format (and corresponding CSV files containing the tabular data), you can then use "),d=o("a"),f=s("TapasTokenizer"),y=s(" to convert table-question pairs into "),c=o("code"),g=s("input_ids"),I=s(", "),E=o("code"),S=s("attention_mask"),$=s(", "),Y=o("code"),ae=s("token_type_ids"),w=s(" and so on. Again, based on which of the three cases you picked above, "),X=o("a"),L=s("TFTapasForQuestionAnswering"),W=s(` requires different
inputs to be fine-tuned:`),x=p(),z=o("table"),F=o("thead"),R=o("tr"),P=o("th"),ie=o("strong"),me=s("Task"),K=p(),ge=o("th"),pe=o("strong"),ee=s("Required inputs"),Te=p(),q=o("tbody"),G=o("tr"),Q=o("td"),Z=s("Conversational"),D=p(),V=o("td"),we=o("code"),Ce=s("input_ids"),he=s(", "),fe=o("code"),Ee=s("attention_mask"),se=s(", "),je=o("code"),Me=s("token_type_ids"),Ze=s(", "),Fe=o("code"),ve=s("labels"),Be=p(),Ue=o("tr"),ce=o("td"),We=s("Weak supervision for aggregation"),be=p(),O=o("td"),Je=o("code"),H=s("input_ids"),Re=s(", "),oe=o("code"),Se=s("attention_mask"),xe=s(", "),_=o("code"),B=s("token_type_ids"),He=s(", "),ye=o("code"),Pe=s("labels"),Oe=s(", "),N=o("code"),Ge=s("numeric_values"),ot=s(", "),Ne=o("code"),Qe=s("numeric_values_scale"),Le=s(", "),de=o("code"),ke=s("float_answer"),Ke=p(),Ae=o("tr"),ne=o("td"),et=s("Strong supervision for aggregation"),Ve=p(),le=o("td"),Xe=o("code"),Ie=s("input ids"),tt=s(", "),Bt=o("code"),Wt=s("attention mask"),Rs=s(", "),zt=o("code"),ys=s("token type ids"),ts=s(", "),qt=o("code"),_s=s("labels"),ut=s(", "),ze=o("code"),Ss=s("aggregation_labels"),$t=p(),re=o("p"),yt=o("a"),ss=s("TapasTokenizer"),xs=s(" creates the "),Gt=o("code"),ns=s("labels"),Vs=s(", "),Nt=o("code"),Qt=s("numeric_values"),Xs=s(" and "),Rt=o("code"),ls=s("numeric_values_scale"),Ys=s(" based on the "),St=o("code"),rs=s("answer_coordinates"),Ds=s(" and "),xt=o("code"),Hs=s("answer_text"),st=s(" columns of the TSV file. The "),Vt=o("code"),is=s("float_answer"),Ps=s(" and "),Xt=o("code"),ds=s("aggregation_labels"),Os=s(" are already in the TSV file of step 2. Here\u2019s an example:"),cs=p(),b(it.$$.fragment),ps=p(),qe=o("p"),hs=s("Note that "),_t=o("a"),Ls=s("TapasTokenizer"),Yt=s(" expects the data of the table to be "),Dt=o("strong"),Ks=s("text-only"),ea=s(". You can use "),dt=o("code"),ta=s(".astype(str)"),us=s(` on a dataframe to turn it into text-only data.
Of course, this only shows how to encode a single training example. It is advised to create a dataloader to iterate over batches:`),ms=p(),b(gt.$$.fragment),this.h()},l(C){i=n(C,"P",{});var te=l(i);M=a(te,"Third, given that you\u2019ve prepared your data in this TSV/CSV format (and corresponding CSV files containing the tabular data), you can then use "),d=n(te,"A",{href:!0});var ja=l(d);f=a(ja,"TapasTokenizer"),ja.forEach(t),y=a(te," to convert table-question pairs into "),c=n(te,"CODE",{});var sa=l(c);g=a(sa,"input_ids"),sa.forEach(t),I=a(te,", "),E=n(te,"CODE",{});var va=l(E);S=a(va,"attention_mask"),va.forEach(t),$=a(te,", "),Y=n(te,"CODE",{});var ha=l(Y);ae=a(ha,"token_type_ids"),ha.forEach(t),w=a(te," and so on. Again, based on which of the three cases you picked above, "),X=n(te,"A",{href:!0});var Pt=l(X);L=a(Pt,"TFTapasForQuestionAnswering"),Pt.forEach(t),W=a(te,` requires different
inputs to be fine-tuned:`),te.forEach(t),x=h(C),z=n(C,"TABLE",{});var Tt=l(z);F=n(Tt,"THEAD",{});var aa=l(F);R=n(aa,"TR",{});var wt=l(R);P=n(wt,"TH",{});var Ja=l(P);ie=n(Ja,"STRONG",{});var oa=l(ie);me=a(oa,"Task"),oa.forEach(t),Ja.forEach(t),K=h(wt),ge=n(wt,"TH",{});var Ua=l(ge);pe=n(Ua,"STRONG",{});var ua=l(pe);ee=a(ua,"Required inputs"),ua.forEach(t),Ua.forEach(t),wt.forEach(t),aa.forEach(t),Te=h(Tt),q=n(Tt,"TBODY",{});var nt=l(q);G=n(nt,"TR",{});var fs=l(G);Q=n(fs,"TD",{});var ws=l(Q);Z=a(ws,"Conversational"),ws.forEach(t),D=h(fs),V=n(fs,"TD",{});var ct=l(V);we=n(ct,"CODE",{});var ka=l(we);Ce=a(ka,"input_ids"),ka.forEach(t),he=a(ct,", "),fe=n(ct,"CODE",{});var ma=l(fe);Ee=a(ma,"attention_mask"),ma.forEach(t),se=a(ct,", "),je=n(ct,"CODE",{});var bs=l(je);Me=a(bs,"token_type_ids"),bs.forEach(t),Ze=a(ct,", "),Fe=n(ct,"CODE",{});var na=l(Fe);ve=a(na,"labels"),na.forEach(t),ct.forEach(t),fs.forEach(t),Be=h(nt),Ue=n(nt,"TR",{});var gs=l(Ue);ce=n(gs,"TD",{});var fa=l(ce);We=a(fa,"Weak supervision for aggregation"),fa.forEach(t),be=h(gs),O=n(gs,"TD",{});var _e=l(O);Je=n(_e,"CODE",{});var Ia=l(Je);H=a(Ia,"input_ids"),Ia.forEach(t),Re=a(_e,", "),oe=n(_e,"CODE",{});var js=l(oe);Se=a(js,"attention_mask"),js.forEach(t),xe=a(_e,", "),_=n(_e,"CODE",{});var Ea=l(_);B=a(Ea,"token_type_ids"),Ea.forEach(t),He=a(_e,", "),ye=n(_e,"CODE",{});var Ca=l(ye);Pe=a(Ca,"labels"),Ca.forEach(t),Oe=a(_e,", "),N=n(_e,"CODE",{});var ga=l(N);Ge=a(ga,"numeric_values"),ga.forEach(t),ot=a(_e,", "),Ne=n(_e,"CODE",{});var Et=l(Ne);Qe=a(Et,"numeric_values_scale"),Et.forEach(t),Le=a(_e,", "),de=n(_e,"CODE",{});var la=l(de);ke=a(la,"float_answer"),la.forEach(t),_e.forEach(t),gs.forEach(t),Ke=h(nt),Ae=n(nt,"TR",{});var Ts=l(Ae);ne=n(Ts,"TD",{});var Aa=l(ne);et=a(Aa,"Strong supervision for aggregation"),Aa.forEach(t),Ve=h(Ts),le=n(Ts,"TD",{});var $e=l(le);Xe=n($e,"CODE",{});var Fa=l(Xe);Ie=a(Fa,"input ids"),Fa.forEach(t),tt=a($e,", "),Bt=n($e,"CODE",{});var ra=l(Bt);Wt=a(ra,"attention mask"),ra.forEach(t),Rs=a($e,", "),zt=n($e,"CODE",{});var Za=l(zt);ys=a(Za,"token type ids"),Za.forEach(t),ts=a($e,", "),qt=n($e,"CODE",{});var Ba=l(qt);_s=a(Ba,"labels"),Ba.forEach(t),ut=a($e,", "),ze=n($e,"CODE",{});var Wa=l(ze);Ss=a(Wa,"aggregation_labels"),Wa.forEach(t),$e.forEach(t),Ts.forEach(t),nt.forEach(t),Tt.forEach(t),$t=h(C),re=n(C,"P",{});var ue=l(re);yt=n(ue,"A",{href:!0});var za=l(yt);ss=a(za,"TapasTokenizer"),za.forEach(t),xs=a(ue," creates the "),Gt=n(ue,"CODE",{});var ia=l(Gt);ns=a(ia,"labels"),ia.forEach(t),Vs=a(ue,", "),Nt=n(ue,"CODE",{});var qa=l(Nt);Qt=a(qa,"numeric_values"),qa.forEach(t),Xs=a(ue," and "),Rt=n(ue,"CODE",{});var $a=l(Rt);ls=a($a,"numeric_values_scale"),$a.forEach(t),Ys=a(ue," based on the "),St=n(ue,"CODE",{});var Ta=l(St);rs=a(Ta,"answer_coordinates"),Ta.forEach(t),Ds=a(ue," and "),xt=n(ue,"CODE",{});var vs=l(xt);Hs=a(vs,"answer_text"),vs.forEach(t),st=a(ue," columns of the TSV file. The "),Vt=n(ue,"CODE",{});var Ga=l(Vt);is=a(Ga,"float_answer"),Ga.forEach(t),Ps=a(ue," and "),Xt=n(ue,"CODE",{});var Ma=l(Xt);ds=a(Ma,"aggregation_labels"),Ma.forEach(t),Os=a(ue," are already in the TSV file of step 2. Here\u2019s an example:"),ue.forEach(t),cs=h(C),j(it.$$.fragment,C),ps=h(C),qe=n(C,"P",{});var Ye=l(qe);hs=a(Ye,"Note that "),_t=n(Ye,"A",{href:!0});var da=l(_t);Ls=a(da,"TapasTokenizer"),da.forEach(t),Yt=a(Ye," expects the data of the table to be "),Dt=n(Ye,"STRONG",{});var Ot=l(Dt);Ks=a(Ot,"text-only"),Ot.forEach(t),ea=a(Ye,". You can use "),dt=n(Ye,"CODE",{});var ca=l(dt);ta=a(ca,".astype(str)"),ca.forEach(t),us=a(Ye,` on a dataframe to turn it into text-only data.
Of course, this only shows how to encode a single training example. It is advised to create a dataloader to iterate over batches:`),Ye.forEach(t),ms=h(C),j(gt.$$.fragment,C),this.h()},h(){m(d,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasTokenizer"),m(X,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TFTapasForQuestionAnswering"),m(yt,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasTokenizer"),m(_t,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasTokenizer")},m(C,te){u(C,i,te),e(i,M),e(i,d),e(d,f),e(i,y),e(i,c),e(c,g),e(i,I),e(i,E),e(E,S),e(i,$),e(i,Y),e(Y,ae),e(i,w),e(i,X),e(X,L),e(i,W),u(C,x,te),u(C,z,te),e(z,F),e(F,R),e(R,P),e(P,ie),e(ie,me),e(R,K),e(R,ge),e(ge,pe),e(pe,ee),e(z,Te),e(z,q),e(q,G),e(G,Q),e(Q,Z),e(G,D),e(G,V),e(V,we),e(we,Ce),e(V,he),e(V,fe),e(fe,Ee),e(V,se),e(V,je),e(je,Me),e(V,Ze),e(V,Fe),e(Fe,ve),e(q,Be),e(q,Ue),e(Ue,ce),e(ce,We),e(Ue,be),e(Ue,O),e(O,Je),e(Je,H),e(O,Re),e(O,oe),e(oe,Se),e(O,xe),e(O,_),e(_,B),e(O,He),e(O,ye),e(ye,Pe),e(O,Oe),e(O,N),e(N,Ge),e(O,ot),e(O,Ne),e(Ne,Qe),e(O,Le),e(O,de),e(de,ke),e(q,Ke),e(q,Ae),e(Ae,ne),e(ne,et),e(Ae,Ve),e(Ae,le),e(le,Xe),e(Xe,Ie),e(le,tt),e(le,Bt),e(Bt,Wt),e(le,Rs),e(le,zt),e(zt,ys),e(le,ts),e(le,qt),e(qt,_s),e(le,ut),e(le,ze),e(ze,Ss),u(C,$t,te),u(C,re,te),e(re,yt),e(yt,ss),e(re,xs),e(re,Gt),e(Gt,ns),e(re,Vs),e(re,Nt),e(Nt,Qt),e(re,Xs),e(re,Rt),e(Rt,ls),e(re,Ys),e(re,St),e(St,rs),e(re,Ds),e(re,xt),e(xt,Hs),e(re,st),e(re,Vt),e(Vt,is),e(re,Ps),e(re,Xt),e(Xt,ds),e(re,Os),u(C,cs,te),v(it,C,te),u(C,ps,te),u(C,qe,te),e(qe,hs),e(qe,_t),e(_t,Ls),e(qe,Yt),e(qe,Dt),e(Dt,Ks),e(qe,ea),e(qe,dt),e(dt,ta),e(qe,us),u(C,ms,te),v(gt,C,te),Ht=!0},p:It,i(C){Ht||(J(it.$$.fragment,C),J(gt.$$.fragment,C),Ht=!0)},o(C){U(it.$$.fragment,C),U(gt.$$.fragment,C),Ht=!1},d(C){C&&t(i),C&&t(x),C&&t(z),C&&t($t),C&&t(re),C&&t(cs),k(it,C),C&&t(ps),C&&t(qe),C&&t(ms),k(gt,C)}}}function Lb(A){let i,M;return i=new wn({props:{$$slots:{default:[Ob]},$$scope:{ctx:A}}}),{c(){b(i.$$.fragment)},l(d){j(i.$$.fragment,d)},m(d,f){v(i,d,f),M=!0},p(d,f){const y={};f&2&&(y.$$scope={dirty:f,ctx:d}),i.$set(y)},i(d){M||(J(i.$$.fragment,d),M=!0)},o(d){U(i.$$.fragment,d),M=!1},d(d){k(i,d)}}}function Kb(A){let i,M,d,f,y,c,g,I;return g=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRhcGFzQ29uZmlnJTJDJTIwVGFwYXNGb3JRdWVzdGlvbkFuc3dlcmluZyUyQyUyMEFkYW1XJTBBJTBBJTIzJTIwdGhpcyUyMGlzJTIwdGhlJTIwZGVmYXVsdCUyMFdUUSUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWclMjAlM0QlMjBUYXBhc0NvbmZpZyglMEElMjAlMjAlMjAlMjBudW1fYWdncmVnYXRpb25fbGFiZWxzJTNENCUyQyUwQ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W9kZWwoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwaW5wdXRfaWRzJTNEaW5wdXRfaWRzJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYXR0ZW50aW9uX21hc2slM0RhdHRlbnRpb25fbWFzayUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHRva2VuX3R5cGVfaWRzJTNEdG9rZW5fdHlwZV9pZHMlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsYWJlbHMlM0RsYWJlbHMlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBudW1lcmljX3ZhbHVlcyUzRG51bWVyaWNfdmFsdWVzJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbnVtZXJpY192YWx1ZXNfc2NhbGUlM0RudW1lcmljX3ZhbHVlc19zY2FsZSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGZsb2F0X2Fuc3dlciUzRGZsb2F0X2Fuc3dlciUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3NzJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbG9zcy5iYWNrd2FyZCgpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwb3B0aW1pemVyLnN0ZXAoKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TapasConfig, TapasForQuestionAnswering, AdamW

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># this is the default WTQ configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config = TapasConfig(
<span class="hljs-meta">... </span>    num_aggregation_labels=<span class="hljs-number">4</span>,
<span class="hljs-meta">... </span>    use_answer_as_supervision=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    answer_loss_cutoff=<span class="hljs-number">0.664694</span>,
<span class="hljs-meta">... </span>    cell_selection_preference=<span class="hljs-number">0.207951</span>,
<span class="hljs-meta">... </span>    huber_loss_delta=<span class="hljs-number">0.121194</span>,
<span class="hljs-meta">... </span>    init_cell_selection_weights_to_zero=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    select_one_column=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    allow_empty_column_selection=<span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>    temperature=<span class="hljs-number">0.0352513</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TapasForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>, config=config)

<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer = AdamW(model.parameters(), lr=<span class="hljs-number">5e-5</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>model.train()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> epoch <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">2</span>):  <span class="hljs-comment"># loop over the dataset multiple times</span>
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> batch <span class="hljs-keyword">in</span> train_dataloader:
<span class="hljs-meta">... </span>        <span class="hljs-comment"># get the inputs;</span>
<span class="hljs-meta">... </span>        input_ids = batch[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">... </span>        attention_mask = batch[<span class="hljs-string">&quot;attention_mask&quot;</span>]
<span class="hljs-meta">... </span>        token_type_ids = batch[<span class="hljs-string">&quot;token_type_ids&quot;</span>]
<span class="hljs-meta">... </span>        labels = batch[<span class="hljs-string">&quot;labels&quot;</span>]
<span class="hljs-meta">... </span>        numeric_values = batch[<span class="hljs-string">&quot;numeric_values&quot;</span>]
<span class="hljs-meta">... </span>        numeric_values_scale = batch[<span class="hljs-string">&quot;numeric_values_scale&quot;</span>]
<span class="hljs-meta">... </span>        float_answer = batch[<span class="hljs-string">&quot;float_answer&quot;</span>]

<span class="hljs-meta">... </span>        <span class="hljs-comment"># zero the parameter gradients</span>
<span class="hljs-meta">... </span>        optimizer.zero_grad()

<span class="hljs-meta">... </span>        <span class="hljs-comment"># forward + backward + optimize</span>
<span class="hljs-meta">... </span>        outputs = model(
<span class="hljs-meta">... </span>            input_ids=input_ids,
<span class="hljs-meta">... </span>            attention_mask=attention_mask,
<span class="hljs-meta">... </span>            token_type_ids=token_type_ids,
<span class="hljs-meta">... </span>            labels=labels,
<span class="hljs-meta">... </span>            numeric_values=numeric_values,
<span class="hljs-meta">... </span>            numeric_values_scale=numeric_values_scale,
<span class="hljs-meta">... </span>            float_answer=float_answer,
<span class="hljs-meta">... </span>        )
<span class="hljs-meta">... </span>        loss = outputs.loss
<span class="hljs-meta">... </span>        loss.backward()
<span class="hljs-meta">... </span>        optimizer.step()`}}),{c(){i=o("p"),M=s("You can then fine-tune "),d=o("a"),f=s("TapasForQuestionAnswering"),y=s(" as follows (shown here for the weak supervision for aggregation case):"),c=p(),b(g.$$.fragment),this.h()},l(E){i=n(E,"P",{});var S=l(i);M=a(S,"You can then fine-tune "),d=n(S,"A",{href:!0});var $=l(d);f=a($,"TapasForQuestionAnswering"),$.forEach(t),y=a(S," as follows (shown here for the weak supervision for aggregation case):"),S.forEach(t),c=h(E),j(g.$$.fragment,E),this.h()},h(){m(d,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering")},m(E,S){u(E,i,S),e(i,M),e(i,d),e(d,f),e(i,y),u(E,c,S),v(g,E,S),I=!0},p:It,i(E){I||(J(g.$$.fragment,E),I=!0)},o(E){U(g.$$.fragment,E),I=!1},d(E){E&&t(i),E&&t(c),k(g,E)}}}function ej(A){let i,M;return i=new wn({props:{$$slots:{default:[Kb]},$$scope:{ctx:A}}}),{c(){b(i.$$.fragment)},l(d){j(i.$$.fragment,d)},m(d,f){v(i,d,f),M=!0},p(d,f){const y={};f&2&&(y.$$scope={dirty:f,ctx:d}),i.$set(y)},i(d){M||(J(i.$$.fragment,d),M=!0)},o(d){U(i.$$.fragment,d),M=!1},d(d){k(i,d)}}}function tj(A){let i,M,d,f,y,c,g,I;return g=new ht({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwVGFwYXNDb25maWclMkMlMjBURlRhcGFzRm9yUXVlc3Rpb25BbnN3ZXJpbmclMEElMEElMjMlMjB0aGlzJTIwaXMlMjB0aGUlMjBkZWZhdWx0JTIwV1RRJTIwY29uZmlndXJhdGlvbiUwQWNvbmZpZyUyMCUzRCUyMFRhcGFzQ29uZmlnKCUwQSUyMCUyMCUyMCUyMG51bV9hZ2dyZWdhdGlvbl9sYWJlbHMlM0Q0JTJDJTBBJTIwJTIwJTIwJTIwdXNlX2Fuc3dlcl9hc19zdXBlcnZpc2lvbiUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBhbnN3ZXJfbG9zc19jdXRvZmYlM0QwLjY2NDY5NCUyQyUwQSUyMCUyMCUyMCUyMGNlbGxfc2VsZWN0aW9uX3ByZWZlcmVuY2UlM0QwLjIwNzk1MSUyQyUwQSUyMCUyMCUyMCUyMGh1YmVyX2xvc3NfZGVsdGElM0QwLjEyMTE5NCUyQyUwQSUyMCUyMCUyMCUyMGluaXRfY2VsbF9zZWxlY3Rpb25fd2VpZ2h0c190b196ZXJvJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHNlbGVjdF9vbmVfY29sdW1uJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGFsbG93X2VtcHR5X2NvbHVtbl9zZWxlY3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JTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZmxvYXRfYW5zd2VyJTNEZmxvYXRfYW5zd2VyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGdyYWRzJTIwJTNEJTIwdGFwZS5ncmFkaWVudChvdXRwdXRzLmxvc3MlMkMlMjBtb2RlbC50cmFpbmFibGVfd2VpZ2h0cyklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBvcHRpbWl6ZXIuYXBwbHlfZ3JhZGllbnRzKHppcChncmFkcyUyQyUyMG1vZGVsLnRyYWluYWJsZV93ZWlnaHRzKSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TapasConfig, TFTapasForQuestionAnswering

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># this is the default WTQ configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>config = TapasConfig(
<span class="hljs-meta">... </span>    num_aggregation_labels=<span class="hljs-number">4</span>,
<span class="hljs-meta">... </span>    use_answer_as_supervision=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    answer_loss_cutoff=<span class="hljs-number">0.664694</span>,
<span class="hljs-meta">... </span>    cell_selection_preference=<span class="hljs-number">0.207951</span>,
<span class="hljs-meta">... </span>    huber_loss_delta=<span class="hljs-number">0.121194</span>,
<span class="hljs-meta">... </span>    init_cell_selection_weights_to_zero=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    select_one_column=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    allow_empty_column_selection=<span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>    temperature=<span class="hljs-number">0.0352513</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFTapasForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>, config=config)

<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer = tf.keras.optimizers.Adam(learning_rate=<span class="hljs-number">5e-5</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> epoch <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">2</span>):  <span class="hljs-comment"># loop over the dataset multiple times</span>
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> batch <span class="hljs-keyword">in</span> train_dataloader:
<span class="hljs-meta">... </span>        <span class="hljs-comment"># get the inputs;</span>
<span class="hljs-meta">... </span>        input_ids = batch[<span class="hljs-number">0</span>]
<span class="hljs-meta">... </span>        attention_mask = batch[<span class="hljs-number">1</span>]
<span class="hljs-meta">... </span>        token_type_ids = batch[<span class="hljs-number">4</span>]
<span class="hljs-meta">... </span>        labels = batch[-<span class="hljs-number">1</span>]
<span class="hljs-meta">... </span>        numeric_values = batch[<span class="hljs-number">2</span>]
<span class="hljs-meta">... </span>        numeric_values_scale = batch[<span class="hljs-number">3</span>]
<span class="hljs-meta">... </span>        float_answer = batch[<span class="hljs-number">6</span>]

<span class="hljs-meta">... </span>        <span class="hljs-comment"># forward + backward + optimize</span>
<span class="hljs-meta">... </span>        <span class="hljs-keyword">with</span> tf.GradientTape() <span class="hljs-keyword">as</span> tape:
<span class="hljs-meta">... </span>            outputs = model(
<span class="hljs-meta">... </span>                input_ids=input_ids,
<span class="hljs-meta">... </span>                attention_mask=attention_mask,
<span class="hljs-meta">... </span>                token_type_ids=token_type_ids,
<span class="hljs-meta">... </span>                labels=labels,
<span class="hljs-meta">... </span>                numeric_values=numeric_values,
<span class="hljs-meta">... </span>                numeric_values_scale=numeric_values_scale,
<span class="hljs-meta">... </span>                float_answer=float_answer,
<span class="hljs-meta">... </span>            )
<span class="hljs-meta">... </span>        grads = tape.gradient(outputs.loss, model.trainable_weights)
<span class="hljs-meta">... </span>        optimizer.apply_gradients(<span class="hljs-built_in">zip</span>(grads, model.trainable_weights))`}}),{c(){i=o("p"),M=s("You can then fine-tune "),d=o("a"),f=s("TFTapasForQuestionAnswering"),y=s(" as follows (shown here for the weak supervision for aggregation case):"),c=p(),b(g.$$.fragment),this.h()},l(E){i=n(E,"P",{});var S=l(i);M=a(S,"You can then fine-tune "),d=n(S,"A",{href:!0});var $=l(d);f=a($,"TFTapasForQuestionAnswering"),$.forEach(t),y=a(S," as follows (shown here for the weak supervision for aggregation case):"),S.forEach(t),c=h(E),j(g.$$.fragment,E),this.h()},h(){m(d,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TFTapasForQuestionAnswering")},m(E,S){u(E,i,S),e(i,M),e(i,d),e(d,f),e(i,y),u(E,c,S),v(g,E,S),I=!0},p:It,i(E){I||(J(g.$$.fragment,E),I=!0)},o(E){U(g.$$.fragment,E),I=!1},d(E){E&&t(i),E&&t(c),k(g,E)}}}function sj(A){let i,M;return i=new wn({props:{$$slots:{default:[tj]},$$scope:{ctx:A}}}),{c(){b(i.$$.fragment)},l(d){j(i.$$.fragment,d)},m(d,f){v(i,d,f),M=!0},p(d,f){const y={};f&2&&(y.$$scope={dirty:f,ctx:d}),i.$set(y)},i(d){M||(J(i.$$.fragment,d),M=!0)},o(d){U(i.$$.fragment,d),M=!1},d(d){k(i,d)}}}function aj(A){let i,M,d,f,y,c,g,I,E,S,$,Y,ae,w,X,L,W,x,z,F,R,P,ie,me,K,ge,pe,ee,Te,q,G,Q;return G=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRhcGFzVG9rZW5pemVyJTJDJTIwVGFwYXNGb3JRdWVzdGlvbkFuc3dlcmluZyUwQWltcG9ydCUyMHBhbmRhcyUyMGFzJTIwcGQlMEElMEFtb2RlbF9uYW1lJTIwJTNEJTIwJ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lMjAlMkIlMjBwcmVkaWN0ZWRfYWdnJTIwJTJCJTIwJTIyJTIwJTNFJTIwJTIyJTIwJTJCJTIwYW5zd2VyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TapasTokenizer, TapasForQuestionAnswering
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

<span class="hljs-meta">&gt;&gt;&gt; </span>model_name = <span class="hljs-string">&quot;google/tapas-base-finetuned-wtq&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TapasForQuestionAnswering.from_pretrained(model_name)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = TapasTokenizer.from_pretrained(model_name)

<span class="hljs-meta">&gt;&gt;&gt; </span>data = {<span class="hljs-string">&quot;Actors&quot;</span>: [<span class="hljs-string">&quot;Brad Pitt&quot;</span>, <span class="hljs-string">&quot;Leonardo Di Caprio&quot;</span>, <span class="hljs-string">&quot;George Clooney&quot;</span>], <span class="hljs-string">&quot;Number of movies&quot;</span>: [<span class="hljs-string">&quot;87&quot;</span>, <span class="hljs-string">&quot;53&quot;</span>, <span class="hljs-string">&quot;69&quot;</span>]}
<span class="hljs-meta">&gt;&gt;&gt; </span>queries = [
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;What is the name of the first actor?&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;How many movies has George Clooney played in?&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;What is the total number of movies?&quot;</span>,
<span class="hljs-meta">... </span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>table = pd.DataFrame.from_dict(data)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(table=table, queries=queries, padding=<span class="hljs-string">&quot;max_length&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_answer_coordinates, predicted_aggregation_indices = tokenizer.convert_logits_to_predictions(
<span class="hljs-meta">... </span>    inputs, outputs.logits.detach(), outputs.logits_aggregation.detach()
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># let&#x27;s print out the results:</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>id2aggregation = {<span class="hljs-number">0</span>: <span class="hljs-string">&quot;NONE&quot;</span>, <span class="hljs-number">1</span>: <span class="hljs-string">&quot;SUM&quot;</span>, <span class="hljs-number">2</span>: <span class="hljs-string">&quot;AVERAGE&quot;</span>, <span class="hljs-number">3</span>: <span class="hljs-string">&quot;COUNT&quot;</span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>aggregation_predictions_string = [id2aggregation[x] <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> predicted_aggregation_indices]

<span class="hljs-meta">&gt;&gt;&gt; </span>answers = []
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> coordinates <span class="hljs-keyword">in</span> predicted_answer_coordinates:
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> <span class="hljs-built_in">len</span>(coordinates) == <span class="hljs-number">1</span>:
<span class="hljs-meta">... </span>        <span class="hljs-comment"># only a single cell:</span>
<span class="hljs-meta">... </span>        answers.append(table.iat[coordinates[<span class="hljs-number">0</span>]])
<span class="hljs-meta">... </span>    <span class="hljs-keyword">else</span>:
<span class="hljs-meta">... </span>        <span class="hljs-comment"># multiple cells</span>
<span class="hljs-meta">... </span>        cell_values = []
<span class="hljs-meta">... </span>        <span class="hljs-keyword">for</span> coordinate <span class="hljs-keyword">in</span> coordinates:
<span class="hljs-meta">... </span>            cell_values.append(table.iat[coordinate])
<span class="hljs-meta">... </span>        answers.append(<span class="hljs-string">&quot;, &quot;</span>.join(cell_values))

<span class="hljs-meta">&gt;&gt;&gt; </span>display(table)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> query, answer, predicted_agg <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(queries, answers, aggregation_predictions_string):
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(query)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> predicted_agg == <span class="hljs-string">&quot;NONE&quot;</span>:
<span class="hljs-meta">... </span>        <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Predicted answer: &quot;</span> + answer)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">else</span>:
<span class="hljs-meta">... </span>        <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Predicted answer: &quot;</span> + predicted_agg + <span class="hljs-string">&quot; &gt; &quot;</span> + answer)
What <span class="hljs-keyword">is</span> the name of the first actor?
Predicted answer: Brad Pitt
How many movies has George Clooney played <span class="hljs-keyword">in</span>?
Predicted answer: COUNT &gt; <span class="hljs-number">69</span>
What <span class="hljs-keyword">is</span> the total number of movies?
Predicted answer: SUM &gt; <span class="hljs-number">87</span>, <span class="hljs-number">53</span>, <span class="hljs-number">69</span>`}}),{c(){i=o("p"),M=s("Here we explain how you can use "),d=o("a"),f=s("TapasForQuestionAnswering"),y=s(" or "),c=o("a"),g=s("TFTapasForQuestionAnswering"),I=s(" for inference (i.e. making predictions on new data). For inference, only "),E=o("code"),S=s("input_ids"),$=s(", "),Y=o("code"),ae=s("attention_mask"),w=s(" and "),X=o("code"),L=s("token_type_ids"),W=s(" (which you can obtain using "),x=o("a"),z=s("TapasTokenizer"),F=s(") have to be provided to the model to obtain the logits. Next, you can use the handy "),R=o("code"),P=s("~models.tapas.tokenization_tapas.convert_logits_to_predictions"),ie=s(" method to convert these into predicted coordinates and optional aggregation indices."),me=p(),K=o("p"),ge=s("However, note that inference is "),pe=o("strong"),ee=s("different"),Te=s(" depending on whether or not the setup is conversational. In a non-conversational set-up, inference can be done in parallel on all table-question pairs of a batch. Here\u2019s an example of that:"),q=p(),b(G.$$.fragment),this.h()},l(Z){i=n(Z,"P",{});var D=l(i);M=a(D,"Here we explain how you can use "),d=n(D,"A",{href:!0});var V=l(d);f=a(V,"TapasForQuestionAnswering"),V.forEach(t),y=a(D," or "),c=n(D,"A",{href:!0});var we=l(c);g=a(we,"TFTapasForQuestionAnswering"),we.forEach(t),I=a(D," for inference (i.e. making predictions on new data). For inference, only "),E=n(D,"CODE",{});var Ce=l(E);S=a(Ce,"input_ids"),Ce.forEach(t),$=a(D,", "),Y=n(D,"CODE",{});var he=l(Y);ae=a(he,"attention_mask"),he.forEach(t),w=a(D," and "),X=n(D,"CODE",{});var fe=l(X);L=a(fe,"token_type_ids"),fe.forEach(t),W=a(D," (which you can obtain using "),x=n(D,"A",{href:!0});var Ee=l(x);z=a(Ee,"TapasTokenizer"),Ee.forEach(t),F=a(D,") have to be provided to the model to obtain the logits. Next, you can use the handy "),R=n(D,"CODE",{});var se=l(R);P=a(se,"~models.tapas.tokenization_tapas.convert_logits_to_predictions"),se.forEach(t),ie=a(D," method to convert these into predicted coordinates and optional aggregation indices."),D.forEach(t),me=h(Z),K=n(Z,"P",{});var je=l(K);ge=a(je,"However, note that inference is "),pe=n(je,"STRONG",{});var Me=l(pe);ee=a(Me,"different"),Me.forEach(t),Te=a(je," depending on whether or not the setup is conversational. In a non-conversational set-up, inference can be done in parallel on all table-question pairs of a batch. Here\u2019s an example of that:"),je.forEach(t),q=h(Z),j(G.$$.fragment,Z),this.h()},h(){m(d,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering"),m(c,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TFTapasForQuestionAnswering"),m(x,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasTokenizer")},m(Z,D){u(Z,i,D),e(i,M),e(i,d),e(d,f),e(i,y),e(i,c),e(c,g),e(i,I),e(i,E),e(E,S),e(i,$),e(i,Y),e(Y,ae),e(i,w),e(i,X),e(X,L),e(i,W),e(i,x),e(x,z),e(i,F),e(i,R),e(R,P),e(i,ie),u(Z,me,D),u(Z,K,D),e(K,ge),e(K,pe),e(pe,ee),e(K,Te),u(Z,q,D),v(G,Z,D),Q=!0},p:It,i(Z){Q||(J(G.$$.fragment,Z),Q=!0)},o(Z){U(G.$$.fragment,Z),Q=!1},d(Z){Z&&t(i),Z&&t(me),Z&&t(K),Z&&t(q),k(G,Z)}}}function oj(A){let i,M;return i=new wn({props:{$$slots:{default:[aj]},$$scope:{ctx:A}}}),{c(){b(i.$$.fragment)},l(d){j(i.$$.fragment,d)},m(d,f){v(i,d,f),M=!0},p(d,f){const y={};f&2&&(y.$$scope={dirty:f,ctx:d}),i.$set(y)},i(d){M||(J(i.$$.fragment,d),M=!0)},o(d){U(i.$$.fragment,d),M=!1},d(d){k(i,d)}}}function nj(A){let i,M,d,f,y,c,g,I,E,S,$,Y,ae,w,X,L,W,x,z,F,R,P,ie,me,K,ge,pe,ee,Te;return ee=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRhcGFzVG9rZW5pemVyJTJDJTIwVEZUYXBhc0ZvclF1ZXN0aW9uQW5zd2VyaW5nJTBBaW1wb3J0JTIwcGFuZGFzJTIwYXMlMjBwZCUwQSUwQW1vZGVsX25hbWUlMjAlM0QlMjAlMjJnb29nbGUlMkZ0YXBhcy1iYXNlLWZpbmV0dW5lZC13dHElMjIlMEFtb2RlbCUyMCUzRCUyMFRGVGFwYXNGb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQobW9kZWxfbmFtZSklMEF0b2tlbml6ZXIlMjAlM0QlMjBUYXBhc1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQobW9kZWxfbmFtZSklMEElMEFkYXRhJTIwJTNEJTIwJTdCJTIyQWN0b3JzJTIyJTNBJTIwJ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mF0ZXMlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBjZWxsX3ZhbHVlcy5hcHBlbmQodGFibGUuaWF0JTVCY29vcmRpbmF0ZSU1RCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBhbnN3ZXJzLmFwcGVuZCglMjIlMkMlMjAlMjIuam9pbihjZWxsX3ZhbHVlcykpJTBBJTBBZGlzcGxheSh0YWJsZSklMEFwcmludCglMjIlMjIpJTBBZm9yJTIwcXVlcnklMkMlMjBhbnN3ZXIlMkMlMjBwcmVkaWN0ZWRfYWdnJTIwaW4lMjB6aXAocXVlcmllcyUyQyUyMGFuc3dlcnMlMkMlMjBhZ2dyZWdhdGlvbl9wcmVkaWN0aW9uc19zdHJpbmcpJTNBJTBBJTIwJTIwJTIwJTIwcHJpbnQocXVlcnkpJTBBJTIwJTIwJTIwJTIwaWYlMjBwcmVkaWN0ZWRfYWdnJTIwJTNEJTNEJTIwJTIyTk9ORSUyMiUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHByaW50KCUyMlByZWRpY3RlZCUyMGFuc3dlciUzQSUyMCUyMiUyMCUyQiUyMGFuc3dlciklMEElMjAlMjAlMjAlMjBlbHNlJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwcHJpbnQoJTIyUHJlZGljdGVkJTIwYW5zd2VyJTNBJTIwJTIyJTIwJTJCJTIwcHJlZGljdGVkX2FnZyUyMCUyQiUyMCUyMiUyMCUzRSUyMCUyMiUyMCUyQiUyMGFuc3dlcik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TapasTokenizer, TFTapasForQuestionAnswering
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

<span class="hljs-meta">&gt;&gt;&gt; </span>model_name = <span class="hljs-string">&quot;google/tapas-base-finetuned-wtq&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFTapasForQuestionAnswering.from_pretrained(model_name)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = TapasTokenizer.from_pretrained(model_name)

<span class="hljs-meta">&gt;&gt;&gt; </span>data = {<span class="hljs-string">&quot;Actors&quot;</span>: [<span class="hljs-string">&quot;Brad Pitt&quot;</span>, <span class="hljs-string">&quot;Leonardo Di Caprio&quot;</span>, <span class="hljs-string">&quot;George Clooney&quot;</span>], <span class="hljs-string">&quot;Number of movies&quot;</span>: [<span class="hljs-string">&quot;87&quot;</span>, <span class="hljs-string">&quot;53&quot;</span>, <span class="hljs-string">&quot;69&quot;</span>]}
<span class="hljs-meta">&gt;&gt;&gt; </span>queries = [
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;What is the name of the first actor?&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;How many movies has George Clooney played in?&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;What is the total number of movies?&quot;</span>,
<span class="hljs-meta">... </span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>table = pd.DataFrame.from_dict(data)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(table=table, queries=queries, padding=<span class="hljs-string">&quot;max_length&quot;</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_answer_coordinates, predicted_aggregation_indices = tokenizer.convert_logits_to_predictions(
<span class="hljs-meta">... </span>    inputs, outputs.logits, outputs.logits_aggregation
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># let&#x27;s print out the results:</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>id2aggregation = {<span class="hljs-number">0</span>: <span class="hljs-string">&quot;NONE&quot;</span>, <span class="hljs-number">1</span>: <span class="hljs-string">&quot;SUM&quot;</span>, <span class="hljs-number">2</span>: <span class="hljs-string">&quot;AVERAGE&quot;</span>, <span class="hljs-number">3</span>: <span class="hljs-string">&quot;COUNT&quot;</span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>aggregation_predictions_string = [id2aggregation[x] <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> predicted_aggregation_indices]

<span class="hljs-meta">&gt;&gt;&gt; </span>answers = []
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> coordinates <span class="hljs-keyword">in</span> predicted_answer_coordinates:
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> <span class="hljs-built_in">len</span>(coordinates) == <span class="hljs-number">1</span>:
<span class="hljs-meta">... </span>        <span class="hljs-comment"># only a single cell:</span>
<span class="hljs-meta">... </span>        answers.append(table.iat[coordinates[<span class="hljs-number">0</span>]])
<span class="hljs-meta">... </span>    <span class="hljs-keyword">else</span>:
<span class="hljs-meta">... </span>        <span class="hljs-comment"># multiple cells</span>
<span class="hljs-meta">... </span>        cell_values = []
<span class="hljs-meta">... </span>        <span class="hljs-keyword">for</span> coordinate <span class="hljs-keyword">in</span> coordinates:
<span class="hljs-meta">... </span>            cell_values.append(table.iat[coordinate])
<span class="hljs-meta">... </span>        answers.append(<span class="hljs-string">&quot;, &quot;</span>.join(cell_values))

<span class="hljs-meta">&gt;&gt;&gt; </span>display(table)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> query, answer, predicted_agg <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(queries, answers, aggregation_predictions_string):
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(query)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> predicted_agg == <span class="hljs-string">&quot;NONE&quot;</span>:
<span class="hljs-meta">... </span>        <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Predicted answer: &quot;</span> + answer)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">else</span>:
<span class="hljs-meta">... </span>        <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Predicted answer: &quot;</span> + predicted_agg + <span class="hljs-string">&quot; &gt; &quot;</span> + answer)
What <span class="hljs-keyword">is</span> the name of the first actor?
Predicted answer: Brad Pitt
How many movies has George Clooney played <span class="hljs-keyword">in</span>?
Predicted answer: COUNT &gt; <span class="hljs-number">69</span>
What <span class="hljs-keyword">is</span> the total number of movies?
Predicted answer: SUM &gt; <span class="hljs-number">87</span>, <span class="hljs-number">53</span>, <span class="hljs-number">69</span>`}}),{c(){i=o("p"),M=s("Here we explain how you can use "),d=o("a"),f=s("TFTapasForQuestionAnswering"),y=s(" for inference (i.e. making predictions on new data). For inference, only "),c=o("code"),g=s("input_ids"),I=s(", "),E=o("code"),S=s("attention_mask"),$=s(" and "),Y=o("code"),ae=s("token_type_ids"),w=s(" (which you can obtain using "),X=o("a"),L=s("TapasTokenizer"),W=s(") have to be provided to the model to obtain the logits. Next, you can use the handy "),x=o("code"),z=s("~models.tapas.tokenization_tapas.convert_logits_to_predictions"),F=s(" method to convert these into predicted coordinates and optional aggregation indices."),R=p(),P=o("p"),ie=s("However, note that inference is "),me=o("strong"),K=s("different"),ge=s(" depending on whether or not the setup is conversational. In a non-conversational set-up, inference can be done in parallel on all table-question pairs of a batch. Here\u2019s an example of that:"),pe=p(),b(ee.$$.fragment),this.h()},l(q){i=n(q,"P",{});var G=l(i);M=a(G,"Here we explain how you can use "),d=n(G,"A",{href:!0});var Q=l(d);f=a(Q,"TFTapasForQuestionAnswering"),Q.forEach(t),y=a(G," for inference (i.e. making predictions on new data). For inference, only "),c=n(G,"CODE",{});var Z=l(c);g=a(Z,"input_ids"),Z.forEach(t),I=a(G,", "),E=n(G,"CODE",{});var D=l(E);S=a(D,"attention_mask"),D.forEach(t),$=a(G," and "),Y=n(G,"CODE",{});var V=l(Y);ae=a(V,"token_type_ids"),V.forEach(t),w=a(G," (which you can obtain using "),X=n(G,"A",{href:!0});var we=l(X);L=a(we,"TapasTokenizer"),we.forEach(t),W=a(G,") have to be provided to the model to obtain the logits. Next, you can use the handy "),x=n(G,"CODE",{});var Ce=l(x);z=a(Ce,"~models.tapas.tokenization_tapas.convert_logits_to_predictions"),Ce.forEach(t),F=a(G," method to convert these into predicted coordinates and optional aggregation indices."),G.forEach(t),R=h(q),P=n(q,"P",{});var he=l(P);ie=a(he,"However, note that inference is "),me=n(he,"STRONG",{});var fe=l(me);K=a(fe,"different"),fe.forEach(t),ge=a(he," depending on whether or not the setup is conversational. In a non-conversational set-up, inference can be done in parallel on all table-question pairs of a batch. Here\u2019s an example of that:"),he.forEach(t),pe=h(q),j(ee.$$.fragment,q),this.h()},h(){m(d,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TFTapasForQuestionAnswering"),m(X,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasTokenizer")},m(q,G){u(q,i,G),e(i,M),e(i,d),e(d,f),e(i,y),e(i,c),e(c,g),e(i,I),e(i,E),e(E,S),e(i,$),e(i,Y),e(Y,ae),e(i,w),e(i,X),e(X,L),e(i,W),e(i,x),e(x,z),e(i,F),u(q,R,G),u(q,P,G),e(P,ie),e(P,me),e(me,K),e(P,ge),u(q,pe,G),v(ee,q,G),Te=!0},p:It,i(q){Te||(J(ee.$$.fragment,q),Te=!0)},o(q){U(ee.$$.fragment,q),Te=!1},d(q){q&&t(i),q&&t(R),q&&t(P),q&&t(pe),k(ee,q)}}}function lj(A){let i,M;return i=new wn({props:{$$slots:{default:[nj]},$$scope:{ctx:A}}}),{c(){b(i.$$.fragment)},l(d){j(i.$$.fragment,d)},m(d,f){v(i,d,f),M=!0},p(d,f){const y={};f&2&&(y.$$scope={dirty:f,ctx:d}),i.$set(y)},i(d){M||(J(i.$$.fragment,d),M=!0)},o(d){U(i.$$.fragment,d),M=!1},d(d){k(i,d)}}}function rj(A){let i,M,d,f,y;return f=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRhcGFzTW9kZWwlMkMlMjBUYXBhc0NvbmZpZyUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBkZWZhdWx0JTIwKFNRQSklMjBUYXBhcyUyMGNvbmZpZ3VyYXRpb24lMEFjb25maWd1cmF0aW9uJTIwJTNEJTIwVGFwYXNDb25maWcoKSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMGZyb20lMjB0aGUlMjBjb25maWd1cmF0aW9uJTBBbW9kZWwlMjAlM0QlMjBUYXBhc01vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TapasModel, TapasConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a default (SQA) Tapas configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = TapasConfig()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TapasModel(configuration)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){i=o("p"),M=s("Example:"),d=p(),b(f.$$.fragment)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Example:"),g.forEach(t),d=h(c),j(f.$$.fragment,c)},m(c,g){u(c,i,g),e(i,M),u(c,d,g),v(f,c,g),y=!0},p:It,i(c){y||(J(f.$$.fragment,c),y=!0)},o(c){U(f.$$.fragment,c),y=!1},d(c){c&&t(i),c&&t(d),k(f,c)}}}function ij(A){let i,M,d,f,y;return{c(){i=o("p"),M=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=o("code"),f=s("Module"),y=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=n(g,"CODE",{});var I=l(d);f=a(I,"Module"),I.forEach(t),y=a(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(t)},m(c,g){u(c,i,g),e(i,M),e(i,d),e(d,f),e(i,y)},d(c){c&&t(i)}}}function dj(A){let i,M,d,f,y;return f=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBUYXBhc01vZGVsJTBBaW1wb3J0JTIwcGFuZGFzJTIwYXMlMjBwZCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnRhcGFzLWJhc2UlMjIpJTBBbW9kZWwlMjAlM0QlMjBUYXBhc01vZGVsLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ0YXBhcy1iYXNlJTIyKSUwQSUwQWRhdGElMjAlM0QlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjJBY3RvcnMlMjIlM0ElMjAlNUIlMjJCcmFkJTIwUGl0dCUyMiUyQyUyMCUyMkxlb25hcmRvJTIwRGklMjBDYXByaW8lMjIlMkMlMjAlMjJHZW9yZ2UlMjBDbG9vbmV5JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIyQWdlJTIyJTNBJTIwJTVCJTIyNTYlMjIlMkMlMjAlMjI0NSUyMiUyQyUyMCUyMjU5JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIyTnVtYmVyJTIwb2YlMjBtb3ZpZXMlMjIlM0ElMjAlNUIlMjI4NyUyMiUyQyUyMCUyMjUzJTIyJTJDJTIwJTIyNjklMjIlNUQlMkMlMEElN0QlMEF0YWJsZSUyMCUzRCUyMHBkLkRhdGFGcmFtZS5mcm9tX2RpY3QoZGF0YSklMEFxdWVyaWVzJTIwJTNEJTIwJTVCJTIySG93JTIwbWFueSUyMG1vdmllcyUyMGhhcyUyMEdlb3JnZSUyMENsb29uZXklMjBwbGF5ZWQlMjBpbiUzRiUyMiUyQyUyMCUyMkhvdyUyMG9sZCUyMGlzJTIwQnJhZCUyMFBpdHQlM0YlMjIlNUQlMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIodGFibGUlM0R0YWJsZSUyQyUyMHF1ZXJpZXMlM0RxdWVyaWVzJTJDJTIwcGFkZGluZyUzRCUyMm1heF9sZW5ndGglMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TapasModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TapasModel.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>data = {
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Actors&quot;</span>: [<span class="hljs-string">&quot;Brad Pitt&quot;</span>, <span class="hljs-string">&quot;Leonardo Di Caprio&quot;</span>, <span class="hljs-string">&quot;George Clooney&quot;</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Age&quot;</span>: [<span class="hljs-string">&quot;56&quot;</span>, <span class="hljs-string">&quot;45&quot;</span>, <span class="hljs-string">&quot;59&quot;</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Number of movies&quot;</span>: [<span class="hljs-string">&quot;87&quot;</span>, <span class="hljs-string">&quot;53&quot;</span>, <span class="hljs-string">&quot;69&quot;</span>],
<span class="hljs-meta">... </span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>table = pd.DataFrame.from_dict(data)
<span class="hljs-meta">&gt;&gt;&gt; </span>queries = [<span class="hljs-string">&quot;How many movies has George Clooney played in?&quot;</span>, <span class="hljs-string">&quot;How old is Brad Pitt?&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(table=table, queries=queries, padding=<span class="hljs-string">&quot;max_length&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){i=o("p"),M=s("Examples:"),d=p(),b(f.$$.fragment)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Examples:"),g.forEach(t),d=h(c),j(f.$$.fragment,c)},m(c,g){u(c,i,g),e(i,M),u(c,d,g),v(f,c,g),y=!0},p:It,i(c){y||(J(f.$$.fragment,c),y=!0)},o(c){U(f.$$.fragment,c),y=!1},d(c){c&&t(i),c&&t(d),k(f,c)}}}function cj(A){let i,M,d,f,y;return{c(){i=o("p"),M=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=o("code"),f=s("Module"),y=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=n(g,"CODE",{});var I=l(d);f=a(I,"Module"),I.forEach(t),y=a(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(t)},m(c,g){u(c,i,g),e(i,M),e(i,d),e(d,f),e(i,y)},d(c){c&&t(i)}}}function pj(A){let i,M,d,f,y;return f=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBUYXBhc0Zvck1hc2tlZExNJTBBaW1wb3J0JTIwcGFuZGFzJTIwYXMlMjBwZCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnRhcGFzLWJhc2UlMjIpJTBBbW9kZWwlMjAlM0QlMjBUYXBhc0Zvck1hc2tlZExNLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ0YXBhcy1iYXNlJTIyKSUwQSUwQWRhdGElMjAlM0QlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjJBY3RvcnMlMjIlM0ElMjAlNUIlMjJCcmFkJTIwUGl0dCUyMiUyQyUyMCUyMkxlb25hcmRvJTIwRGklMjBDYXByaW8lMjIlMkMlMjAlMjJHZW9yZ2UlMjBDbG9vbmV5JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIyQWdlJTIyJTNBJTIwJTVCJTIyNTYlMjIlMkMlMjAlMjI0NSUyMiUyQyUyMCUyMjU5JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIyTnVtYmVyJTIwb2YlMjBtb3ZpZXMlMjIlM0ElMjAlNUIlMjI4NyUyMiUyQyUyMCUyMjUzJTIyJTJDJTIwJTIyNjklMjIlNUQlMkMlMEElN0QlMEF0YWJsZSUyMCUzRCUyMHBkLkRhdGFGcmFtZS5mcm9tX2RpY3QoZGF0YSklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTBBJTIwJTIwJTIwJTIwdGFibGUlM0R0YWJsZSUyQyUyMHF1ZXJpZXMlM0QlMjJIb3clMjBtYW55JTIwJTVCTUFTSyU1RCUyMGhhcyUyMEdlb3JnZSUyMCU1Qk1BU0slNUQlMjBwbGF5ZWQlMjBpbiUzRiUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMEEpJTBBbGFiZWxzJTIwJTNEJTIwdG9rZW5pemVyKCUwQSUyMCUyMCUyMCUyMHRhYmxlJTNEdGFibGUlMkMlMjBxdWVyaWVzJTNEJTIySG93JTIwbWFueSUyMG1vdmllcyUyMGhhcyUyMEdlb3JnZSUyMENsb29uZXklMjBwbGF5ZWQlMjBpbiUzRiUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMEEpJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKSUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TapasForMaskedLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TapasForMaskedLM.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>data = {
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Actors&quot;</span>: [<span class="hljs-string">&quot;Brad Pitt&quot;</span>, <span class="hljs-string">&quot;Leonardo Di Caprio&quot;</span>, <span class="hljs-string">&quot;George Clooney&quot;</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Age&quot;</span>: [<span class="hljs-string">&quot;56&quot;</span>, <span class="hljs-string">&quot;45&quot;</span>, <span class="hljs-string">&quot;59&quot;</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Number of movies&quot;</span>: [<span class="hljs-string">&quot;87&quot;</span>, <span class="hljs-string">&quot;53&quot;</span>, <span class="hljs-string">&quot;69&quot;</span>],
<span class="hljs-meta">... </span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>table = pd.DataFrame.from_dict(data)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(
<span class="hljs-meta">... </span>    table=table, queries=<span class="hljs-string">&quot;How many [MASK] has George [MASK] played in?&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tokenizer(
<span class="hljs-meta">... </span>    table=table, queries=<span class="hljs-string">&quot;How many movies has George Clooney played in?&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, labels=labels)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){i=o("p"),M=s("Examples:"),d=p(),b(f.$$.fragment)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Examples:"),g.forEach(t),d=h(c),j(f.$$.fragment,c)},m(c,g){u(c,i,g),e(i,M),u(c,d,g),v(f,c,g),y=!0},p:It,i(c){y||(J(f.$$.fragment,c),y=!0)},o(c){U(f.$$.fragment,c),y=!1},d(c){c&&t(i),c&&t(d),k(f,c)}}}function hj(A){let i,M,d,f,y;return{c(){i=o("p"),M=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=o("code"),f=s("Module"),y=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=n(g,"CODE",{});var I=l(d);f=a(I,"Module"),I.forEach(t),y=a(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(t)},m(c,g){u(c,i,g),e(i,M),e(i,d),e(d,f),e(i,y)},d(c){c&&t(i)}}}function uj(A){let i,M,d,f,y;return f=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBUYXBhc0ZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEFpbXBvcnQlMjB0b3JjaCUwQWltcG9ydCUyMHBhbmRhcyUyMGFzJTIwcGQlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ0YXBhcy1iYXNlLWZpbmV0dW5lZC10YWJmYWN0JTIyKSUwQW1vZGVsJTIwJTNEJTIwVGFwYXNGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ0YXBhcy1iYXNlLWZpbmV0dW5lZC10YWJmYWN0JTIyKSUwQSUwQWRhdGElMjAlM0QlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjJBY3RvcnMlMjIlM0ElMjAlNUIlMjJCcmFkJTIwUGl0dCUyMiUyQyUyMCUyMkxlb25hcmRvJTIwRGklMjBDYXByaW8lMjIlMkMlMjAlMjJHZW9yZ2UlMjBDbG9vbmV5JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIyQWdlJTIyJTNBJTIwJTVCJTIyNTYlMjIlMkMlMjAlMjI0NSUyMiUyQyUyMCUyMjU5JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIyTnVtYmVyJTIwb2YlMjBtb3ZpZXMlMjIlM0ElMjAlNUIlMjI4NyUyMiUyQyUyMCUyMjUzJTIyJTJDJTIwJTIyNjklMjIlNUQlMkMlMEElN0QlMEF0YWJsZSUyMCUzRCUyMHBkLkRhdGFGcmFtZS5mcm9tX2RpY3QoZGF0YSklMEFxdWVyaWVzJTIwJTNEJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIyVGhlcmUlMjBpcyUyMG9ubHklMjBvbmUlMjBhY3RvciUyMHdobyUyMGlzJTIwNDUlMjB5ZWFycyUyMG9sZCUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMlRoZXJlJTIwYXJlJTIwMyUyMGFjdG9ycyUyMHdoaWNoJTIwcGxheWVkJTIwaW4lMjBtb3JlJTIwdGhhbiUyMDYwJTIwbW92aWVzJTIyJTJDJTBBJTVEJTBBJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHRhYmxlJTNEdGFibGUlMkMlMjBxdWVyaWVzJTNEcXVlcmllcyUyQyUyMHBhZGRpbmclM0QlMjJtYXhfbGVuZ3RoJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFsYWJlbHMlMjAlM0QlMjB0b3JjaC50ZW5zb3IoJTVCMSUyQyUyMDAlNUQpJTIwJTIwJTIzJTIwMSUyMG1lYW5zJTIwZW50YWlsZWQlMkMlMjAwJTIwbWVhbnMlMjByZWZ1dGVkJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKSUwQWxvc3MlMjAlM0QlMjBvdXRwdXRzLmxvc3MlMEFsb2dpdHMlMjAlM0QlMjBvdXRwdXRzLmxvZ2l0cw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TapasForSequenceClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/tapas-base-finetuned-tabfact&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TapasForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;google/tapas-base-finetuned-tabfact&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>data = {
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Actors&quot;</span>: [<span class="hljs-string">&quot;Brad Pitt&quot;</span>, <span class="hljs-string">&quot;Leonardo Di Caprio&quot;</span>, <span class="hljs-string">&quot;George Clooney&quot;</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Age&quot;</span>: [<span class="hljs-string">&quot;56&quot;</span>, <span class="hljs-string">&quot;45&quot;</span>, <span class="hljs-string">&quot;59&quot;</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Number of movies&quot;</span>: [<span class="hljs-string">&quot;87&quot;</span>, <span class="hljs-string">&quot;53&quot;</span>, <span class="hljs-string">&quot;69&quot;</span>],
<span class="hljs-meta">... </span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>table = pd.DataFrame.from_dict(data)
<span class="hljs-meta">&gt;&gt;&gt; </span>queries = [
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;There is only one actor who is 45 years old&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;There are 3 actors which played in more than 60 movies&quot;</span>,
<span class="hljs-meta">... </span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(table=table, queries=queries, padding=<span class="hljs-string">&quot;max_length&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = torch.tensor([<span class="hljs-number">1</span>, <span class="hljs-number">0</span>])  <span class="hljs-comment"># 1 means entailed, 0 means refuted</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, labels=labels)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){i=o("p"),M=s("Examples:"),d=p(),b(f.$$.fragment)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Examples:"),g.forEach(t),d=h(c),j(f.$$.fragment,c)},m(c,g){u(c,i,g),e(i,M),u(c,d,g),v(f,c,g),y=!0},p:It,i(c){y||(J(f.$$.fragment,c),y=!0)},o(c){U(f.$$.fragment,c),y=!1},d(c){c&&t(i),c&&t(d),k(f,c)}}}function mj(A){let i,M,d,f,y;return{c(){i=o("p"),M=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=o("code"),f=s("Module"),y=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=n(g,"CODE",{});var I=l(d);f=a(I,"Module"),I.forEach(t),y=a(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(t)},m(c,g){u(c,i,g),e(i,M),e(i,d),e(d,f),e(i,y)},d(c){c&&t(i)}}}function fj(A){let i,M,d,f,y;return f=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBUYXBhc0ZvclF1ZXN0aW9uQW5zd2VyaW5nJTBBaW1wb3J0JTIwcGFuZGFzJTIwYXMlMjBwZCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnRhcGFzLWJhc2UtZmluZXR1bmVkLXd0cSUyMiklMEFtb2RlbCUyMCUzRCUyMFRhcGFzRm9yUXVlc3Rpb25BbnN3ZXJpb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BvdXRwdXRzLmxvZ2l0c19hZ2dyZWdhdGlvbg==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TapasForQuestionAnswering
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/tapas-base-finetuned-wtq&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TapasForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;google/tapas-base-finetuned-wtq&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>data = {
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Actors&quot;</span>: [<span class="hljs-string">&quot;Brad Pitt&quot;</span>, <span class="hljs-string">&quot;Leonardo Di Caprio&quot;</span>, <span class="hljs-string">&quot;George Clooney&quot;</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Age&quot;</span>: [<span class="hljs-string">&quot;56&quot;</span>, <span class="hljs-string">&quot;45&quot;</span>, <span class="hljs-string">&quot;59&quot;</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Number of movies&quot;</span>: [<span class="hljs-string">&quot;87&quot;</span>, <span class="hljs-string">&quot;53&quot;</span>, <span class="hljs-string">&quot;69&quot;</span>],
<span class="hljs-meta">... </span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>table = pd.DataFrame.from_dict(data)
<span class="hljs-meta">&gt;&gt;&gt; </span>queries = [<span class="hljs-string">&quot;How many movies has George Clooney played in?&quot;</span>, <span class="hljs-string">&quot;How old is Brad Pitt?&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(table=table, queries=queries, padding=<span class="hljs-string">&quot;max_length&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span>logits_aggregation = outputs.logits_aggregation`}}),{c(){i=o("p"),M=s("Examples:"),d=p(),b(f.$$.fragment)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Examples:"),g.forEach(t),d=h(c),j(f.$$.fragment,c)},m(c,g){u(c,i,g),e(i,M),u(c,d,g),v(f,c,g),y=!0},p:It,i(c){y||(J(f.$$.fragment,c),y=!0)},o(c){U(f.$$.fragment,c),y=!1},d(c){c&&t(i),c&&t(d),k(f,c)}}}function gj(A){let i,M,d,f,y,c,g,I,E,S,$,Y,ae,w,X,L,W,x,z,F,R,P,ie,me,K,ge,pe,ee,Te,q,G,Q,Z,D,V,we,Ce,he,fe,Ee,se,je,Me,Ze,Fe,ve,Be,Ue,ce,We,be,O,Je,H,Re,oe,Se,xe;return{c(){i=o("p"),M=s("TensorFlow models and layers in "),d=o("code"),f=s("transformers"),y=s(" accept two formats as input:"),c=p(),g=o("ul"),I=o("li"),E=s("having all inputs as keyword arguments (like PyTorch models), or"),S=p(),$=o("li"),Y=s("having all inputs as a list, tuple or dict in the first positional argument."),ae=p(),w=o("p"),X=s(`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 `),L=o("code"),W=s("model.fit()"),x=s(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),z=o("code"),F=s("model.fit()"),R=s(` supports! If, however, you want to use the second
format outside of Keras methods like `),P=o("code"),ie=s("fit()"),me=s(" and "),K=o("code"),ge=s("predict()"),pe=s(`, such as when creating your own layers or models with
the Keras `),ee=o("code"),Te=s("Functional"),q=s(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),G=p(),Q=o("ul"),Z=o("li"),D=s("a single Tensor with "),V=o("code"),we=s("input_ids"),Ce=s(" only and nothing else: "),he=o("code"),fe=s("model(input_ids)"),Ee=p(),se=o("li"),je=s(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Me=o("code"),Ze=s("model([input_ids, attention_mask])"),Fe=s(" or "),ve=o("code"),Be=s("model([input_ids, attention_mask, token_type_ids])"),Ue=p(),ce=o("li"),We=s(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),be=o("code"),O=s('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Je=p(),H=o("p"),Re=s(`Note that when creating models and layers with
`),oe=o("a"),Se=s("subclassing"),xe=s(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(_){i=n(_,"P",{});var B=l(i);M=a(B,"TensorFlow models and layers in "),d=n(B,"CODE",{});var He=l(d);f=a(He,"transformers"),He.forEach(t),y=a(B," accept two formats as input:"),B.forEach(t),c=h(_),g=n(_,"UL",{});var ye=l(g);I=n(ye,"LI",{});var Pe=l(I);E=a(Pe,"having all inputs as keyword arguments (like PyTorch models), or"),Pe.forEach(t),S=h(ye),$=n(ye,"LI",{});var Oe=l($);Y=a(Oe,"having all inputs as a list, tuple or dict in the first positional argument."),Oe.forEach(t),ye.forEach(t),ae=h(_),w=n(_,"P",{});var N=l(w);X=a(N,`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 `),L=n(N,"CODE",{});var Ge=l(L);W=a(Ge,"model.fit()"),Ge.forEach(t),x=a(N,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),z=n(N,"CODE",{});var ot=l(z);F=a(ot,"model.fit()"),ot.forEach(t),R=a(N,` supports! If, however, you want to use the second
format outside of Keras methods like `),P=n(N,"CODE",{});var Ne=l(P);ie=a(Ne,"fit()"),Ne.forEach(t),me=a(N," and "),K=n(N,"CODE",{});var Qe=l(K);ge=a(Qe,"predict()"),Qe.forEach(t),pe=a(N,`, such as when creating your own layers or models with
the Keras `),ee=n(N,"CODE",{});var Le=l(ee);Te=a(Le,"Functional"),Le.forEach(t),q=a(N,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),N.forEach(t),G=h(_),Q=n(_,"UL",{});var de=l(Q);Z=n(de,"LI",{});var ke=l(Z);D=a(ke,"a single Tensor with "),V=n(ke,"CODE",{});var Ke=l(V);we=a(Ke,"input_ids"),Ke.forEach(t),Ce=a(ke," only and nothing else: "),he=n(ke,"CODE",{});var Ae=l(he);fe=a(Ae,"model(input_ids)"),Ae.forEach(t),ke.forEach(t),Ee=h(de),se=n(de,"LI",{});var ne=l(se);je=a(ne,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Me=n(ne,"CODE",{});var et=l(Me);Ze=a(et,"model([input_ids, attention_mask])"),et.forEach(t),Fe=a(ne," or "),ve=n(ne,"CODE",{});var Ve=l(ve);Be=a(Ve,"model([input_ids, attention_mask, token_type_ids])"),Ve.forEach(t),ne.forEach(t),Ue=h(de),ce=n(de,"LI",{});var le=l(ce);We=a(le,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),be=n(le,"CODE",{});var Xe=l(be);O=a(Xe,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Xe.forEach(t),le.forEach(t),de.forEach(t),Je=h(_),H=n(_,"P",{});var Ie=l(H);Re=a(Ie,`Note that when creating models and layers with
`),oe=n(Ie,"A",{href:!0,rel:!0});var tt=l(oe);Se=a(tt,"subclassing"),tt.forEach(t),xe=a(Ie,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),Ie.forEach(t),this.h()},h(){m(oe,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(oe,"rel","nofollow")},m(_,B){u(_,i,B),e(i,M),e(i,d),e(d,f),e(i,y),u(_,c,B),u(_,g,B),e(g,I),e(I,E),e(g,S),e(g,$),e($,Y),u(_,ae,B),u(_,w,B),e(w,X),e(w,L),e(L,W),e(w,x),e(w,z),e(z,F),e(w,R),e(w,P),e(P,ie),e(w,me),e(w,K),e(K,ge),e(w,pe),e(w,ee),e(ee,Te),e(w,q),u(_,G,B),u(_,Q,B),e(Q,Z),e(Z,D),e(Z,V),e(V,we),e(Z,Ce),e(Z,he),e(he,fe),e(Q,Ee),e(Q,se),e(se,je),e(se,Me),e(Me,Ze),e(se,Fe),e(se,ve),e(ve,Be),e(Q,Ue),e(Q,ce),e(ce,We),e(ce,be),e(be,O),u(_,Je,B),u(_,H,B),e(H,Re),e(H,oe),e(oe,Se),e(H,xe)},d(_){_&&t(i),_&&t(c),_&&t(g),_&&t(ae),_&&t(w),_&&t(G),_&&t(Q),_&&t(Je),_&&t(H)}}}function Tj(A){let i,M,d,f,y;return{c(){i=o("p"),M=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=o("code"),f=s("Module"),y=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=n(g,"CODE",{});var I=l(d);f=a(I,"Module"),I.forEach(t),y=a(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(t)},m(c,g){u(c,i,g),e(i,M),e(i,d),e(d,f),e(i,y)},d(c){c&&t(i)}}}function Mj(A){let i,M,d,f,y;return f=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBUYXBhc01vZGVsJTBBaW1wb3J0JTIwcGFuZGFzJTIwYXMlMjBwZCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnRhcGFzLWJhc2UlMjIpJTBBbW9kZWwlMjAlM0QlMjBUYXBhc01vZGVsLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ0YXBhcy1iYXNlJTIyKSUwQSUwQWRhdGElMjAlM0QlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjJBY3RvcnMlMjIlM0ElMjAlNUIlMjJCcmFkJTIwUGl0dCUyMiUyQyUyMCUyMkxlb25hcmRvJTIwRGklMjBDYXByaW8lMjIlMkMlMjAlMjJHZW9yZ2UlMjBDbG9vbmV5JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIyQWdlJTIyJTNBJTIwJTVCJTIyNTYlMjIlMkMlMjAlMjI0NSUyMiUyQyUyMCUyMjU5JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIyTnVtYmVyJTIwb2YlMjBtb3ZpZXMlMjIlM0ElMjAlNUIlMjI4NyUyMiUyQyUyMCUyMjUzJTIyJTJDJTIwJTIyNjklMjIlNUQlMkMlMEElN0QlMEF0YWJsZSUyMCUzRCUyMHBkLkRhdGFGcmFtZS5mcm9tX2RpY3QoZGF0YSklMEFxdWVyaWVzJTIwJTNEJTIwJTVCJTIySG93JTIwbWFueSUyMG1vdmllcyUyMGhhcyUyMEdlb3JnZSUyMENsb29uZXklMjBwbGF5ZWQlMjBpbiUzRiUyMiUyQyUyMCUyMkhvdyUyMG9sZCUyMGlzJTIwQnJhZCUyMFBpdHQlM0YlMjIlNUQlMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIodGFibGUlM0R0YWJsZSUyQyUyMHF1ZXJpZXMlM0RxdWVyaWVzJTJDJTIwcGFkZGluZyUzRCUyMm1heF9sZW5ndGglMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cyklMEElMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TapasModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TapasModel.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>data = {
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Actors&quot;</span>: [<span class="hljs-string">&quot;Brad Pitt&quot;</span>, <span class="hljs-string">&quot;Leonardo Di Caprio&quot;</span>, <span class="hljs-string">&quot;George Clooney&quot;</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Age&quot;</span>: [<span class="hljs-string">&quot;56&quot;</span>, <span class="hljs-string">&quot;45&quot;</span>, <span class="hljs-string">&quot;59&quot;</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Number of movies&quot;</span>: [<span class="hljs-string">&quot;87&quot;</span>, <span class="hljs-string">&quot;53&quot;</span>, <span class="hljs-string">&quot;69&quot;</span>],
<span class="hljs-meta">... </span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>table = pd.DataFrame.from_dict(data)
<span class="hljs-meta">&gt;&gt;&gt; </span>queries = [<span class="hljs-string">&quot;How many movies has George Clooney played in?&quot;</span>, <span class="hljs-string">&quot;How old is Brad Pitt?&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(table=table, queries=queries, padding=<span class="hljs-string">&quot;max_length&quot;</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){i=o("p"),M=s("Examples:"),d=p(),b(f.$$.fragment)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Examples:"),g.forEach(t),d=h(c),j(f.$$.fragment,c)},m(c,g){u(c,i,g),e(i,M),u(c,d,g),v(f,c,g),y=!0},p:It,i(c){y||(J(f.$$.fragment,c),y=!0)},o(c){U(f.$$.fragment,c),y=!1},d(c){c&&t(i),c&&t(d),k(f,c)}}}function yj(A){let i,M,d,f,y,c,g,I,E,S,$,Y,ae,w,X,L,W,x,z,F,R,P,ie,me,K,ge,pe,ee,Te,q,G,Q,Z,D,V,we,Ce,he,fe,Ee,se,je,Me,Ze,Fe,ve,Be,Ue,ce,We,be,O,Je,H,Re,oe,Se,xe;return{c(){i=o("p"),M=s("TensorFlow models and layers in "),d=o("code"),f=s("transformers"),y=s(" accept two formats as input:"),c=p(),g=o("ul"),I=o("li"),E=s("having all inputs as keyword arguments (like PyTorch models), or"),S=p(),$=o("li"),Y=s("having all inputs as a list, tuple or dict in the first positional argument."),ae=p(),w=o("p"),X=s(`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 `),L=o("code"),W=s("model.fit()"),x=s(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),z=o("code"),F=s("model.fit()"),R=s(` supports! If, however, you want to use the second
format outside of Keras methods like `),P=o("code"),ie=s("fit()"),me=s(" and "),K=o("code"),ge=s("predict()"),pe=s(`, such as when creating your own layers or models with
the Keras `),ee=o("code"),Te=s("Functional"),q=s(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),G=p(),Q=o("ul"),Z=o("li"),D=s("a single Tensor with "),V=o("code"),we=s("input_ids"),Ce=s(" only and nothing else: "),he=o("code"),fe=s("model(input_ids)"),Ee=p(),se=o("li"),je=s(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Me=o("code"),Ze=s("model([input_ids, attention_mask])"),Fe=s(" or "),ve=o("code"),Be=s("model([input_ids, attention_mask, token_type_ids])"),Ue=p(),ce=o("li"),We=s(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),be=o("code"),O=s('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Je=p(),H=o("p"),Re=s(`Note that when creating models and layers with
`),oe=o("a"),Se=s("subclassing"),xe=s(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(_){i=n(_,"P",{});var B=l(i);M=a(B,"TensorFlow models and layers in "),d=n(B,"CODE",{});var He=l(d);f=a(He,"transformers"),He.forEach(t),y=a(B," accept two formats as input:"),B.forEach(t),c=h(_),g=n(_,"UL",{});var ye=l(g);I=n(ye,"LI",{});var Pe=l(I);E=a(Pe,"having all inputs as keyword arguments (like PyTorch models), or"),Pe.forEach(t),S=h(ye),$=n(ye,"LI",{});var Oe=l($);Y=a(Oe,"having all inputs as a list, tuple or dict in the first positional argument."),Oe.forEach(t),ye.forEach(t),ae=h(_),w=n(_,"P",{});var N=l(w);X=a(N,`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 `),L=n(N,"CODE",{});var Ge=l(L);W=a(Ge,"model.fit()"),Ge.forEach(t),x=a(N,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),z=n(N,"CODE",{});var ot=l(z);F=a(ot,"model.fit()"),ot.forEach(t),R=a(N,` supports! If, however, you want to use the second
format outside of Keras methods like `),P=n(N,"CODE",{});var Ne=l(P);ie=a(Ne,"fit()"),Ne.forEach(t),me=a(N," and "),K=n(N,"CODE",{});var Qe=l(K);ge=a(Qe,"predict()"),Qe.forEach(t),pe=a(N,`, such as when creating your own layers or models with
the Keras `),ee=n(N,"CODE",{});var Le=l(ee);Te=a(Le,"Functional"),Le.forEach(t),q=a(N,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),N.forEach(t),G=h(_),Q=n(_,"UL",{});var de=l(Q);Z=n(de,"LI",{});var ke=l(Z);D=a(ke,"a single Tensor with "),V=n(ke,"CODE",{});var Ke=l(V);we=a(Ke,"input_ids"),Ke.forEach(t),Ce=a(ke," only and nothing else: "),he=n(ke,"CODE",{});var Ae=l(he);fe=a(Ae,"model(input_ids)"),Ae.forEach(t),ke.forEach(t),Ee=h(de),se=n(de,"LI",{});var ne=l(se);je=a(ne,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Me=n(ne,"CODE",{});var et=l(Me);Ze=a(et,"model([input_ids, attention_mask])"),et.forEach(t),Fe=a(ne," or "),ve=n(ne,"CODE",{});var Ve=l(ve);Be=a(Ve,"model([input_ids, attention_mask, token_type_ids])"),Ve.forEach(t),ne.forEach(t),Ue=h(de),ce=n(de,"LI",{});var le=l(ce);We=a(le,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),be=n(le,"CODE",{});var Xe=l(be);O=a(Xe,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Xe.forEach(t),le.forEach(t),de.forEach(t),Je=h(_),H=n(_,"P",{});var Ie=l(H);Re=a(Ie,`Note that when creating models and layers with
`),oe=n(Ie,"A",{href:!0,rel:!0});var tt=l(oe);Se=a(tt,"subclassing"),tt.forEach(t),xe=a(Ie,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),Ie.forEach(t),this.h()},h(){m(oe,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(oe,"rel","nofollow")},m(_,B){u(_,i,B),e(i,M),e(i,d),e(d,f),e(i,y),u(_,c,B),u(_,g,B),e(g,I),e(I,E),e(g,S),e(g,$),e($,Y),u(_,ae,B),u(_,w,B),e(w,X),e(w,L),e(L,W),e(w,x),e(w,z),e(z,F),e(w,R),e(w,P),e(P,ie),e(w,me),e(w,K),e(K,ge),e(w,pe),e(w,ee),e(ee,Te),e(w,q),u(_,G,B),u(_,Q,B),e(Q,Z),e(Z,D),e(Z,V),e(V,we),e(Z,Ce),e(Z,he),e(he,fe),e(Q,Ee),e(Q,se),e(se,je),e(se,Me),e(Me,Ze),e(se,Fe),e(se,ve),e(ve,Be),e(Q,Ue),e(Q,ce),e(ce,We),e(ce,be),e(be,O),u(_,Je,B),u(_,H,B),e(H,Re),e(H,oe),e(oe,Se),e(H,xe)},d(_){_&&t(i),_&&t(c),_&&t(g),_&&t(ae),_&&t(w),_&&t(G),_&&t(Q),_&&t(Je),_&&t(H)}}}function _j(A){let i,M,d,f,y;return{c(){i=o("p"),M=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=o("code"),f=s("Module"),y=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=n(g,"CODE",{});var I=l(d);f=a(I,"Module"),I.forEach(t),y=a(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(t)},m(c,g){u(c,i,g),e(i,M),e(i,d),e(d,f),e(i,y)},d(c){c&&t(i)}}}function wj(A){let i,M,d,f,y;return f=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBUYXBhc0Zvck1hc2tlZExNJTBBaW1wb3J0JTIwcGFuZGFzJTIwYXMlMjBwZCUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKCUyMmdvb2dsZSUyRnRhcGFzLWJhc2UlMjIpJTBBbW9kZWwlMjAlM0QlMjBUYXBhc0Zvck1hc2tlZExNLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ0YXBhcy1iYXNlJTIyKSUwQSUwQWRhdGElMjAlM0QlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjJBY3RvcnMlMjIlM0ElMjAlNUIlMjJCcmFkJTIwUGl0dCUyMiUyQyUyMCUyMkxlb25hcmRvJTIwRGklMjBDYXByaW8lMjIlMkMlMjAlMjJHZW9yZ2UlMjBDbG9vbmV5JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIyQWdlJTIyJTNBJTIwJTVCJTIyNTYlMjIlMkMlMjAlMjI0NSUyMiUyQyUyMCUyMjU5JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIyTnVtYmVyJTIwb2YlMjBtb3ZpZXMlMjIlM0ElMjAlNUIlMjI4NyUyMiUyQyUyMCUyMjUzJTIyJTJDJTIwJTIyNjklMjIlNUQlMkMlMEElN0QlMEF0YWJsZSUyMCUzRCUyMHBkLkRhdGFGcmFtZS5mcm9tX2RpY3QoZGF0YSklMEElMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIoJTBBJTIwJTIwJTIwJTIwdGFibGUlM0R0YWJsZSUyQyUyMHF1ZXJpZXMlM0QlMjJIb3clMjBtYW55JTIwJTVCTUFTSyU1RCUyMGhhcyUyMEdlb3JnZSUyMCU1Qk1BU0slNUQlMjBwbGF5ZWQlMjBpbiUzRiUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIlMEEpJTBBbGFiZWxzJTIwJTNEJTIwdG9rZW5pemVyKCUwQSUyMCUyMCUyMCUyMHRhYmxlJTNEdGFibGUlMkMlMjBxdWVyaWVzJTNEJTIySG93JTIwbWFueSUyMG1vdmllcyUyMGhhcyUyMEdlb3JnZSUyMENsb29uZXklMjBwbGF5ZWQlMjBpbiUzRiUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIlMEEpJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTBBJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzJTJDJTIwbGFiZWxzJTNEbGFiZWxzKSUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TapasForMaskedLM
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TapasForMaskedLM.from_pretrained(<span class="hljs-string">&quot;google/tapas-base&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>data = {
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Actors&quot;</span>: [<span class="hljs-string">&quot;Brad Pitt&quot;</span>, <span class="hljs-string">&quot;Leonardo Di Caprio&quot;</span>, <span class="hljs-string">&quot;George Clooney&quot;</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Age&quot;</span>: [<span class="hljs-string">&quot;56&quot;</span>, <span class="hljs-string">&quot;45&quot;</span>, <span class="hljs-string">&quot;59&quot;</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Number of movies&quot;</span>: [<span class="hljs-string">&quot;87&quot;</span>, <span class="hljs-string">&quot;53&quot;</span>, <span class="hljs-string">&quot;69&quot;</span>],
<span class="hljs-meta">... </span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>table = pd.DataFrame.from_dict(data)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(
<span class="hljs-meta">... </span>    table=table, queries=<span class="hljs-string">&quot;How many [MASK] has George [MASK] played in?&quot;</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tokenizer(
<span class="hljs-meta">... </span>    table=table, queries=<span class="hljs-string">&quot;How many movies has George Clooney played in?&quot;</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>
<span class="hljs-meta">... </span>)[<span class="hljs-string">&quot;input_ids&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, labels=labels)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){i=o("p"),M=s("Examples:"),d=p(),b(f.$$.fragment)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Examples:"),g.forEach(t),d=h(c),j(f.$$.fragment,c)},m(c,g){u(c,i,g),e(i,M),u(c,d,g),v(f,c,g),y=!0},p:It,i(c){y||(J(f.$$.fragment,c),y=!0)},o(c){U(f.$$.fragment,c),y=!1},d(c){c&&t(i),c&&t(d),k(f,c)}}}function bj(A){let i,M,d,f,y,c,g,I,E,S,$,Y,ae,w,X,L,W,x,z,F,R,P,ie,me,K,ge,pe,ee,Te,q,G,Q,Z,D,V,we,Ce,he,fe,Ee,se,je,Me,Ze,Fe,ve,Be,Ue,ce,We,be,O,Je,H,Re,oe,Se,xe;return{c(){i=o("p"),M=s("TensorFlow models and layers in "),d=o("code"),f=s("transformers"),y=s(" accept two formats as input:"),c=p(),g=o("ul"),I=o("li"),E=s("having all inputs as keyword arguments (like PyTorch models), or"),S=p(),$=o("li"),Y=s("having all inputs as a list, tuple or dict in the first positional argument."),ae=p(),w=o("p"),X=s(`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 `),L=o("code"),W=s("model.fit()"),x=s(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),z=o("code"),F=s("model.fit()"),R=s(` supports! If, however, you want to use the second
format outside of Keras methods like `),P=o("code"),ie=s("fit()"),me=s(" and "),K=o("code"),ge=s("predict()"),pe=s(`, such as when creating your own layers or models with
the Keras `),ee=o("code"),Te=s("Functional"),q=s(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),G=p(),Q=o("ul"),Z=o("li"),D=s("a single Tensor with "),V=o("code"),we=s("input_ids"),Ce=s(" only and nothing else: "),he=o("code"),fe=s("model(input_ids)"),Ee=p(),se=o("li"),je=s(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Me=o("code"),Ze=s("model([input_ids, attention_mask])"),Fe=s(" or "),ve=o("code"),Be=s("model([input_ids, attention_mask, token_type_ids])"),Ue=p(),ce=o("li"),We=s(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),be=o("code"),O=s('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Je=p(),H=o("p"),Re=s(`Note that when creating models and layers with
`),oe=o("a"),Se=s("subclassing"),xe=s(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(_){i=n(_,"P",{});var B=l(i);M=a(B,"TensorFlow models and layers in "),d=n(B,"CODE",{});var He=l(d);f=a(He,"transformers"),He.forEach(t),y=a(B," accept two formats as input:"),B.forEach(t),c=h(_),g=n(_,"UL",{});var ye=l(g);I=n(ye,"LI",{});var Pe=l(I);E=a(Pe,"having all inputs as keyword arguments (like PyTorch models), or"),Pe.forEach(t),S=h(ye),$=n(ye,"LI",{});var Oe=l($);Y=a(Oe,"having all inputs as a list, tuple or dict in the first positional argument."),Oe.forEach(t),ye.forEach(t),ae=h(_),w=n(_,"P",{});var N=l(w);X=a(N,`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 `),L=n(N,"CODE",{});var Ge=l(L);W=a(Ge,"model.fit()"),Ge.forEach(t),x=a(N,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),z=n(N,"CODE",{});var ot=l(z);F=a(ot,"model.fit()"),ot.forEach(t),R=a(N,` supports! If, however, you want to use the second
format outside of Keras methods like `),P=n(N,"CODE",{});var Ne=l(P);ie=a(Ne,"fit()"),Ne.forEach(t),me=a(N," and "),K=n(N,"CODE",{});var Qe=l(K);ge=a(Qe,"predict()"),Qe.forEach(t),pe=a(N,`, such as when creating your own layers or models with
the Keras `),ee=n(N,"CODE",{});var Le=l(ee);Te=a(Le,"Functional"),Le.forEach(t),q=a(N,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),N.forEach(t),G=h(_),Q=n(_,"UL",{});var de=l(Q);Z=n(de,"LI",{});var ke=l(Z);D=a(ke,"a single Tensor with "),V=n(ke,"CODE",{});var Ke=l(V);we=a(Ke,"input_ids"),Ke.forEach(t),Ce=a(ke," only and nothing else: "),he=n(ke,"CODE",{});var Ae=l(he);fe=a(Ae,"model(input_ids)"),Ae.forEach(t),ke.forEach(t),Ee=h(de),se=n(de,"LI",{});var ne=l(se);je=a(ne,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Me=n(ne,"CODE",{});var et=l(Me);Ze=a(et,"model([input_ids, attention_mask])"),et.forEach(t),Fe=a(ne," or "),ve=n(ne,"CODE",{});var Ve=l(ve);Be=a(Ve,"model([input_ids, attention_mask, token_type_ids])"),Ve.forEach(t),ne.forEach(t),Ue=h(de),ce=n(de,"LI",{});var le=l(ce);We=a(le,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),be=n(le,"CODE",{});var Xe=l(be);O=a(Xe,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Xe.forEach(t),le.forEach(t),de.forEach(t),Je=h(_),H=n(_,"P",{});var Ie=l(H);Re=a(Ie,`Note that when creating models and layers with
`),oe=n(Ie,"A",{href:!0,rel:!0});var tt=l(oe);Se=a(tt,"subclassing"),tt.forEach(t),xe=a(Ie,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),Ie.forEach(t),this.h()},h(){m(oe,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(oe,"rel","nofollow")},m(_,B){u(_,i,B),e(i,M),e(i,d),e(d,f),e(i,y),u(_,c,B),u(_,g,B),e(g,I),e(I,E),e(g,S),e(g,$),e($,Y),u(_,ae,B),u(_,w,B),e(w,X),e(w,L),e(L,W),e(w,x),e(w,z),e(z,F),e(w,R),e(w,P),e(P,ie),e(w,me),e(w,K),e(K,ge),e(w,pe),e(w,ee),e(ee,Te),e(w,q),u(_,G,B),u(_,Q,B),e(Q,Z),e(Z,D),e(Z,V),e(V,we),e(Z,Ce),e(Z,he),e(he,fe),e(Q,Ee),e(Q,se),e(se,je),e(se,Me),e(Me,Ze),e(se,Fe),e(se,ve),e(ve,Be),e(Q,Ue),e(Q,ce),e(ce,We),e(ce,be),e(be,O),u(_,Je,B),u(_,H,B),e(H,Re),e(H,oe),e(oe,Se),e(H,xe)},d(_){_&&t(i),_&&t(c),_&&t(g),_&&t(ae),_&&t(w),_&&t(G),_&&t(Q),_&&t(Je),_&&t(H)}}}function jj(A){let i,M,d,f,y;return{c(){i=o("p"),M=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=o("code"),f=s("Module"),y=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=n(g,"CODE",{});var I=l(d);f=a(I,"Module"),I.forEach(t),y=a(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(t)},m(c,g){u(c,i,g),e(i,M),e(i,d),e(d,f),e(i,y)},d(c){c&&t(i)}}}function vj(A){let i,M,d,f,y;return f=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBUYXBhc0ZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEFpbXBvcnQlMjB0ZW5zb3JmbG93JTIwYXMlMjB0ZiUwQWltcG9ydCUyMHBhbmRhcyUyMGFzJTIwcGQlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ0YXBhcy1iYXNlLWZpbmV0dW5lZC10YWJmYWN0JTIyKSUwQW1vZGVsJTIwJTNEJTIwVGFwYXNGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJnb29nbGUlMkZ0YXBhcy1iYXNlLWZpbmV0dW5lZC10YWJmYWN0JTIyKSUwQSUwQWRhdGElMjAlM0QlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjJBY3RvcnMlMjIlM0ElMjAlNUIlMjJCcmFkJTIwUGl0dCUyMiUyQyUyMCUyMkxlb25hcmRvJTIwRGklMjBDYXByaW8lMjIlMkMlMjAlM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ubG9zcyUwQWxvZ2l0cyUyMCUzRCUyMG91dHB1dHMubG9naXRz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TapasForSequenceClassification
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/tapas-base-finetuned-tabfact&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TapasForSequenceClassification.from_pretrained(<span class="hljs-string">&quot;google/tapas-base-finetuned-tabfact&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>data = {
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Actors&quot;</span>: [<span class="hljs-string">&quot;Brad Pitt&quot;</span>, <span class="hljs-string">&quot;Leonardo Di Caprio&quot;</span>, <span class="hljs-string">&quot;George Clooney&quot;</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Age&quot;</span>: [<span class="hljs-string">&quot;56&quot;</span>, <span class="hljs-string">&quot;45&quot;</span>, <span class="hljs-string">&quot;59&quot;</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Number of movies&quot;</span>: [<span class="hljs-string">&quot;87&quot;</span>, <span class="hljs-string">&quot;53&quot;</span>, <span class="hljs-string">&quot;69&quot;</span>],
<span class="hljs-meta">... </span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>table = pd.DataFrame.from_dict(data)
<span class="hljs-meta">&gt;&gt;&gt; </span>queries = [
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;There is only one actor who is 45 years old&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;There are 3 actors which played in more than 60 movies&quot;</span>,
<span class="hljs-meta">... </span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(table=table, queries=queries, padding=<span class="hljs-string">&quot;max_length&quot;</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>labels = tf.convert_to_tensor([<span class="hljs-number">1</span>, <span class="hljs-number">0</span>])  <span class="hljs-comment"># 1 means entailed, 0 means refuted</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs, labels=labels)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = outputs.loss
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits`}}),{c(){i=o("p"),M=s("Examples:"),d=p(),b(f.$$.fragment)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Examples:"),g.forEach(t),d=h(c),j(f.$$.fragment,c)},m(c,g){u(c,i,g),e(i,M),u(c,d,g),v(f,c,g),y=!0},p:It,i(c){y||(J(f.$$.fragment,c),y=!0)},o(c){U(f.$$.fragment,c),y=!1},d(c){c&&t(i),c&&t(d),k(f,c)}}}function Jj(A){let i,M,d,f,y,c,g,I,E,S,$,Y,ae,w,X,L,W,x,z,F,R,P,ie,me,K,ge,pe,ee,Te,q,G,Q,Z,D,V,we,Ce,he,fe,Ee,se,je,Me,Ze,Fe,ve,Be,Ue,ce,We,be,O,Je,H,Re,oe,Se,xe;return{c(){i=o("p"),M=s("TensorFlow models and layers in "),d=o("code"),f=s("transformers"),y=s(" accept two formats as input:"),c=p(),g=o("ul"),I=o("li"),E=s("having all inputs as keyword arguments (like PyTorch models), or"),S=p(),$=o("li"),Y=s("having all inputs as a list, tuple or dict in the first positional argument."),ae=p(),w=o("p"),X=s(`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 `),L=o("code"),W=s("model.fit()"),x=s(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),z=o("code"),F=s("model.fit()"),R=s(` supports! If, however, you want to use the second
format outside of Keras methods like `),P=o("code"),ie=s("fit()"),me=s(" and "),K=o("code"),ge=s("predict()"),pe=s(`, such as when creating your own layers or models with
the Keras `),ee=o("code"),Te=s("Functional"),q=s(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),G=p(),Q=o("ul"),Z=o("li"),D=s("a single Tensor with "),V=o("code"),we=s("input_ids"),Ce=s(" only and nothing else: "),he=o("code"),fe=s("model(input_ids)"),Ee=p(),se=o("li"),je=s(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Me=o("code"),Ze=s("model([input_ids, attention_mask])"),Fe=s(" or "),ve=o("code"),Be=s("model([input_ids, attention_mask, token_type_ids])"),Ue=p(),ce=o("li"),We=s(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),be=o("code"),O=s('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Je=p(),H=o("p"),Re=s(`Note that when creating models and layers with
`),oe=o("a"),Se=s("subclassing"),xe=s(` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),this.h()},l(_){i=n(_,"P",{});var B=l(i);M=a(B,"TensorFlow models and layers in "),d=n(B,"CODE",{});var He=l(d);f=a(He,"transformers"),He.forEach(t),y=a(B," accept two formats as input:"),B.forEach(t),c=h(_),g=n(_,"UL",{});var ye=l(g);I=n(ye,"LI",{});var Pe=l(I);E=a(Pe,"having all inputs as keyword arguments (like PyTorch models), or"),Pe.forEach(t),S=h(ye),$=n(ye,"LI",{});var Oe=l($);Y=a(Oe,"having all inputs as a list, tuple or dict in the first positional argument."),Oe.forEach(t),ye.forEach(t),ae=h(_),w=n(_,"P",{});var N=l(w);X=a(N,`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 `),L=n(N,"CODE",{});var Ge=l(L);W=a(Ge,"model.fit()"),Ge.forEach(t),x=a(N,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),z=n(N,"CODE",{});var ot=l(z);F=a(ot,"model.fit()"),ot.forEach(t),R=a(N,` supports! If, however, you want to use the second
format outside of Keras methods like `),P=n(N,"CODE",{});var Ne=l(P);ie=a(Ne,"fit()"),Ne.forEach(t),me=a(N," and "),K=n(N,"CODE",{});var Qe=l(K);ge=a(Qe,"predict()"),Qe.forEach(t),pe=a(N,`, such as when creating your own layers or models with
the Keras `),ee=n(N,"CODE",{});var Le=l(ee);Te=a(Le,"Functional"),Le.forEach(t),q=a(N,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),N.forEach(t),G=h(_),Q=n(_,"UL",{});var de=l(Q);Z=n(de,"LI",{});var ke=l(Z);D=a(ke,"a single Tensor with "),V=n(ke,"CODE",{});var Ke=l(V);we=a(Ke,"input_ids"),Ke.forEach(t),Ce=a(ke," only and nothing else: "),he=n(ke,"CODE",{});var Ae=l(he);fe=a(Ae,"model(input_ids)"),Ae.forEach(t),ke.forEach(t),Ee=h(de),se=n(de,"LI",{});var ne=l(se);je=a(ne,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),Me=n(ne,"CODE",{});var et=l(Me);Ze=a(et,"model([input_ids, attention_mask])"),et.forEach(t),Fe=a(ne," or "),ve=n(ne,"CODE",{});var Ve=l(ve);Be=a(Ve,"model([input_ids, attention_mask, token_type_ids])"),Ve.forEach(t),ne.forEach(t),Ue=h(de),ce=n(de,"LI",{});var le=l(ce);We=a(le,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),be=n(le,"CODE",{});var Xe=l(be);O=a(Xe,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Xe.forEach(t),le.forEach(t),de.forEach(t),Je=h(_),H=n(_,"P",{});var Ie=l(H);Re=a(Ie,`Note that when creating models and layers with
`),oe=n(Ie,"A",{href:!0,rel:!0});var tt=l(oe);Se=a(tt,"subclassing"),tt.forEach(t),xe=a(Ie,` then you don\u2019t need to worry
about any of this, as you can just pass inputs like you would to any other Python function!`),Ie.forEach(t),this.h()},h(){m(oe,"href","https://keras.io/guides/making_new_layers_and_models_via_subclassing/"),m(oe,"rel","nofollow")},m(_,B){u(_,i,B),e(i,M),e(i,d),e(d,f),e(i,y),u(_,c,B),u(_,g,B),e(g,I),e(I,E),e(g,S),e(g,$),e($,Y),u(_,ae,B),u(_,w,B),e(w,X),e(w,L),e(L,W),e(w,x),e(w,z),e(z,F),e(w,R),e(w,P),e(P,ie),e(w,me),e(w,K),e(K,ge),e(w,pe),e(w,ee),e(ee,Te),e(w,q),u(_,G,B),u(_,Q,B),e(Q,Z),e(Z,D),e(Z,V),e(V,we),e(Z,Ce),e(Z,he),e(he,fe),e(Q,Ee),e(Q,se),e(se,je),e(se,Me),e(Me,Ze),e(se,Fe),e(se,ve),e(ve,Be),e(Q,Ue),e(Q,ce),e(ce,We),e(ce,be),e(be,O),u(_,Je,B),u(_,H,B),e(H,Re),e(H,oe),e(oe,Se),e(H,xe)},d(_){_&&t(i),_&&t(c),_&&t(g),_&&t(ae),_&&t(w),_&&t(G),_&&t(Q),_&&t(Je),_&&t(H)}}}function Uj(A){let i,M,d,f,y;return{c(){i=o("p"),M=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=o("code"),f=s("Module"),y=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=n(g,"CODE",{});var I=l(d);f=a(I,"Module"),I.forEach(t),y=a(g,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),g.forEach(t)},m(c,g){u(c,i,g),e(i,M),e(i,d),e(d,f),e(i,y)},d(c){c&&t(i)}}}function kj(A){let i,M,d,f,y;return f=new ht({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBUYXBhc0ZvclF1ZXN0aW9uQW5zd2VyaW5nJTBBaW1wb3J0JTIwcGFuZGFzJTIwYXMlMjBwZCUw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RoJTIyJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKippbnB1dHMpJTBBJTBBbG9naXRzJTIwJTNEJTIwb3V0cHV0cy5sb2dpdHMlMEFsb2dpdHNfYWdncmVnYXRpb24lMjAlM0QlMjBvdXRwdXRzLmxvZ2l0c19hZ2dyZWdhdGlvbg==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, TapasForQuestionAnswering
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;google/tapas-base-finetuned-wtq&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = TapasForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;google/tapas-base-finetuned-wtq&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>data = {
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Actors&quot;</span>: [<span class="hljs-string">&quot;Brad Pitt&quot;</span>, <span class="hljs-string">&quot;Leonardo Di Caprio&quot;</span>, <span class="hljs-string">&quot;George Clooney&quot;</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Age&quot;</span>: [<span class="hljs-string">&quot;56&quot;</span>, <span class="hljs-string">&quot;45&quot;</span>, <span class="hljs-string">&quot;59&quot;</span>],
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Number of movies&quot;</span>: [<span class="hljs-string">&quot;87&quot;</span>, <span class="hljs-string">&quot;53&quot;</span>, <span class="hljs-string">&quot;69&quot;</span>],
<span class="hljs-meta">... </span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>table = pd.DataFrame.from_dict(data)
<span class="hljs-meta">&gt;&gt;&gt; </span>queries = [<span class="hljs-string">&quot;How many movies has George Clooney played in?&quot;</span>, <span class="hljs-string">&quot;How old is Brad Pitt?&quot;</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(table=table, queries=queries, padding=<span class="hljs-string">&quot;max_length&quot;</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>logits = outputs.logits
<span class="hljs-meta">&gt;&gt;&gt; </span>logits_aggregation = outputs.logits_aggregation`}}),{c(){i=o("p"),M=s("Examples:"),d=p(),b(f.$$.fragment)},l(c){i=n(c,"P",{});var g=l(i);M=a(g,"Examples:"),g.forEach(t),d=h(c),j(f.$$.fragment,c)},m(c,g){u(c,i,g),e(i,M),u(c,d,g),v(f,c,g),y=!0},p:It,i(c){y||(J(f.$$.fragment,c),y=!0)},o(c){U(f.$$.fragment,c),y=!1},d(c){c&&t(i),c&&t(d),k(f,c)}}}function Ij(A){let i,M,d,f,y,c,g,I,E,S,$,Y,ae,w,X,L,W,x,z,F,R,P,ie,me,K,ge,pe,ee,Te,q,G,Q,Z,D,V,we,Ce,he,fe,Ee,se,je,Me,Ze,Fe,ve,Be,Ue,ce,We,be,O,Je,H,Re,oe,Se,xe,_,B,He,ye,Pe,Oe,N,Ge,ot,Ne,Qe,Le,de,ke,Ke,Ae,ne,et,Ve,le,Xe,Ie,tt,Bt,Wt,Rs,zt,ys,ts,qt,_s,ut,ze,Ss,$t,re,yt,ss,xs,Gt,ns,Vs,Nt,Qt,Xs,Rt,ls,Ys,St,rs,Ds,xt,Hs,st,Vt,is,Ps,Xt,ds,Os,cs,it,ps,qe,hs,_t,Ls,Yt,Dt,Ks,ea,dt,ta,us,ms,gt,Ht,C,te,ja,sa,va,ha,Pt,Tt,aa,wt,Ja,oa,Ua,ua,nt,fs,ws,ct,ka,ma,bs,na,gs,fa,_e,Ia,js,Ea,Ca,ga,Et,la,Ts,Aa,$e,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,Jt,Il,FT,El,ZT,Nd,BT,WT,zT,Cl,qT,Cr,$T,GT,NT,Al,QT,Fl,RT,ST,xT,Lo,VT,Cs,Zl,XT,ho,YT,Ar,DT,HT,Qd,PT,OT,LT,Ko,KT,en,Hc,uo,tn,Rd,Bl,eM,Sd,tM,Pc,Ut,Wl,sM,xd,aM,oM,zl,nM,Fr,lM,rM,iM,ql,dM,$l,cM,pM,hM,sn,uM,As,Gl,mM,mo,fM,Zr,gM,TM,Vd,MM,yM,_M,an,wM,on,Oc,fo,nn,Xd,Nl,bM,Yd,jM,Lc,kt,Ql,vM,go,JM,Dd,UM,kM,Hd,IM,EM,CM,Rl,AM,Br,FM,ZM,BM,Sl,WM,xl,zM,qM,$M,ln,GM,Fs,Vl,NM,To,QM,Wr,RM,SM,Pd,xM,VM,XM,rn,YM,dn,Kc;return c=new Zt({}),w=new Zt({}),wt=new Zt({}),_o=new Dp({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Db],pytorch:[Xb]},$$scope:{ctx:A}}}),vo=new Dp({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Lb],pytorch:[Pb]},$$scope:{ctx:A}}}),Jo=new Dp({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[sj],pytorch:[ej]},$$scope:{ctx:A}}}),En=new Zt({}),ko=new Dp({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[lj],pytorch:[oj]},$$scope:{ctx:A}}}),Fn=new Zt({}),Zn=new Zt({}),Bn=new rt({props:{name:"class transformers.models.tapas.modeling_tapas.TableQuestionAnsweringOutput",anchor:"transformers.models.tapas.modeling_tapas.TableQuestionAnsweringOutput",parameters:[{name:"loss",val:": typing.Optional[torch.FloatTensor] = None"},{name:"logits",val:": FloatTensor = None"},{name:"logits_aggregation",val:": FloatTensor = None"},{name:"hidden_states",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"},{name:"attentions",val:": typing.Optional[typing.Tuple[torch.FloatTensor]] = None"}],parametersDescription:[{anchor:"transformers.models.tapas.modeling_tapas.TableQuestionAnsweringOutput.loss",description:`<strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> (and possibly <code>answer</code>, <code>aggregation_labels</code>, <code>numeric_values</code> and <code>numeric_values_scale</code> are provided)) &#x2014;
Total loss as the sum of the hierarchical cell selection log-likelihood loss and (optionally) the
semi-supervised regression loss and (optionally) supervised loss for aggregations.`,name:"loss"},{anchor:"transformers.models.tapas.modeling_tapas.TableQuestionAnsweringOutput.logits",description:`<strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Prediction scores of the cell selection head, for every token.`,name:"logits"},{anchor:"transformers.models.tapas.modeling_tapas.TableQuestionAnsweringOutput.logits_aggregation",description:`<strong>logits_aggregation</strong> (<code>torch.FloatTensor</code>, <em>optional</em>, of shape <code>(batch_size, num_aggregation_labels)</code>) &#x2014;
Prediction scores of the aggregation head, for every aggregation operator.`,name:"logits_aggregation"},{anchor:"transformers.models.tapas.modeling_tapas.TableQuestionAnsweringOutput.hidden_states",description:`<strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the model at the output of each layer
plus the initial embedding outputs.`,name:"hidden_states"},{anchor:"transformers.models.tapas.modeling_tapas.TableQuestionAnsweringOutput.attentions",description:`<strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) &#x2014;
Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights after the attention softmax, used to compute the weighted average in
the self-attention heads.`,name:"attentions"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/modeling_tapas.py#L91"}}),zn=new Zt({}),qn=new rt({props:{name:"class transformers.TapasConfig",anchor:"transformers.TapasConfig",parameters:[{name:"vocab_size",val:" = 30522"},{name:"hidden_size",val:" = 768"},{name:"num_hidden_layers",val:" = 12"},{name:"num_attention_heads",val:" = 12"},{name:"intermediate_size",val:" = 3072"},{name:"hidden_act",val:" = 'gelu'"},{name:"hidden_dropout_prob",val:" = 0.1"},{name:"attention_probs_dropout_prob",val:" = 0.1"},{name:"max_position_embeddings",val:" = 1024"},{name:"type_vocab_sizes",val:" = [3, 256, 256, 2, 256, 256, 10]"},{name:"initializer_range",val:" = 0.02"},{name:"layer_norm_eps",val:" = 1e-12"},{name:"pad_token_id",val:" = 0"},{name:"positive_label_weight",val:" = 10.0"},{name:"num_aggregation_labels",val:" = 0"},{name:"aggregation_loss_weight",val:" = 1.0"},{name:"use_answer_as_supervision",val:" = None"},{name:"answer_loss_importance",val:" = 1.0"},{name:"use_normalized_answer_loss",val:" = False"},{name:"huber_loss_delta",val:" = None"},{name:"temperature",val:" = 1.0"},{name:"aggregation_temperature",val:" = 1.0"},{name:"use_gumbel_for_cells",val:" = False"},{name:"use_gumbel_for_aggregation",val:" = False"},{name:"average_approximation_function",val:" = 'ratio'"},{name:"cell_selection_preference",val:" = None"},{name:"answer_loss_cutoff",val:" = None"},{name:"max_num_rows",val:" = 64"},{name:"max_num_columns",val:" = 32"},{name:"average_logits_per_cell",val:" = False"},{name:"select_one_column",val:" = True"},{name:"allow_empty_column_selection",val:" = False"},{name:"init_cell_selection_weights_to_zero",val:" = False"},{name:"reset_position_index_per_cell",val:" = True"},{name:"disable_per_token_loss",val:" = False"},{name:"aggregation_labels",val:" = None"},{name:"no_aggregation_label_index",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TapasConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 30522) &#x2014;
Vocabulary size of the TAPAS model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasModel">TapasModel</a>.`,name:"vocab_size"},{anchor:"transformers.TapasConfig.hidden_size",description:`<strong>hidden_size</strong> (<code>int</code>, <em>optional</em>, defaults to 768) &#x2014;
Dimensionality of the encoder layers and the pooler layer.`,name:"hidden_size"},{anchor:"transformers.TapasConfig.num_hidden_layers",description:`<strong>num_hidden_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of hidden layers in the Transformer encoder.`,name:"num_hidden_layers"},{anchor:"transformers.TapasConfig.num_attention_heads",description:`<strong>num_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"num_attention_heads"},{anchor:"transformers.TapasConfig.intermediate_size",description:`<strong>intermediate_size</strong> (<code>int</code>, <em>optional</em>, defaults to 3072) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in the Transformer encoder.`,name:"intermediate_size"},{anchor:"transformers.TapasConfig.hidden_act",description:`<strong>hidden_act</strong> (<code>str</code> or <code>Callable</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;swish&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"hidden_act"},{anchor:"transformers.TapasConfig.hidden_dropout_prob",description:`<strong>hidden_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"hidden_dropout_prob"},{anchor:"transformers.TapasConfig.attention_probs_dropout_prob",description:`<strong>attention_probs_dropout_prob</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_probs_dropout_prob"},{anchor:"transformers.TapasConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.TapasConfig.type_vocab_sizes",description:`<strong>type_vocab_sizes</strong> (<code>List[int]</code>, <em>optional</em>, defaults to <code>[3, 256, 256, 2, 256, 256, 10]</code>) &#x2014;
The vocabulary sizes of the <code>token_type_ids</code> passed when calling <a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasModel">TapasModel</a>.`,name:"type_vocab_sizes"},{anchor:"transformers.TapasConfig.initializer_range",description:`<strong>initializer_range</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"initializer_range"},{anchor:"transformers.TapasConfig.layer_norm_eps",description:`<strong>layer_norm_eps</strong> (<code>float</code>, <em>optional</em>, defaults to 1e-12) &#x2014;
The epsilon used by the layer normalization layers.`,name:"layer_norm_eps"},{anchor:"transformers.TapasConfig.positive_label_weight",description:`<strong>positive_label_weight</strong> (<code>float</code>, <em>optional</em>, defaults to 10.0) &#x2014;
Weight for positive labels.`,name:"positive_label_weight"},{anchor:"transformers.TapasConfig.num_aggregation_labels",description:`<strong>num_aggregation_labels</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The number of aggregation operators to predict.`,name:"num_aggregation_labels"},{anchor:"transformers.TapasConfig.aggregation_loss_weight",description:`<strong>aggregation_loss_weight</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Importance weight for the aggregation loss.`,name:"aggregation_loss_weight"},{anchor:"transformers.TapasConfig.use_answer_as_supervision",description:`<strong>use_answer_as_supervision</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether to use the answer as the only supervision for aggregation examples.`,name:"use_answer_as_supervision"},{anchor:"transformers.TapasConfig.answer_loss_importance",description:`<strong>answer_loss_importance</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Importance weight for the regression loss.`,name:"answer_loss_importance"},{anchor:"transformers.TapasConfig.use_normalized_answer_loss",description:`<strong>use_normalized_answer_loss</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to normalize the answer loss by the maximum of the predicted and expected value.`,name:"use_normalized_answer_loss"},{anchor:"transformers.TapasConfig.huber_loss_delta",description:`<strong>huber_loss_delta</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Delta parameter used to calculate the regression loss.`,name:"huber_loss_delta"},{anchor:"transformers.TapasConfig.temperature",description:`<strong>temperature</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Value used to control (OR change) the skewness of cell logits probabilities.`,name:"temperature"},{anchor:"transformers.TapasConfig.aggregation_temperature",description:`<strong>aggregation_temperature</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Scales aggregation logits to control the skewness of probabilities.`,name:"aggregation_temperature"},{anchor:"transformers.TapasConfig.use_gumbel_for_cells",description:`<strong>use_gumbel_for_cells</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to apply Gumbel-Softmax to cell selection.`,name:"use_gumbel_for_cells"},{anchor:"transformers.TapasConfig.use_gumbel_for_aggregation",description:`<strong>use_gumbel_for_aggregation</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to apply Gumbel-Softmax to aggregation selection.`,name:"use_gumbel_for_aggregation"},{anchor:"transformers.TapasConfig.average_approximation_function",description:`<strong>average_approximation_function</strong> (<code>string</code>, <em>optional</em>, defaults to <code>&quot;ratio&quot;</code>) &#x2014;
Method to calculate the expected average of cells in the weak supervision case. One of <code>&quot;ratio&quot;</code>,
<code>&quot;first_order&quot;</code> or <code>&quot;second_order&quot;</code>.`,name:"average_approximation_function"},{anchor:"transformers.TapasConfig.cell_selection_preference",description:`<strong>cell_selection_preference</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Preference for cell selection in ambiguous cases. Only applicable in case of weak supervision for
aggregation (WTQ, WikiSQL). If the total mass of the aggregation probabilities (excluding the &#x201C;NONE&#x201D;
operator) is higher than this hyperparameter, then aggregation is predicted for an example.`,name:"cell_selection_preference"},{anchor:"transformers.TapasConfig.answer_loss_cutoff",description:`<strong>answer_loss_cutoff</strong> (<code>float</code>, <em>optional</em>) &#x2014;
Ignore examples with answer loss larger than cutoff.`,name:"answer_loss_cutoff"},{anchor:"transformers.TapasConfig.max_num_rows",description:`<strong>max_num_rows</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Maximum number of rows.`,name:"max_num_rows"},{anchor:"transformers.TapasConfig.max_num_columns",description:`<strong>max_num_columns</strong> (<code>int</code>, <em>optional</em>, defaults to 32) &#x2014;
Maximum number of columns.`,name:"max_num_columns"},{anchor:"transformers.TapasConfig.average_logits_per_cell",description:`<strong>average_logits_per_cell</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to average logits per cell.`,name:"average_logits_per_cell"},{anchor:"transformers.TapasConfig.select_one_column",description:`<strong>select_one_column</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to constrain the model to only select cells from a single column.`,name:"select_one_column"},{anchor:"transformers.TapasConfig.allow_empty_column_selection",description:`<strong>allow_empty_column_selection</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to allow not to select any column.`,name:"allow_empty_column_selection"},{anchor:"transformers.TapasConfig.init_cell_selection_weights_to_zero",description:`<strong>init_cell_selection_weights_to_zero</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to initialize cell selection weights to 0 so that the initial probabilities are 50%.`,name:"init_cell_selection_weights_to_zero"},{anchor:"transformers.TapasConfig.reset_position_index_per_cell",description:`<strong>reset_position_index_per_cell</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to restart position indexes at every cell (i.e. use relative position embeddings).`,name:"reset_position_index_per_cell"},{anchor:"transformers.TapasConfig.disable_per_token_loss",description:`<strong>disable_per_token_loss</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to disable any (strong or weak) supervision on cells.`,name:"disable_per_token_loss"},{anchor:"transformers.TapasConfig.aggregation_labels",description:`<strong>aggregation_labels</strong> (<code>Dict[int, label]</code>, <em>optional</em>) &#x2014;
The aggregation labels used to aggregate the results. For example, the WTQ models have the following
aggregation labels: <code>{0: &quot;NONE&quot;, 1: &quot;SUM&quot;, 2: &quot;AVERAGE&quot;, 3: &quot;COUNT&quot;}</code>`,name:"aggregation_labels"},{anchor:"transformers.TapasConfig.no_aggregation_label_index",description:`<strong>no_aggregation_label_index</strong> (<code>int</code>, <em>optional</em>) &#x2014;
If the aggregation labels are defined and one of these labels represents &#x201C;No aggregation&#x201D;, this should be
set to its index. For example, the WTQ models have the &#x201C;NONE&#x201D; aggregation label at index 0, so that value
should be set to 0 for these models.`,name:"no_aggregation_label_index"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/configuration_tapas.py#L45"}}),Fo=new yo({props:{anchor:"transformers.TapasConfig.example",$$slots:{default:[rj]},$$scope:{ctx:A}}}),Qn=new Zt({}),Rn=new rt({props:{name:"class transformers.TapasTokenizer",anchor:"transformers.TapasTokenizer",parameters:[{name:"vocab_file",val:""},{name:"do_lower_case",val:" = True"},{name:"do_basic_tokenize",val:" = True"},{name:"never_split",val:" = None"},{name:"unk_token",val:" = '[UNK]'"},{name:"sep_token",val:" = '[SEP]'"},{name:"pad_token",val:" = '[PAD]'"},{name:"cls_token",val:" = '[CLS]'"},{name:"mask_token",val:" = '[MASK]'"},{name:"empty_token",val:" = '[EMPTY]'"},{name:"tokenize_chinese_chars",val:" = True"},{name:"strip_accents",val:" = None"},{name:"cell_trim_length",val:": int = -1"},{name:"max_column_id",val:": int = None"},{name:"max_row_id",val:": int = None"},{name:"strip_column_names",val:": bool = False"},{name:"update_answer_coordinates",val:": bool = False"},{name:"min_question_length",val:" = None"},{name:"max_question_length",val:" = None"},{name:"model_max_length",val:": int = 512"},{name:"additional_special_tokens",val:": typing.Optional[typing.List[str]] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TapasTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
File containing the vocabulary.`,name:"vocab_file"},{anchor:"transformers.TapasTokenizer.do_lower_case",description:`<strong>do_lower_case</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to lowercase the input when tokenizing.`,name:"do_lower_case"},{anchor:"transformers.TapasTokenizer.do_basic_tokenize",description:`<strong>do_basic_tokenize</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to do basic tokenization before WordPiece.`,name:"do_basic_tokenize"},{anchor:"transformers.TapasTokenizer.never_split",description:`<strong>never_split</strong> (<code>Iterable</code>, <em>optional</em>) &#x2014;
Collection of tokens which will never be split during tokenization. Only has an effect when
<code>do_basic_tokenize=True</code>`,name:"never_split"},{anchor:"transformers.TapasTokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[UNK]&quot;</code>) &#x2014;
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.TapasTokenizer.sep_token",description:`<strong>sep_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[SEP]&quot;</code>) &#x2014;
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.TapasTokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[PAD]&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.TapasTokenizer.cls_token",description:`<strong>cls_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[CLS]&quot;</code>) &#x2014;
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.TapasTokenizer.mask_token",description:`<strong>mask_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[MASK]&quot;</code>) &#x2014;
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.TapasTokenizer.empty_token",description:`<strong>empty_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;[EMPTY]&quot;</code>) &#x2014;
The token used for empty cell values in a table. Empty cell values include &quot;&quot;, &#x201C;n/a&#x201D;, &#x201C;nan&#x201D; and &#x201D;?&#x201C;.`,name:"empty_token"},{anchor:"transformers.TapasTokenizer.tokenize_chinese_chars",description:`<strong>tokenize_chinese_chars</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to tokenize Chinese characters. This should likely be deactivated for Japanese (see this
<a href="https://github.com/huggingface/transformers/issues/328" rel="nofollow">issue</a>).`,name:"tokenize_chinese_chars"},{anchor:"transformers.TapasTokenizer.strip_accents",description:`<strong>strip_accents</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to strip all accents. If this option is not specified, then it will be determined by the
value for <code>lowercase</code> (as in the original BERT).`,name:"strip_accents"},{anchor:"transformers.TapasTokenizer.cell_trim_length",description:`<strong>cell_trim_length</strong> (<code>int</code>, <em>optional</em>, defaults to -1) &#x2014;
If &gt; 0: Trim cells so that the length is &lt;= this value. Also disables further cell trimming, should thus be
used with <code>truncation</code> set to <code>True</code>.`,name:"cell_trim_length"},{anchor:"transformers.TapasTokenizer.max_column_id",description:`<strong>max_column_id</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Max column id to extract.`,name:"max_column_id"},{anchor:"transformers.TapasTokenizer.max_row_id",description:`<strong>max_row_id</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Max row id to extract.`,name:"max_row_id"},{anchor:"transformers.TapasTokenizer.strip_column_names",description:`<strong>strip_column_names</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to add empty strings instead of column names.`,name:"strip_column_names"},{anchor:"transformers.TapasTokenizer.update_answer_coordinates",description:`<strong>update_answer_coordinates</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to recompute the answer coordinates from the answer text.`,name:"update_answer_coordinates"},{anchor:"transformers.TapasTokenizer.min_question_length",description:`<strong>min_question_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Minimum length of each question in terms of tokens (will be skipped otherwise).`,name:"min_question_length"},{anchor:"transformers.TapasTokenizer.max_question_length",description:`<strong>max_question_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Maximum length of each question in terms of tokens (will be skipped otherwise).`,name:"max_question_length"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/tokenization_tapas.py#L236"}}),Sn=new rt({props:{name:"__call__",anchor:"transformers.TapasTokenizer.__call__",parameters:[{name:"table",val:": pd.DataFrame"},{name:"queries",val:": typing.Union[str, typing.List[str], typing.List[int], typing.List[typing.List[str]], typing.List[typing.List[int]], NoneType] = None"},{name:"answer_coordinates",val:": typing.Union[typing.List[typing.Tuple], typing.List[typing.List[typing.Tuple]], NoneType] = None"},{name:"answer_text",val:": typing.Union[typing.List[str], typing.List[typing.List[str]], NoneType] = None"},{name:"add_special_tokens",val:": bool = True"},{name:"padding",val:": typing.Union[bool, str, transformers.utils.generic.PaddingStrategy] = False"},{name:"truncation",val:": typing.Union[bool, str, transformers.models.tapas.tokenization_tapas.TapasTruncationStrategy] = False"},{name:"max_length",val:": typing.Optional[int] = None"},{name:"pad_to_multiple_of",val:": typing.Optional[int] = None"},{name:"return_tensors",val:": typing.Union[str, transformers.utils.generic.TensorType, NoneType] = None"},{name:"return_token_type_ids",val:": typing.Optional[bool] = None"},{name:"return_attention_mask",val:": typing.Optional[bool] = None"},{name:"return_overflowing_tokens",val:": bool = False"},{name:"return_special_tokens_mask",val:": bool = False"},{name:"return_offsets_mapping",val:": bool = False"},{name:"return_length",val:": bool = False"},{name:"verbose",val:": bool = True"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TapasTokenizer.__call__.table",description:`<strong>table</strong> (<code>pd.DataFrame</code>) &#x2014;
Table containing tabular data. Note that all cell values must be text. Use <em>.astype(str)</em> on a Pandas
dataframe to convert it to string.`,name:"table"},{anchor:"transformers.TapasTokenizer.__call__.queries",description:`<strong>queries</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
Question or batch of questions related to a table to be encoded. Note that in case of a batch, all
questions must refer to the <strong>same</strong> table.`,name:"queries"},{anchor:"transformers.TapasTokenizer.__call__.answer_coordinates",description:`<strong>answer_coordinates</strong> (<code>List[Tuple]</code> or <code>List[List[Tuple]]</code>, <em>optional</em>) &#x2014;
Answer coordinates of each table-question pair in the batch. In case only a single table-question pair
is provided, then the answer_coordinates must be a single list of one or more tuples. Each tuple must
be a (row_index, column_index) pair. The first data row (not the column header row) has index 0. The
first column has index 0. In case a batch of table-question pairs is provided, then the
answer_coordinates must be a list of lists of tuples (each list corresponding to a single
table-question pair).`,name:"answer_coordinates"},{anchor:"transformers.TapasTokenizer.__call__.answer_text",description:`<strong>answer_text</strong> (<code>List[str]</code> or <code>List[List[str]]</code>, <em>optional</em>) &#x2014;
Answer text of each table-question pair in the batch. In case only a single table-question pair is
provided, then the answer_text must be a single list of one or more strings. Each string must be the
answer text of a corresponding answer coordinate. In case a batch of table-question pairs is provided,
then the answer_coordinates must be a list of lists of strings (each list corresponding to a single
table-question pair).`,name:"answer_text"},{anchor:"transformers.TapasTokenizer.__call__.add_special_tokens",description:`<strong>add_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to encode the sequences with the special tokens relative to their model.`,name:"add_special_tokens"},{anchor:"transformers.TapasTokenizer.__call__.padding",description:`<strong>padding</strong> (<code>bool</code>, <code>str</code> or <a href="/docs/transformers/v4.30.0/en/internal/file_utils#transformers.utils.PaddingStrategy">PaddingStrategy</a>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Activates and controls padding. Accepts the following values:</p>
<ul>
<li><code>True</code> or <code>&apos;longest&apos;</code>: Pad to the longest sequence in the batch (or no padding if only a single
sequence if provided).</li>
<li><code>&apos;max_length&apos;</code>: Pad to a maximum length specified with the argument <code>max_length</code> or to the maximum
acceptable input length for the model if that argument is not provided.</li>
<li><code>False</code> or <code>&apos;do_not_pad&apos;</code> (default): No padding (i.e., can output a batch with sequences of different
lengths).</li>
</ul>`,name:"padding"},{anchor:"transformers.TapasTokenizer.__call__.truncation",description:`<strong>truncation</strong> (<code>bool</code>, <code>str</code> or <code>TapasTruncationStrategy</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Activates and controls truncation. Accepts the following values:</p>
<ul>
<li><code>True</code> or <code>&apos;drop_rows_to_fit&apos;</code>: Truncate to a maximum length specified with the argument <code>max_length</code>
or to the maximum acceptable input length for the model if that argument is not provided. This will
truncate row by row, removing rows from the table.</li>
<li><code>False</code> or <code>&apos;do_not_truncate&apos;</code> (default): No truncation (i.e., can output batch with sequence lengths
greater than the model maximum admissible input size).</li>
</ul>`,name:"truncation"},{anchor:"transformers.TapasTokenizer.__call__.max_length",description:`<strong>max_length</strong> (<code>int</code>, <em>optional</em>) &#x2014;
Controls the maximum length to use by one of the truncation/padding parameters.</p>
<p>If left unset or set to <code>None</code>, this will use the predefined model maximum length if a maximum length
is required by one of the truncation/padding parameters. If the model has no specific maximum input
length (like XLNet) truncation/padding to a maximum length will be deactivated.`,name:"max_length"},{anchor:"transformers.TapasTokenizer.__call__.is_split_into_words",description:`<strong>is_split_into_words</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the input is already pre-tokenized (e.g., split into words). If set to <code>True</code>, the
tokenizer assumes the input is already split into words (for instance, by splitting it on whitespace)
which it will tokenize. This is useful for NER or token classification.`,name:"is_split_into_words"},{anchor:"transformers.TapasTokenizer.__call__.pad_to_multiple_of",description:`<strong>pad_to_multiple_of</strong> (<code>int</code>, <em>optional</em>) &#x2014;
If set will pad the sequence to a multiple of the provided value. This is especially useful to enable
the use of Tensor Cores on NVIDIA hardware with compute capability <code>&gt;= 7.5</code> (Volta).`,name:"pad_to_multiple_of"},{anchor:"transformers.TapasTokenizer.__call__.return_tensors",description:`<strong>return_tensors</strong> (<code>str</code> or <a href="/docs/transformers/v4.30.0/en/internal/file_utils#transformers.TensorType">TensorType</a>, <em>optional</em>) &#x2014;
If set, will return tensors instead of list of python integers. Acceptable values are:</p>
<ul>
<li><code>&apos;tf&apos;</code>: Return TensorFlow <code>tf.constant</code> objects.</li>
<li><code>&apos;pt&apos;</code>: Return PyTorch <code>torch.Tensor</code> objects.</li>
<li><code>&apos;np&apos;</code>: Return Numpy <code>np.ndarray</code> objects.</li>
</ul>`,name:"return_tensors"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/tokenization_tapas.py#L575"}}),xn=new rt({props:{name:"convert_logits_to_predictions",anchor:"transformers.TapasTokenizer.convert_logits_to_predictions",parameters:[{name:"data",val:""},{name:"logits",val:""},{name:"logits_agg",val:" = None"},{name:"cell_classification_threshold",val:" = 0.5"}],parametersDescription:[{anchor:"transformers.TapasTokenizer.convert_logits_to_predictions.data",description:`<strong>data</strong> (<code>dict</code>) &#x2014;
Dictionary mapping features to actual values. Should be created using <a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasTokenizer">TapasTokenizer</a>.`,name:"data"},{anchor:"transformers.TapasTokenizer.convert_logits_to_predictions.logits",description:`<strong>logits</strong> (<code>torch.Tensor</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Tensor containing the logits at the token level.`,name:"logits"},{anchor:"transformers.TapasTokenizer.convert_logits_to_predictions.logits_agg",description:`<strong>logits_agg</strong> (<code>torch.Tensor</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_aggregation_labels)</code>, <em>optional</em>) &#x2014;
Tensor containing the aggregation logits.`,name:"logits_agg"},{anchor:"transformers.TapasTokenizer.convert_logits_to_predictions.cell_classification_threshold",description:`<strong>cell_classification_threshold</strong> (<code>float</code>, <em>optional</em>, defaults to 0.5) &#x2014;
Threshold to be used for cell selection. All table cells for which their probability is larger than
this threshold will be selected.`,name:"cell_classification_threshold"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/tokenization_tapas.py#L1938",returnDescription:`
<ul>
<li>predicted_answer_coordinates (<code>List[List[[tuple]]</code> of length <code>batch_size</code>): Predicted answer coordinates
as a list of lists of tuples. Each element in the list contains the predicted answer coordinates of a
single example in the batch, as a list of tuples. Each tuple is a cell, i.e. (row index, column index).</li>
<li>predicted_aggregation_indices (<code>List[int]</code>of length <code>batch_size</code>, <em>optional</em>, returned when
<code>logits_aggregation</code> is provided): Predicted aggregation operator indices of the aggregation head.</li>
</ul>
`,returnType:`
<p><code>tuple</code> comprising various elements depending on the inputs</p>
`}}),Dn=new rt({props:{name:"save_vocabulary",anchor:"transformers.TapasTokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": typing.Optional[str] = None"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/tokenization_tapas.py#L443"}}),Hn=new Zt({}),Pn=new rt({props:{name:"class transformers.TapasModel",anchor:"transformers.TapasModel",parameters:[{name:"config",val:""},{name:"add_pooling_layer",val:" = True"}],parametersDescription:[{anchor:"transformers.TapasModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig">TapasConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/modeling_tapas.py#L841"}}),al=new rt({props:{name:"forward",anchor:"transformers.TapasModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.TapasModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TapasModel.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TapasModel.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length, 7)</code>, <em>optional</em>) &#x2014;
Token indices that encode tabular structure. Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See this
class for more info.</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TapasModel.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. If
<code>reset_position_index_per_cell</code> of <a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig">TapasConfig</a> is set to <code>True</code>, relative position embeddings will be
used. 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.TapasModel.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>: - 1
indicates the head is <strong>not masked</strong>, - 0 indicates the head is <strong>masked</strong>.`,name:"head_mask"},{anchor:"transformers.TapasModel.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TapasModel.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TapasModel.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TapasModel.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/modeling_tapas.py#L878",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig"
>TapasConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) after further processing
through the layers used for the auxiliary pretraining task. E.g. for BERT-family of models, this returns
the classification token after processing through a linear layer and a tanh activation function. The linear
layer weights are trained from the next sentence prediction (classification) objective during pretraining.</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),zo=new Qs({props:{$$slots:{default:[ij]},$$scope:{ctx:A}}}),qo=new yo({props:{anchor:"transformers.TapasModel.forward.example",$$slots:{default:[dj]},$$scope:{ctx:A}}}),ol=new Zt({}),nl=new rt({props:{name:"class transformers.TapasForMaskedLM",anchor:"transformers.TapasForMaskedLM",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.TapasForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig">TapasConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/modeling_tapas.py#L993"}}),il=new rt({props:{name:"forward",anchor:"transformers.TapasForMaskedLM.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_hidden_states",val:": typing.Optional[torch.FloatTensor] = None"},{name:"encoder_attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TapasForMaskedLM.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TapasForMaskedLM.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TapasForMaskedLM.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length, 7)</code>, <em>optional</em>) &#x2014;
Token indices that encode tabular structure. Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See this
class for more info.</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TapasForMaskedLM.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. If
<code>reset_position_index_per_cell</code> of <a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig">TapasConfig</a> is set to <code>True</code>, relative position embeddings will be
used. 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.TapasForMaskedLM.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>: - 1
indicates the head is <strong>not masked</strong>, - 0 indicates the head is <strong>masked</strong>.`,name:"head_mask"},{anchor:"transformers.TapasForMaskedLM.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TapasForMaskedLM.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TapasForMaskedLM.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TapasForMaskedLM.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.TapasForMaskedLM.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are ignored (masked), the
loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/modeling_tapas.py#L1013",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig"
>TapasConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Masked language modeling (MLM) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Go=new Qs({props:{$$slots:{default:[cj]},$$scope:{ctx:A}}}),No=new yo({props:{anchor:"transformers.TapasForMaskedLM.forward.example",$$slots:{default:[pj]},$$scope:{ctx:A}}}),dl=new Zt({}),cl=new rt({props:{name:"class transformers.TapasForSequenceClassification",anchor:"transformers.TapasForSequenceClassification",parameters:[{name:"config",val:""}],parametersDescription:[{anchor:"transformers.TapasForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig">TapasConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/modeling_tapas.py#L1454"}}),ml=new rt({props:{name:"forward",anchor:"transformers.TapasForSequenceClassification.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.TapasForSequenceClassification.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TapasForSequenceClassification.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TapasForSequenceClassification.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length, 7)</code>, <em>optional</em>) &#x2014;
Token indices that encode tabular structure. Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See this
class for more info.</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TapasForSequenceClassification.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. If
<code>reset_position_index_per_cell</code> of <a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig">TapasConfig</a> is set to <code>True</code>, relative position embeddings will be
used. 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.TapasForSequenceClassification.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>: - 1
indicates the head is <strong>not masked</strong>, - 0 indicates the head is <strong>masked</strong>.`,name:"head_mask"},{anchor:"transformers.TapasForSequenceClassification.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TapasForSequenceClassification.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TapasForSequenceClassification.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TapasForSequenceClassification.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.TapasForSequenceClassification.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy). Note: this is called
&#x201C;classification_class_index&#x201D; in the original implementation.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/modeling_tapas.py#L1466",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig"
>TapasConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Classification (or regression if config.num_labels==1) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, config.num_labels)</code>) \u2014 Classification (or regression if config.num_labels==1) scores (before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
heads.</p>
</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ro=new Qs({props:{$$slots:{default:[hj]},$$scope:{ctx:A}}}),So=new yo({props:{anchor:"transformers.TapasForSequenceClassification.forward.example",$$slots:{default:[uj]},$$scope:{ctx:A}}}),fl=new Zt({}),gl=new rt({props:{name:"class transformers.TapasForQuestionAnswering",anchor:"transformers.TapasForQuestionAnswering",parameters:[{name:"config",val:": TapasConfig"}],parametersDescription:[{anchor:"transformers.TapasForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig">TapasConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/modeling_tapas.py#L1109"}}),_l=new rt({props:{name:"forward",anchor:"transformers.TapasForQuestionAnswering.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"token_type_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"position_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.FloatTensor] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"table_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"aggregation_labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"float_answer",val:": typing.Optional[torch.FloatTensor] = None"},{name:"numeric_values",val:": typing.Optional[torch.FloatTensor] = None"},{name:"numeric_values_scale",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.TapasForQuestionAnswering.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/v4.30.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.TapasForQuestionAnswering.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TapasForQuestionAnswering.forward.token_type_ids",description:`<strong>token_type_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length, 7)</code>, <em>optional</em>) &#x2014;
Token indices that encode tabular structure. Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See this
class for more info.</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TapasForQuestionAnswering.forward.position_ids",description:`<strong>position_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. If
<code>reset_position_index_per_cell</code> of <a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig">TapasConfig</a> is set to <code>True</code>, relative position embeddings will be
used. 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.TapasForQuestionAnswering.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.FloatTensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>: - 1
indicates the head is <strong>not masked</strong>, - 0 indicates the head is <strong>masked</strong>.`,name:"head_mask"},{anchor:"transformers.TapasForQuestionAnswering.forward.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TapasForQuestionAnswering.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.TapasForQuestionAnswering.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.TapasForQuestionAnswering.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.TapasForQuestionAnswering.forward.table_mask",description:`<strong>table_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, seq_length)</code>, <em>optional</em>) &#x2014;
Mask for the table. Indicates which tokens belong to the table (1). Question tokens, table headers and
padding are 0.`,name:"table_mask"},{anchor:"transformers.TapasForQuestionAnswering.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, seq_length)</code>, <em>optional</em>) &#x2014;
Labels per token for computing the hierarchical cell selection loss. This encodes the positions of the
answer appearing in the table. Can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>.</p>
<ul>
<li>1 for tokens that are <strong>part of the answer</strong>,</li>
<li>0 for tokens that are <strong>not part of the answer</strong>.</li>
</ul>`,name:"labels"},{anchor:"transformers.TapasForQuestionAnswering.forward.aggregation_labels",description:`<strong>aggregation_labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, )</code>, <em>optional</em>) &#x2014;
Aggregation function index for every example in the batch for computing the aggregation loss. Indices
should be in <code>[0, ..., config.num_aggregation_labels - 1]</code>. Only required in case of strong supervision for
aggregation (WikiSQL-supervised).`,name:"aggregation_labels"},{anchor:"transformers.TapasForQuestionAnswering.forward.float_answer",description:`<strong>float_answer</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, )</code>, <em>optional</em>) &#x2014;
Float answer for every example in the batch. Set to <em>float(&#x2018;nan&#x2019;)</em> for cell selection questions. Only
required in case of weak supervision (WTQ) to calculate the aggregate mask and regression loss.`,name:"float_answer"},{anchor:"transformers.TapasForQuestionAnswering.forward.numeric_values",description:`<strong>numeric_values</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, seq_length)</code>, <em>optional</em>) &#x2014;
Numeric values of every token, NaN for tokens which are not numeric values. Can be obtained using
<a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. Only required in case of weak supervision for aggregation (WTQ) to calculate the
regression loss.`,name:"numeric_values"},{anchor:"transformers.TapasForQuestionAnswering.forward.numeric_values_scale",description:`<strong>numeric_values_scale</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, seq_length)</code>, <em>optional</em>) &#x2014;
Scale of the numeric values of every token. Can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. Only required in case
of weak supervision for aggregation (WTQ) to calculate the regression loss.`,name:"numeric_values_scale"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/modeling_tapas.py#L1144",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.models.tapas.modeling_tapas.TableQuestionAnsweringOutput"
>transformers.models.tapas.modeling_tapas.TableQuestionAnsweringOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig"
>TapasConfig</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> (and possibly <code>answer</code>, <code>aggregation_labels</code>, <code>numeric_values</code> and <code>numeric_values_scale</code> are provided)) \u2014 Total loss as the sum of the hierarchical cell selection log-likelihood loss and (optionally) the
semi-supervised regression loss and (optionally) supervised loss for aggregations.</li>
<li><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Prediction scores of the cell selection head, for every token.</li>
<li><strong>logits_aggregation</strong> (<code>torch.FloatTensor</code>, <em>optional</em>, of shape <code>(batch_size, num_aggregation_labels)</code>) \u2014 Prediction scores of the aggregation head, for every aggregation operator.</li>
<li><strong>hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings + one for the output of each layer) of
shape <code>(batch_size, sequence_length, hidden_size)</code>. Hidden-states of the model at the output of each layer
plus the initial embedding outputs.</li>
<li><strong>attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights after the attention softmax, used to compute the weighted average in
the self-attention heads.</li>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.models.tapas.modeling_tapas.TableQuestionAnsweringOutput"
>transformers.models.tapas.modeling_tapas.TableQuestionAnsweringOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Vo=new Qs({props:{$$slots:{default:[mj]},$$scope:{ctx:A}}}),Xo=new yo({props:{anchor:"transformers.TapasForQuestionAnswering.forward.example",$$slots:{default:[fj]},$$scope:{ctx:A}}}),wl=new Zt({}),bl=new rt({props:{name:"class transformers.TFTapasModel",anchor:"transformers.TFTapasModel",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFTapasModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig">TapasConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/modeling_tf_tapas.py#L974"}}),Do=new Qs({props:{$$slots:{default:[gj]},$$scope:{ctx:A}}}),Ul=new rt({props:{name:"call",anchor:"transformers.TFTapasModel.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",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:"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:"training",val:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFTapasModel.call.input_ids",description:`<strong>input_ids</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.30.0/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.TFTapasModel.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFTapasModel.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 7)</code>, <em>optional</em>) &#x2014;
Token indices that encode tabular structure. Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See this
class for more info.</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFTapasModel.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. If
<code>reset_position_index_per_cell</code> of <a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig">TapasConfig</a> is set to <code>True</code>, relative position embeddings will be
used. 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.TFTapasModel.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFTapasModel.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFTapasModel.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. 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.TFTapasModel.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. 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.TFTapasModel.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFTapasModel.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
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/v4.30.0/src/transformers/models/tapas/modeling_tf_tapas.py#L980",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</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/v4.30.0/en/model_doc/tapas#transformers.TapasConfig"
>TapasConfig</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>) \u2014 Sequence of hidden-states at the output of the last layer of the model.</p>
</li>
<li>
<p><strong>pooler_output</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, hidden_size)</code>) \u2014 Last layer hidden-state of the first token of the sequence (classification token) further processed by a
Linear layer and a Tanh activation function. The Linear layer weights are trained from the next sentence
prediction (classification) objective during pretraining.</p>
<p>This output is usually <em>not</em> a good summary of the semantic content of the input, you\u2019re often better with
averaging or pooling the sequence of hidden-states for the whole input sequence.</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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Ho=new Qs({props:{$$slots:{default:[Tj]},$$scope:{ctx:A}}}),Po=new yo({props:{anchor:"transformers.TFTapasModel.call.example",$$slots:{default:[Mj]},$$scope:{ctx:A}}}),kl=new Zt({}),Il=new rt({props:{name:"class transformers.TFTapasForMaskedLM",anchor:"transformers.TFTapasForMaskedLM",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFTapasForMaskedLM.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig">TapasConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/modeling_tf_tapas.py#L1038"}}),Lo=new Qs({props:{$$slots:{default:[yj]},$$scope:{ctx:A}}}),Zl=new rt({props:{name:"call",anchor:"transformers.TFTapasForMaskedLM.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",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:"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:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFTapasForMaskedLM.call.input_ids",description:`<strong>input_ids</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.30.0/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.TFTapasForMaskedLM.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFTapasForMaskedLM.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 7)</code>, <em>optional</em>) &#x2014;
Token indices that encode tabular structure. Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See this
class for more info.</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFTapasForMaskedLM.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. If
<code>reset_position_index_per_cell</code> of <a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig">TapasConfig</a> is set to <code>True</code>, relative position embeddings will be
used. 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.TFTapasForMaskedLM.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFTapasForMaskedLM.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFTapasForMaskedLM.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. 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.TFTapasForMaskedLM.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. 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.TFTapasForMaskedLM.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFTapasForMaskedLM.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
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.TFTapasForMaskedLM.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> or <code>np.ndarray</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should be in <code>[-100, 0, ..., config.vocab_size]</code> (see <code>input_ids</code> docstring) Tokens with indices set to <code>-100</code> are ignored (masked), the
loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/modeling_tf_tapas.py#L1054",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_tf_outputs.TFMaskedLMOutput"
>transformers.modeling_tf_outputs.TFMaskedLMOutput</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/v4.30.0/en/model_doc/tapas#transformers.TapasConfig"
>TapasConfig</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 non-masked labels, returned when <code>labels</code> is provided) \u2014 Masked language modeling (MLM) loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>hidden_states</strong> (<code>tuple(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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_tf_outputs.TFMaskedLMOutput"
>transformers.modeling_tf_outputs.TFMaskedLMOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Ko=new Qs({props:{$$slots:{default:[_j]},$$scope:{ctx:A}}}),en=new yo({props:{anchor:"transformers.TFTapasForMaskedLM.call.example",$$slots:{default:[wj]},$$scope:{ctx:A}}}),Bl=new Zt({}),Wl=new rt({props:{name:"class transformers.TFTapasForSequenceClassification",anchor:"transformers.TFTapasForSequenceClassification",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFTapasForSequenceClassification.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig">TapasConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/modeling_tf_tapas.py#L1563"}}),sn=new Qs({props:{$$slots:{default:[bj]},$$scope:{ctx:A}}}),Gl=new rt({props:{name:"call",anchor:"transformers.TFTapasForSequenceClassification.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",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:"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:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFTapasForSequenceClassification.call.input_ids",description:`<strong>input_ids</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, num_choices, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.30.0/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.TFTapasForSequenceClassification.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFTapasForSequenceClassification.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length, 7)</code>, <em>optional</em>) &#x2014;
Token indices that encode tabular structure. Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See this
class for more info.</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFTapasForSequenceClassification.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. If
<code>reset_position_index_per_cell</code> of <a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig">TapasConfig</a> is set to <code>True</code>, relative position embeddings will be
used. 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.TFTapasForSequenceClassification.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFTapasForSequenceClassification.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, num_choices, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFTapasForSequenceClassification.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. 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.TFTapasForSequenceClassification.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. 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.TFTapasForSequenceClassification.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFTapasForSequenceClassification.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
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.TFTapasForSequenceClassification.call.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size,)</code>, <em>optional</em>) &#x2014;
Labels for computing the sequence classification/regression loss. Indices should be in <code>[0, ..., config.num_labels - 1]</code>. If <code>config.num_labels == 1</code> a regression loss is computed (Mean-Square loss), If
<code>config.num_labels &gt; 1</code> a classification loss is computed (Cross-Entropy). Note: this is called
&#x201C;classification_class_index&#x201D; in the original implementation.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/modeling_tf_tapas.py#L1574",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.30.0/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/v4.30.0/en/model_doc/tapas#transformers.TapasConfig"
>TapasConfig</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) \u2014 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>) \u2014 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>) \u2014 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>) \u2014 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:`
<p><a
  href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.modeling_tf_outputs.TFSequenceClassifierOutput"
>transformers.modeling_tf_outputs.TFSequenceClassifierOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),an=new Qs({props:{$$slots:{default:[jj]},$$scope:{ctx:A}}}),on=new yo({props:{anchor:"transformers.TFTapasForSequenceClassification.call.example",$$slots:{default:[vj]},$$scope:{ctx:A}}}),Nl=new Zt({}),Ql=new rt({props:{name:"class transformers.TFTapasForQuestionAnswering",anchor:"transformers.TFTapasForQuestionAnswering",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.TFTapasForQuestionAnswering.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig">TapasConfig</a>) &#x2014; Model configuration class with all the parameters of the model.
Initializing with a config file does not load the weights associated with the model, only the
configuration. Check out the <a href="/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/modeling_tf_tapas.py#L1238"}}),ln=new Qs({props:{$$slots:{default:[Jj]},$$scope:{ctx:A}}}),Vl=new rt({props:{name:"call",anchor:"transformers.TFTapasForQuestionAnswering.call",parameters:[{name:"input_ids",val:": TFModelInputType | None = None"},{name:"attention_mask",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:"head_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"inputs_embeds",val:": np.ndarray | tf.Tensor | None = None"},{name:"table_mask",val:": np.ndarray | tf.Tensor | None = None"},{name:"aggregation_labels",val:": np.ndarray | tf.Tensor | None = None"},{name:"float_answer",val:": np.ndarray | tf.Tensor | None = None"},{name:"numeric_values",val:": np.ndarray | tf.Tensor | None = None"},{name:"numeric_values_scale",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:": Optional[bool] = False"}],parametersDescription:[{anchor:"transformers.TFTapasForQuestionAnswering.call.input_ids",description:`<strong>input_ids</strong> (<code>np.ndarray</code>, <code>tf.Tensor</code>, <code>List[tf.Tensor]</code> \`<code>Dict[str, tf.Tensor]</code> or <code>Dict[str, np.ndarray]</code> and each example must have the shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.30.0/en/model_doc/speecht5#transformers.SpeechT5Tokenizer.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.30.0/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.TFTapasForQuestionAnswering.call.attention_mask",description:`<strong>attention_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.TFTapasForQuestionAnswering.call.token_type_ids",description:`<strong>token_type_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, 7)</code>, <em>optional</em>) &#x2014;
Token indices that encode tabular structure. Indices can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See this
class for more info.</p>
<p><a href="../glossary#token-type-ids">What are token type IDs?</a>`,name:"token_type_ids"},{anchor:"transformers.TFTapasForQuestionAnswering.call.position_ids",description:`<strong>position_ids</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of positions of each input sequence tokens in the position embeddings. If
<code>reset_position_index_per_cell</code> of <a href="/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig">TapasConfig</a> is set to <code>True</code>, relative position embeddings will be
used. 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.TFTapasForQuestionAnswering.call.head_mask",description:`<strong>head_mask</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(num_heads,)</code> or <code>(num_layers, num_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the self-attention modules. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.TFTapasForQuestionAnswering.call.inputs_embeds",description:`<strong>inputs_embeds</strong> (<code>np.ndarray</code> or <code>tf.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>input_ids</code> you can choose to directly pass an embedded representation. This
is useful if you want more control over how to convert <code>input_ids</code> indices into associated vectors than the
model&#x2019;s internal embedding lookup matrix.`,name:"inputs_embeds"},{anchor:"transformers.TFTapasForQuestionAnswering.call.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail. 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.TFTapasForQuestionAnswering.call.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail. 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.TFTapasForQuestionAnswering.call.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.30.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple. This argument can be used in
eager mode, in graph mode the value will always be set to True.`,name:"return_dict"},{anchor:"transformers.TFTapasForQuestionAnswering.call.training",description:`<strong>training</strong> (<code>bool</code>, <em>optional</em>, defaults to \`False&#x201C;) &#x2014;
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.TFTapasForQuestionAnswering.call.table_mask",description:`<strong>table_mask</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, seq_length)</code>, <em>optional</em>) &#x2014;
Mask for the table. Indicates which tokens belong to the table (1). Question tokens, table headers and
padding are 0.`,name:"table_mask"},{anchor:"transformers.TFTapasForQuestionAnswering.call.labels",description:`<strong>labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, seq_length)</code>, <em>optional</em>) &#x2014;
Labels per token for computing the hierarchical cell selection loss. This encodes the positions of the
answer appearing in the table. Can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>.</p>
<ul>
<li>1 for tokens that are <strong>part of the answer</strong>,</li>
<li>0 for tokens that are <strong>not part of the answer</strong>.</li>
</ul>`,name:"labels"},{anchor:"transformers.TFTapasForQuestionAnswering.call.aggregation_labels",description:`<strong>aggregation_labels</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, )</code>, <em>optional</em>) &#x2014;
Aggregation function index for every example in the batch for computing the aggregation loss. Indices
should be in <code>[0, ..., config.num_aggregation_labels - 1]</code>. Only required in case of strong supervision for
aggregation (WikiSQL-supervised).`,name:"aggregation_labels"},{anchor:"transformers.TFTapasForQuestionAnswering.call.float_answer",description:`<strong>float_answer</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, )</code>, <em>optional</em>) &#x2014;
Float answer for every example in the batch. Set to <em>float(&#x2018;nan&#x2019;)</em> for cell selection questions. Only
required in case of weak supervision (WTQ) to calculate the aggregate mask and regression loss.`,name:"float_answer"},{anchor:"transformers.TFTapasForQuestionAnswering.call.numeric_values",description:`<strong>numeric_values</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, seq_length)</code>, <em>optional</em>) &#x2014;
Numeric values of every token, NaN for tokens which are not numeric values. Can be obtained using
<a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. Only required in case of weak supervision for aggregation (WTQ) to calculate the
regression loss.`,name:"numeric_values"},{anchor:"transformers.TFTapasForQuestionAnswering.call.numeric_values_scale",description:`<strong>numeric_values_scale</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, seq_length)</code>, <em>optional</em>) &#x2014;
Scale of the numeric values of every token. Can be obtained using <a href="/docs/transformers/v4.30.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. Only required in case
of weak supervision for aggregation (WTQ) to calculate the regression loss.`,name:"numeric_values_scale"}],source:"https://github.com/huggingface/transformers/blob/v4.30.0/src/transformers/models/tapas/modeling_tf_tapas.py#L1260",returnDescription:`
<p>A <code>transformers.models.tapas.modeling_tf_tapas.TFTableQuestionAnsweringOutput</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/v4.30.0/en/model_doc/tapas#transformers.TapasConfig"
>TapasConfig</a>) and inputs.</p>
<ul>
<li><strong>loss</strong> (<code>tf.Tensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> (and possibly <code>answer</code>, <code>aggregation_labels</code>, <code>numeric_values</code> and <code>numeric_values_scale</code> are provided)) \u2014 Total loss as the sum of the hierarchical cell selection log-likelihood loss and (optionally) the
semi-supervised regression loss and (optionally) supervised loss for aggregations.</li>
<li><strong>logits</strong> (<code>tf.Tensor</code> of shape <code>(batch_size, sequence_length)</code>) \u2014 Prediction scores of the cell selection head, for every token.</li>
<li><strong>logits_aggregation</strong> (<code>tf.Tensor</code>, <em>optional</em>, of shape <code>(batch_size, num_aggregation_labels)</code>) \u2014 Prediction scores of the aggregation head, for every aggregation operator.</li>
<li><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>) \u2014 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>. Hidden-states of the model at the output of each layer plus
the initial embedding outputs.</li>
<li><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>) \u2014 Tuple of <code>tf.Tensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>. Attentions weights after the attention softmax, used to compute the weighted average in
the self-attention heads.</li>
</ul>
`,returnType:`
<p><code>transformers.models.tapas.modeling_tf_tapas.TFTableQuestionAnsweringOutput</code> or <code>tuple(tf.Tensor)</code></p>
`}}),rn=new Qs({props:{$$slots:{default:[Uj]},$$scope:{ctx:A}}}),dn=new yo({props:{anchor:"transformers.TFTapasForQuestionAnswering.call.example",$$slots:{default:[kj]},$$scope:{ctx:A}}}),{c(){i=o("meta"),M=p(),d=o("h1"),f=o("a"),y=o("span"),b(c.$$.fragment),g=p(),I=o("span"),E=s("TAPAS"),S=p(),$=o("h2"),Y=o("a"),ae=o("span"),b(w.$$.fragment),X=p(),L=o("span"),W=s("Overview"),x=p(),z=o("p"),F=s("The TAPAS model was proposed in "),R=o("a"),P=s("TAPAS: Weakly Supervised Table Parsing via Pre-training"),ie=s(`
by Jonathan Herzig, Pawe\u0142 Krzysztof Nowak, Thomas M\xFCller, Francesco Piccinno and Julian Martin Eisenschlos. It\u2019s a BERT-based model specifically
designed (and pre-trained) for answering questions about tabular data. Compared to BERT, TAPAS uses relative position embeddings and has 7
token types that encode tabular structure. TAPAS is pre-trained on the masked language modeling (MLM) objective on a large dataset comprising
millions of tables from English Wikipedia and corresponding texts.`),me=p(),K=o("p"),ge=s("For question answering, TAPAS has 2 heads on top: a cell selection head and an aggregation head, for (optionally) performing aggregations (such as counting or summing) among selected cells. TAPAS has been fine-tuned on several datasets:"),pe=p(),ee=o("ul"),Te=o("li"),q=o("a"),G=s("SQA"),Q=s(" (Sequential Question Answering by Microsoft)"),Z=p(),D=o("li"),V=o("a"),we=s("WTQ"),Ce=s(" (Wiki Table Questions by Stanford University)"),he=p(),fe=o("li"),Ee=o("a"),se=s("WikiSQL"),je=s(" (by Salesforce)."),Me=p(),Ze=o("p"),Fe=s("It achieves state-of-the-art on both SQA and WTQ, while having comparable performance to SOTA on WikiSQL, with a much simpler architecture."),ve=p(),Be=o("p"),Ue=s("The abstract from the paper is the following:"),ce=p(),We=o("p"),be=o("em"),O=s("Answering natural language questions over tables is usually seen as a semantic parsing task. To alleviate the collection cost of full logical forms, one popular approach focuses on weak supervision consisting of denotations instead of logical forms. However, training semantic parsers from weak supervision poses difficulties, and in addition, the generated logical forms are only used as an intermediate step prior to retrieving the denotation. In this paper, we present TAPAS, an approach to question answering over tables without generating logical forms. TAPAS trains from weak supervision, and predicts the denotation by selecting table cells and optionally applying a corresponding aggregation operator to such selection. TAPAS extends BERT\u2019s architecture to encode tables as input, initializes from an effective joint pre-training of text segments and tables crawled from Wikipedia, and is trained end-to-end. We experiment with three different semantic parsing datasets, and find that TAPAS outperforms or rivals semantic parsing models by improving state-of-the-art accuracy on SQA from 55.1 to 67.2 and performing on par with the state-of-the-art on WIKISQL and WIKITQ, but with a simpler model architecture. We additionally find that transfer learning, which is trivial in our setting, from WIKISQL to WIKITQ, yields 48.7 accuracy, 4.2 points above the state-of-the-art."),Je=p(),H=o("p"),Re=s("In addition, the authors have further pre-trained TAPAS to recognize "),oe=o("strong"),Se=s("table entailment"),xe=s(", by creating a balanced dataset of millions of automatically created training examples which are learned in an intermediate step prior to fine-tuning. The authors of TAPAS call this further pre-training intermediate pre-training (since TAPAS is first pre-trained on MLM, and then on another dataset). They found that intermediate pre-training further improves performance on SQA, achieving a new state-of-the-art as well as state-of-the-art on "),_=o("a"),B=s("TabFact"),He=s(", a large-scale dataset with 16k Wikipedia tables for table entailment (a binary classification task). For more details, see their follow-up paper: "),ye=o("a"),Pe=s("Understanding tables with intermediate pre-training"),Oe=s(" by Julian Martin Eisenschlos, Syrine Krichene and Thomas M\xFCller."),N=p(),Ge=o("img"),Ne=p(),Qe=o("small"),Le=s("TAPAS architecture. Taken from the "),de=o("a"),ke=s("original blog post"),Ke=s("."),Ae=p(),ne=o("p"),et=s("This model was contributed by "),Ve=o("a"),le=s("nielsr"),Xe=s(". The Tensorflow version of this model was contributed by "),Ie=o("a"),tt=s("kamalkraj"),Bt=s(". The original code can be found "),Wt=o("a"),Rs=s("here"),zt=s("."),ys=p(),ts=o("p"),qt=s("Tips:"),_s=p(),ut=o("ul"),ze=o("li"),Ss=s("TAPAS is a model that uses relative position embeddings by default (restarting the position embeddings at every cell of the table). Note that this is something that was added after the publication of the original TAPAS paper. According to the authors, this usually results in a slightly better performance, and allows you to encode longer sequences without running out of embeddings. This is reflected in the "),$t=o("code"),re=s("reset_position_index_per_cell"),yt=s(" parameter of "),ss=o("a"),xs=s("TapasConfig"),Gt=s(", which is set to "),ns=o("code"),Vs=s("True"),Nt=s(" by default. The default versions of the models available on the "),Qt=o("a"),Xs=s("hub"),Rt=s(" all use relative position embeddings. You can still use the ones with absolute position embeddings by passing in an additional argument "),ls=o("code"),Ys=s('revision="no_reset"'),St=s(" when calling the "),rs=o("code"),Ds=s("from_pretrained()"),xt=s(" method. Note that it\u2019s usually advised to pad the inputs on the right rather than the left."),Hs=p(),st=o("li"),Vt=s("TAPAS is based on BERT, so "),is=o("code"),Ps=s("TAPAS-base"),Xt=s(" for example corresponds to a "),ds=o("code"),Os=s("BERT-base"),cs=s(" architecture. Of course, "),it=o("code"),ps=s("TAPAS-large"),qe=s(" will result in the best performance (the results reported in the paper are from "),hs=o("code"),_t=s("TAPAS-large"),Ls=s("). Results of the various sized models are shown on the "),Yt=o("a"),Dt=s("original Github repository"),Ks=s("."),ea=p(),dt=o("li"),ta=s("TAPAS has checkpoints fine-tuned on SQA, which are capable of answering questions related to a table in a conversational set-up. This means that you can ask follow-up questions such as \u201Cwhat is his age?\u201D related to the previous question. Note that the forward pass of TAPAS is a bit different in case of a conversational set-up: in that case, you have to feed every table-question pair one by one to the model, such that the "),us=o("code"),ms=s("prev_labels"),gt=s(" token type ids can be overwritten by the predicted "),Ht=o("code"),C=s("labels"),te=s(" of the model to the previous question. See \u201CUsage\u201D section for more info."),ja=p(),sa=o("li"),va=s("TAPAS is similar to BERT and therefore relies on the masked language modeling (MLM) objective. It is therefore efficient at predicting masked tokens and at NLU in general, but is not optimal for text generation. Models trained with a causal language modeling (CLM) objective are better in that regard. Note that TAPAS can be used as an encoder in the EncoderDecoderModel framework, to combine it with an autoregressive text decoder such as GPT-2."),ha=p(),Pt=o("h2"),Tt=o("a"),aa=o("span"),b(wt.$$.fragment),Ja=p(),oa=o("span"),Ua=s("Usage: fine-tuning"),ua=p(),nt=o("p"),fs=s("Here we explain how you can fine-tune "),ws=o("a"),ct=s("TapasForQuestionAnswering"),ka=s(" on your own dataset."),ma=p(),bs=o("p"),na=o("strong"),gs=s("STEP 1: Choose one of the 3 ways in which you can use TAPAS - or experiment"),fa=p(),_e=o("p"),Ia=s("Basically, there are 3 different ways in which one can fine-tune "),js=o("a"),Ea=s("TapasForQuestionAnswering"),Ca=s(", corresponding to the different datasets on which Tapas was fine-tuned:"),ga=p(),Et=o("ol"),la=o("li"),Ts=s("SQA: if you\u2019re interested in asking follow-up questions related to a table, in a conversational set-up. For example if you first ask \u201Cwhat\u2019s the name of the first actor?\u201D then you can ask a follow-up question such as \u201Chow old is he?\u201C. Here, questions do not involve any aggregation (all questions are cell selection questions)."),Aa=p(),$e=o("li"),Fa=s("WTQ: if you\u2019re not interested in asking questions in a conversational set-up, but rather just asking questions related to a table, which might involve aggregation, such as counting a number of rows, summing up cell values or averaging cell values. You can then for example ask \u201Cwhat\u2019s the total number of goals Cristiano Ronaldo made in his career?\u201C. This case is also called "),ra=o("strong"),Za=s("weak supervision"),Ba=s(", since the model itself must learn the appropriate aggregation operator (SUM/COUNT/AVERAGE/NONE) given only the answer to the question as supervision."),Wa=p(),ue=o("li"),za=s("WikiSQL-supervised: this dataset is based on WikiSQL with the model being given the ground truth aggregation operator during training. This is also called "),ia=o("strong"),qa=s("strong supervision"),$a=s(". Here, learning the appropriate aggregation operator is much easier."),Ta=p(),vs=o("p"),Ga=s("To summarize:"),Ma=p(),Ye=o("table"),da=o("thead"),Ot=o("tr"),ca=o("th"),li=o("strong"),Hp=s("Task"),Pp=p(),ri=o("th"),ii=o("strong"),Op=s("Example dataset"),Lp=p(),di=o("th"),ci=o("strong"),Kp=s("Description"),eh=p(),Na=o("tbody"),Qa=o("tr"),pi=o("td"),th=s("Conversational"),sh=p(),hi=o("td"),ah=s("SQA"),oh=p(),ui=o("td"),nh=s("Conversational, only cell selection questions"),lh=p(),Ra=o("tr"),mi=o("td"),rh=s("Weak supervision for aggregation"),ih=p(),fi=o("td"),dh=s("WTQ"),ch=p(),gi=o("td"),ph=s("Questions might involve aggregation, and the model must learn this given only the answer as supervision"),hh=p(),Sa=o("tr"),Ti=o("td"),uh=s("Strong supervision for aggregation"),mh=p(),Mi=o("td"),fh=s("WikiSQL-supervised"),gh=p(),yi=o("td"),Th=s("Questions might involve aggregation, and the model must learn this given the gold aggregation operator"),mc=p(),b(_o.$$.fragment),fc=p(),wo=o("p"),Mh=s("What you can also do is start from an already fine-tuned checkpoint. A note here is that the already fine-tuned checkpoint on WTQ has some issues due to the L2-loss which is somewhat brittle. See "),bn=o("a"),yh=s("here"),_h=s(" for more info."),gc=p(),bo=o("p"),wh=s("For a list of all pre-trained and fine-tuned TAPAS checkpoints available on HuggingFace\u2019s  hub, see "),jn=o("a"),bh=s("here"),jh=s("."),Tc=p(),Hl=o("p"),_i=o("strong"),vh=s("STEP 2: Prepare your data in the SQA format"),Mc=p(),jo=o("p"),Jh=s("Second, no matter what you picked above, you should prepare your dataset in the "),vn=o("a"),Uh=s("SQA"),kh=s(" format. This format is a TSV/CSV file with the following columns:"),yc=p(),lt=o("ul"),Pl=o("li"),wi=o("code"),Ih=s("id"),Eh=s(": optional, id of the table-question pair, for bookkeeping purposes."),Ch=p(),Ol=o("li"),bi=o("code"),Ah=s("annotator"),Fh=s(": optional, id of the person who annotated the table-question pair, for bookkeeping purposes."),Zh=p(),Ll=o("li"),ji=o("code"),Bh=s("position"),Wh=s(": integer indicating if the question is the first, second, third,\u2026 related to the table. Only required in case of conversational setup (SQA). You don\u2019t need this column in case you\u2019re going for WTQ/WikiSQL-supervised."),zh=p(),Kl=o("li"),vi=o("code"),qh=s("question"),$h=s(": string"),Gh=p(),er=o("li"),Ji=o("code"),Nh=s("table_file"),Qh=s(": string, name of a csv file containing the tabular data"),Rh=p(),tr=o("li"),Ui=o("code"),Sh=s("answer_coordinates"),xh=s(": list of one or more tuples (each tuple being a cell coordinate, i.e. row, column pair that is part of the answer)"),Vh=p(),sr=o("li"),ki=o("code"),Xh=s("answer_text"),Yh=s(": list of one or more strings (each string being a cell value that is part of the answer)"),Dh=p(),ar=o("li"),Ii=o("code"),Hh=s("aggregation_label"),Ph=s(": index of the aggregation operator. Only required in case of strong supervision for aggregation (the WikiSQL-supervised case)"),Oh=p(),or=o("li"),Ei=o("code"),Lh=s("float_answer"),Kh=s(": the float answer to the question, if there is one (np.nan if there isn\u2019t). Only required in case of weak supervision for aggregation (such as WTQ and WikiSQL)"),_c=p(),Ct=o("p"),eu=s("The tables themselves should be present in a folder, each table being a separate csv file. Note that the authors of the TAPAS algorithm used conversion scripts with some automated logic to convert the other datasets (WTQ, WikiSQL) into the SQA format. The author explains this "),Jn=o("a"),tu=s("here"),su=s(". A conversion of this script that works with HuggingFace\u2019s implementation can be found "),Un=o("a"),au=s("here"),ou=s(". Interestingly, these conversion scripts are not perfect (the "),Ci=o("code"),nu=s("answer_coordinates"),lu=s(" and "),Ai=o("code"),ru=s("float_answer"),iu=s(" fields are populated based on the "),Fi=o("code"),du=s("answer_text"),cu=s("), meaning that WTQ and WikiSQL results could actually be improved."),wc=p(),nr=o("p"),Zi=o("strong"),pu=s("STEP 3: Convert your data into tensors using TapasTokenizer"),bc=p(),b(vo.$$.fragment),jc=p(),De=o("p"),hu=s("Note that here, we encode each table-question pair independently. This is fine as long as your dataset is "),Bi=o("strong"),uu=s("not conversational"),mu=s(". In case your dataset involves conversational questions (such as in SQA), then you should first group together the "),Wi=o("code"),fu=s("queries"),gu=s(", "),zi=o("code"),Tu=s("answer_coordinates"),Mu=s(" and "),qi=o("code"),yu=s("answer_text"),_u=s(" per table (in the order of their "),$i=o("code"),wu=s("position"),bu=s(`
index) and batch encode each table with its questions. This will make sure that the `),Gi=o("code"),ju=s("prev_labels"),vu=s(" token types (see docs of "),lr=o("a"),Ju=s("TapasTokenizer"),Uu=s(") are set correctly. See "),kn=o("a"),ku=s("this notebook"),Iu=s(" for more info. See "),In=o("a"),Eu=s("this notebook"),Cu=s(" for more info regarding using the TensorFlow model."),vc=p(),rr=o("p"),Au=s("**STEP 4: Train (fine-tune) the model"),Jc=p(),b(Jo.$$.fragment),Uc=p(),xa=o("h2"),Uo=o("a"),Ni=o("span"),b(En.$$.fragment),Fu=p(),Qi=o("span"),Zu=s("Usage: inference"),kc=p(),b(ko.$$.fragment),Ic=p(),At=o("p"),Bu=s("In case of a conversational set-up, then each table-question pair must be provided "),Ri=o("strong"),Wu=s("sequentially"),zu=s(" to the model, such that the "),Si=o("code"),qu=s("prev_labels"),$u=s(" token types can be overwritten by the predicted "),xi=o("code"),Gu=s("labels"),Nu=s(" of the previous table-question pair. Again, more info can be found in "),Cn=o("a"),Qu=s("this notebook"),Ru=s(" (for PyTorch) and "),An=o("a"),Su=s("this notebook"),xu=s(" (for TensorFlow)."),Ec=p(),Va=o("h2"),Io=o("a"),Vi=o("span"),b(Fn.$$.fragment),Vu=p(),Xi=o("span"),Xu=s("Documentation resources"),Cc=p(),Eo=o("ul"),Yi=o("li"),ir=o("a"),Yu=s("Text classification task guide"),Du=p(),Di=o("li"),dr=o("a"),Hu=s("Masked language modeling task guide"),Ac=p(),Xa=o("h2"),Co=o("a"),Hi=o("span"),b(Zn.$$.fragment),Pu=p(),Pi=o("span"),Ou=s("TAPAS specific outputs"),Fc=p(),Ya=o("div"),b(Bn.$$.fragment),Lu=p(),Wn=o("p"),Ku=s("Output type of "),cr=o("a"),em=s("TapasForQuestionAnswering"),tm=s("."),Zc=p(),Da=o("h2"),Ao=o("a"),Oi=o("span"),b(zn.$$.fragment),sm=p(),Li=o("span"),am=s("TapasConfig"),Bc=p(),Lt=o("div"),b(qn.$$.fragment),om=p(),Ha=o("p"),nm=s("This is the configuration class to store the configuration of a "),pr=o("a"),lm=s("TapasModel"),rm=s(`. It is used to instantiate a TAPAS
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 TAPAS
`),$n=o("a"),im=s("google/tapas-base-finetuned-sqa"),dm=s(" architecture."),cm=p(),Pa=o("p"),pm=s("Configuration objects inherit from "),Ki=o("code"),hm=s("PreTrainedConfig"),um=s(` and can be used to control the model outputs. Read the
documentation from `),hr=o("a"),mm=s("PretrainedConfig"),fm=s(" for more information."),gm=p(),Gn=o("p"),Tm=s(`Hyperparameters additional to BERT are taken from run_task_main.py and hparam_utils.py of the original
implementation. Original implementation available at `),Nn=o("a"),Mm=s("https://github.com/google-research/tapas/tree/master"),ym=s("."),_m=p(),b(Fo.$$.fragment),Wc=p(),Oa=o("h2"),Zo=o("a"),ed=o("span"),b(Qn.$$.fragment),wm=p(),td=o("span"),bm=s("TapasTokenizer"),zc=p(),pt=o("div"),b(Rn.$$.fragment),jm=p(),sd=o("p"),vm=s(`Construct a TAPAS tokenizer. Based on WordPiece. Flattens a table and one or more related sentences to be used by
TAPAS models.`),Jm=p(),at=o("p"),Um=s("This tokenizer inherits from "),ur=o("a"),km=s("PreTrainedTokenizer"),Im=s(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods. `),mr=o("a"),Em=s("TapasTokenizer"),Cm=s(` creates several token type ids to
encode tabular structure. To be more precise, it adds 7 token type ids, in the following order: `),ad=o("code"),Am=s("segment_ids"),Fm=s(`,
`),od=o("code"),Zm=s("column_ids"),Bm=s(", "),nd=o("code"),Wm=s("row_ids"),zm=s(", "),ld=o("code"),qm=s("prev_labels"),$m=s(", "),rd=o("code"),Gm=s("column_ranks"),Nm=s(", "),id=o("code"),Qm=s("inv_column_ranks"),Rm=s(" and "),dd=o("code"),Sm=s("numeric_relations"),xm=s(":"),Vm=p(),bt=o("ul"),cd=o("li"),Xm=s(`segment_ids: indicate whether a token belongs to the question (0) or the table (1). 0 for special tokens and
padding.`),Ym=p(),pd=o("li"),Dm=s(`column_ids: indicate to which column of the table a token belongs (starting from 1). Is 0 for all question
tokens, special tokens and padding.`),Hm=p(),hd=o("li"),Pm=s(`row_ids: indicate to which row of the table a token belongs (starting from 1). Is 0 for all question tokens,
special tokens and padding. Tokens of column headers are also 0.`),Om=p(),ud=o("li"),Lm=s(`prev_labels: indicate whether a token was (part of) an answer to the previous question (1) or not (0). Useful in
a conversational setup (such as SQA).`),Km=p(),md=o("li"),ef=s(`column_ranks: indicate the rank of a table token relative to a column, if applicable. For example, if you have a
column \u201Cnumber of movies\u201D with values 87, 53 and 69, then the column ranks of these tokens are 3, 1 and 2
respectively. 0 for all question tokens, special tokens and padding.`),tf=p(),fd=o("li"),sf=s(`inv_column_ranks: indicate the inverse rank of a table token relative to a column, if applicable. For example, if
you have a column \u201Cnumber of movies\u201D with values 87, 53 and 69, then the inverse column ranks of these tokens are
1, 3 and 2 respectively. 0 for all question tokens, special tokens and padding.`),af=p(),gd=o("li"),of=s(`numeric_relations: indicate numeric relations between the question and the tokens of the table. 0 for all
question tokens, special tokens and padding.`),nf=p(),fr=o("p"),gr=o("a"),lf=s("TapasTokenizer"),rf=s(` runs end-to-end tokenization on a table and associated sentences: punctuation splitting and
wordpiece.`),df=p(),Bo=o("div"),b(Sn.$$.fragment),cf=p(),Td=o("p"),pf=s("Main method to tokenize and prepare for the model one or several sequence(s) related to a table."),hf=p(),ya=o("div"),b(xn.$$.fragment),uf=p(),Vn=o("p"),mf=s("Converts logits of "),Tr=o("a"),ff=s("TapasForQuestionAnswering"),gf=s(` to actual predicted answer coordinates and optional
aggregation indices.`),Tf=p(),Xn=o("p"),Mf=s(`The original implementation, on which this function is based, can be found
`),Yn=o("a"),yf=s("here"),_f=s("."),wf=p(),Mr=o("div"),b(Dn.$$.fragment),qc=p(),La=o("h2"),Wo=o("a"),Md=o("span"),b(Hn.$$.fragment),bf=p(),yd=o("span"),jf=s("TapasModel"),$c=p(),jt=o("div"),b(Pn.$$.fragment),vf=p(),On=o("p"),Jf=s(`The bare Tapas Model transformer outputting raw hidden-states without any specific head on top.
This model inherits from `),yr=o("a"),Uf=s("PreTrainedModel"),kf=s(`. Check the superclass documentation for the generic methods the
library implements for all its models (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),If=p(),Ln=o("p"),Ef=s("This model is also a PyTorch "),Kn=o("a"),Cf=s("torch.nn.Module"),Af=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ff=p(),el=o("p"),Zf=s("This class is a small change compared to "),_r=o("a"),Bf=s("BertModel"),Wf=s(", taking into account the additional token type ids."),zf=p(),tl=o("p"),qf=s(`The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
cross-attention is added between the self-attention layers, following the architecture described in `),sl=o("a"),$f=s(`Attention is
all you need`),Gf=s(` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),Nf=p(),Js=o("div"),b(al.$$.fragment),Qf=p(),Ka=o("p"),Rf=s("The "),wr=o("a"),Sf=s("TapasModel"),xf=s(" forward method, overrides the "),_d=o("code"),Vf=s("__call__"),Xf=s(" special method."),Yf=p(),b(zo.$$.fragment),Df=p(),b(qo.$$.fragment),Gc=p(),eo=o("h2"),$o=o("a"),wd=o("span"),b(ol.$$.fragment),Hf=p(),bd=o("span"),Pf=s("TapasForMaskedLM"),Nc=p(),Ms=o("div"),b(nl.$$.fragment),Of=p(),to=o("p"),Lf=s("Tapas Model with a "),jd=o("code"),Kf=s("language modeling"),eg=s(` head on top.
This model inherits from `),br=o("a"),tg=s("PreTrainedModel"),sg=s(`. Check the superclass documentation for the generic methods the
library implements for all its models (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),ag=p(),ll=o("p"),og=s("This model is also a PyTorch "),rl=o("a"),ng=s("torch.nn.Module"),lg=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),rg=p(),Us=o("div"),b(il.$$.fragment),ig=p(),so=o("p"),dg=s("The "),jr=o("a"),cg=s("TapasForMaskedLM"),pg=s(" forward method, overrides the "),vd=o("code"),hg=s("__call__"),ug=s(" special method."),mg=p(),b(Go.$$.fragment),fg=p(),b(No.$$.fragment),Qc=p(),ao=o("h2"),Qo=o("a"),Jd=o("span"),b(dl.$$.fragment),gg=p(),Ud=o("span"),Tg=s("TapasForSequenceClassification"),Rc=p(),Kt=o("div"),b(cl.$$.fragment),Mg=p(),kd=o("p"),yg=s(`Tapas Model with a sequence classification head on top (a linear layer on top of the pooled output), e.g. for table
entailment tasks, such as TabFact (Chen et al., 2020).`),_g=p(),pl=o("p"),wg=s("This model inherits from "),vr=o("a"),bg=s("PreTrainedModel"),jg=s(`. Check the superclass documentation for the generic methods the
library implements for all its models (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),vg=p(),hl=o("p"),Jg=s("This model is also a PyTorch "),ul=o("a"),Ug=s("torch.nn.Module"),kg=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ig=p(),ks=o("div"),b(ml.$$.fragment),Eg=p(),oo=o("p"),Cg=s("The "),Jr=o("a"),Ag=s("TapasForSequenceClassification"),Fg=s(" forward method, overrides the "),Id=o("code"),Zg=s("__call__"),Bg=s(" special method."),Wg=p(),b(Ro.$$.fragment),zg=p(),b(So.$$.fragment),Sc=p(),no=o("h2"),xo=o("a"),Ed=o("span"),b(fl.$$.fragment),qg=p(),Cd=o("span"),$g=s("TapasForQuestionAnswering"),xc=p(),es=o("div"),b(gl.$$.fragment),Gg=p(),lo=o("p"),Ng=s(`Tapas Model with a cell selection head and optional aggregation head on top for question-answering tasks on tables
(linear layers on top of the hidden-states output to compute `),Ad=o("code"),Qg=s("logits"),Rg=s(" and optional "),Fd=o("code"),Sg=s("logits_aggregation"),xg=s(`), e.g. for
SQA, WTQ or WikiSQL-supervised tasks.`),Vg=p(),Tl=o("p"),Xg=s("This model inherits from "),Ur=o("a"),Yg=s("PreTrainedModel"),Dg=s(`. Check the superclass documentation for the generic methods the
library implements for all its models (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Hg=p(),Ml=o("p"),Pg=s("This model is also a PyTorch "),yl=o("a"),Og=s("torch.nn.Module"),Lg=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Kg=p(),Is=o("div"),b(_l.$$.fragment),eT=p(),ro=o("p"),tT=s("The "),kr=o("a"),sT=s("TapasForQuestionAnswering"),aT=s(" forward method, overrides the "),Zd=o("code"),oT=s("__call__"),nT=s(" special method."),lT=p(),b(Vo.$$.fragment),rT=p(),b(Xo.$$.fragment),Vc=p(),io=o("h2"),Yo=o("a"),Bd=o("span"),b(wl.$$.fragment),iT=p(),Wd=o("span"),dT=s("TFTapasModel"),Xc=p(),vt=o("div"),b(bl.$$.fragment),cT=p(),zd=o("p"),pT=s("The bare Tapas Model transformer outputting raw hidden-states without any specific head on top."),hT=p(),jl=o("p"),uT=s("This model inherits from "),Ir=o("a"),mT=s("TFPreTrainedModel"),fT=s(`. 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.)`),gT=p(),vl=o("p"),TT=s("This model is also a "),Jl=o("a"),MT=s("tf.keras.Model"),yT=s(` 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.`),_T=p(),b(Do.$$.fragment),wT=p(),Es=o("div"),b(Ul.$$.fragment),bT=p(),co=o("p"),jT=s("The "),Er=o("a"),vT=s("TFTapasModel"),JT=s(" forward method, overrides the "),qd=o("code"),UT=s("__call__"),kT=s(" special method."),IT=p(),b(Ho.$$.fragment),ET=p(),b(Po.$$.fragment),Yc=p(),po=o("h2"),Oo=o("a"),$d=o("span"),b(kl.$$.fragment),CT=p(),Gd=o("span"),AT=s("TFTapasForMaskedLM"),Dc=p(),Jt=o("div"),b(Il.$$.fragment),FT=p(),El=o("p"),ZT=s("Tapas Model with a "),Nd=o("code"),BT=s("language modeling"),WT=s(" head on top."),zT=p(),Cl=o("p"),qT=s("This model inherits from "),Cr=o("a"),$T=s("TFPreTrainedModel"),GT=s(`. 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=p(),Al=o("p"),QT=s("This model is also a "),Fl=o("a"),RT=s("tf.keras.Model"),ST=s(` 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.`),xT=p(),b(Lo.$$.fragment),VT=p(),Cs=o("div"),b(Zl.$$.fragment),XT=p(),ho=o("p"),YT=s("The "),Ar=o("a"),DT=s("TFTapasForMaskedLM"),HT=s(" forward method, overrides the "),Qd=o("code"),PT=s("__call__"),OT=s(" special method."),LT=p(),b(Ko.$$.fragment),KT=p(),b(en.$$.fragment),Hc=p(),uo=o("h2"),tn=o("a"),Rd=o("span"),b(Bl.$$.fragment),eM=p(),Sd=o("span"),tM=s("TFTapasForSequenceClassification"),Pc=p(),Ut=o("div"),b(Wl.$$.fragment),sM=p(),xd=o("p"),aM=s(`Tapas Model with a sequence classification head on top (a linear layer on top of the pooled output), e.g. for table
entailment tasks, such as TabFact (Chen et al., 2020).`),oM=p(),zl=o("p"),nM=s("This model inherits from "),Fr=o("a"),lM=s("TFPreTrainedModel"),rM=s(`. 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.)`),iM=p(),ql=o("p"),dM=s("This model is also a "),$l=o("a"),cM=s("tf.keras.Model"),pM=s(` 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.`),hM=p(),b(sn.$$.fragment),uM=p(),As=o("div"),b(Gl.$$.fragment),mM=p(),mo=o("p"),fM=s("The "),Zr=o("a"),gM=s("TFTapasForSequenceClassification"),TM=s(" forward method, overrides the "),Vd=o("code"),MM=s("__call__"),yM=s(" special method."),_M=p(),b(an.$$.fragment),wM=p(),b(on.$$.fragment),Oc=p(),fo=o("h2"),nn=o("a"),Xd=o("span"),b(Nl.$$.fragment),bM=p(),Yd=o("span"),jM=s("TFTapasForQuestionAnswering"),Lc=p(),kt=o("div"),b(Ql.$$.fragment),vM=p(),go=o("p"),JM=s(`Tapas Model with a cell selection head and optional aggregation head on top for question-answering tasks on tables
(linear layers on top of the hidden-states output to compute `),Dd=o("code"),UM=s("logits"),kM=s(" and optional "),Hd=o("code"),IM=s("logits_aggregation"),EM=s(`), e.g. for
SQA, WTQ or WikiSQL-supervised tasks.`),CM=p(),Rl=o("p"),AM=s("This model inherits from "),Br=o("a"),FM=s("TFPreTrainedModel"),ZM=s(`. 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.)`),BM=p(),Sl=o("p"),WM=s("This model is also a "),xl=o("a"),zM=s("tf.keras.Model"),qM=s(` 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.`),$M=p(),b(ln.$$.fragment),GM=p(),Fs=o("div"),b(Vl.$$.fragment),NM=p(),To=o("p"),QM=s("The "),Wr=o("a"),RM=s("TFTapasForQuestionAnswering"),SM=s(" forward method, overrides the "),Pd=o("code"),xM=s("__call__"),VM=s(" special method."),XM=p(),b(rn.$$.fragment),YM=p(),b(dn.$$.fragment),this.h()},l(r){const T=Rb('[data-svelte="svelte-1phssyn"]',document.head);i=n(T,"META",{name:!0,content:!0}),T.forEach(t),M=h(r),d=n(r,"H1",{class:!0});var Xl=l(d);f=n(Xl,"A",{id:!0,class:!0,href:!0});var Od=l(f);y=n(Od,"SPAN",{});var Ld=l(y);j(c.$$.fragment,Ld),Ld.forEach(t),Od.forEach(t),g=h(Xl),I=n(Xl,"SPAN",{});var Kd=l(I);E=a(Kd,"TAPAS"),Kd.forEach(t),Xl.forEach(t),S=h(r),$=n(r,"H2",{class:!0});var Yl=l($);Y=n(Yl,"A",{id:!0,class:!0,href:!0});var ec=l(Y);ae=n(ec,"SPAN",{});var tc=l(ae);j(w.$$.fragment,tc),tc.forEach(t),ec.forEach(t),X=h(Yl),L=n(Yl,"SPAN",{});var sc=l(L);W=a(sc,"Overview"),sc.forEach(t),Yl.forEach(t),x=h(r),z=n(r,"P",{});var Dl=l(z);F=a(Dl,"The TAPAS model was proposed in "),R=n(Dl,"A",{href:!0,rel:!0});var ac=l(R);P=a(ac,"TAPAS: Weakly Supervised Table Parsing via Pre-training"),ac.forEach(t),ie=a(Dl,`
by Jonathan Herzig, Pawe\u0142 Krzysztof Nowak, Thomas M\xFCller, Francesco Piccinno and Julian Martin Eisenschlos. It\u2019s a BERT-based model specifically
designed (and pre-trained) for answering questions about tabular data. Compared to BERT, TAPAS uses relative position embeddings and has 7
token types that encode tabular structure. TAPAS is pre-trained on the masked language modeling (MLM) objective on a large dataset comprising
millions of tables from English Wikipedia and corresponding texts.`),Dl.forEach(t),me=h(r),K=n(r,"P",{});var oc=l(K);ge=a(oc,"For question answering, TAPAS has 2 heads on top: a cell selection head and an aggregation head, for (optionally) performing aggregations (such as counting or summing) among selected cells. TAPAS has been fine-tuned on several datasets:"),oc.forEach(t),pe=h(r),ee=n(r,"UL",{});var Mo=l(ee);Te=n(Mo,"LI",{});var zr=l(Te);q=n(zr,"A",{href:!0,rel:!0});var nc=l(q);G=a(nc,"SQA"),nc.forEach(t),Q=a(zr," (Sequential Question Answering by Microsoft)"),zr.forEach(t),Z=h(Mo),D=n(Mo,"LI",{});var qr=l(D);V=n(qr,"A",{href:!0,rel:!0});var lc=l(V);we=a(lc,"WTQ"),lc.forEach(t),Ce=a(qr," (Wiki Table Questions by Stanford University)"),qr.forEach(t),he=h(Mo),fe=n(Mo,"LI",{});var $r=l(fe);Ee=n($r,"A",{href:!0,rel:!0});var rc=l(Ee);se=a(rc,"WikiSQL"),rc.forEach(t),je=a($r," (by Salesforce)."),$r.forEach(t),Mo.forEach(t),Me=h(r),Ze=n(r,"P",{});var ic=l(Ze);Fe=a(ic,"It achieves state-of-the-art on both SQA and WTQ, while having comparable performance to SOTA on WikiSQL, with a much simpler architecture."),ic.forEach(t),ve=h(r),Be=n(r,"P",{});var dc=l(Be);Ue=a(dc,"The abstract from the paper is the following:"),dc.forEach(t),ce=h(r),We=n(r,"P",{});var cc=l(We);be=n(cc,"EM",{});var pc=l(be);O=a(pc,"Answering natural language questions over tables is usually seen as a semantic parsing task. To alleviate the collection cost of full logical forms, one popular approach focuses on weak supervision consisting of denotations instead of logical forms. However, training semantic parsers from weak supervision poses difficulties, and in addition, the generated logical forms are only used as an intermediate step prior to retrieving the denotation. In this paper, we present TAPAS, an approach to question answering over tables without generating logical forms. TAPAS trains from weak supervision, and predicts the denotation by selecting table cells and optionally applying a corresponding aggregation operator to such selection. TAPAS extends BERT\u2019s architecture to encode tables as input, initializes from an effective joint pre-training of text segments and tables crawled from Wikipedia, and is trained end-to-end. We experiment with three different semantic parsing datasets, and find that TAPAS outperforms or rivals semantic parsing models by improving state-of-the-art accuracy on SQA from 55.1 to 67.2 and performing on par with the state-of-the-art on WIKISQL and WIKITQ, but with a simpler model architecture. We additionally find that transfer learning, which is trivial in our setting, from WIKISQL to WIKITQ, yields 48.7 accuracy, 4.2 points above the state-of-the-art."),pc.forEach(t),cc.forEach(t),Je=h(r),H=n(r,"P",{});var pa=l(H);Re=a(pa,"In addition, the authors have further pre-trained TAPAS to recognize "),oe=n(pa,"STRONG",{});var hc=l(oe);Se=a(hc,"table entailment"),hc.forEach(t),xe=a(pa,", by creating a balanced dataset of millions of automatically created training examples which are learned in an intermediate step prior to fine-tuning. The authors of TAPAS call this further pre-training intermediate pre-training (since TAPAS is first pre-trained on MLM, and then on another dataset). They found that intermediate pre-training further improves performance on SQA, achieving a new state-of-the-art as well as state-of-the-art on "),_=n(pa,"A",{href:!0,rel:!0});var uc=l(_);B=a(uc,"TabFact"),uc.forEach(t),He=a(pa,", a large-scale dataset with 16k Wikipedia tables for table entailment (a binary classification task). For more details, see their follow-up paper: "),ye=n(pa,"A",{href:!0,rel:!0});var oy=l(ye);Pe=a(oy,"Understanding tables with intermediate pre-training"),oy.forEach(t),Oe=a(pa," by Julian Martin Eisenschlos, Syrine Krichene and Thomas M\xFCller."),pa.forEach(t),N=h(r),Ge=n(r,"IMG",{src:!0,alt:!0,width:!0}),Ne=h(r),Qe=n(r,"SMALL",{});var ep=l(Qe);Le=a(ep,"TAPAS architecture. Taken from the "),de=n(ep,"A",{href:!0});var ny=l(de);ke=a(ny,"original blog post"),ny.forEach(t),Ke=a(ep,"."),ep.forEach(t),Ae=h(r),ne=n(r,"P",{});var cn=l(ne);et=a(cn,"This model was contributed by "),Ve=n(cn,"A",{href:!0,rel:!0});var ly=l(Ve);le=a(ly,"nielsr"),ly.forEach(t),Xe=a(cn,". The Tensorflow version of this model was contributed by "),Ie=n(cn,"A",{href:!0,rel:!0});var ry=l(Ie);tt=a(ry,"kamalkraj"),ry.forEach(t),Bt=a(cn,". The original code can be found "),Wt=n(cn,"A",{href:!0,rel:!0});var iy=l(Wt);Rs=a(iy,"here"),iy.forEach(t),zt=a(cn,"."),cn.forEach(t),ys=h(r),ts=n(r,"P",{});var dy=l(ts);qt=a(dy,"Tips:"),dy.forEach(t),_s=h(r),ut=n(r,"UL",{});var pn=l(ut);ze=n(pn,"LI",{});var as=l(ze);Ss=a(as,"TAPAS is a model that uses relative position embeddings by default (restarting the position embeddings at every cell of the table). Note that this is something that was added after the publication of the original TAPAS paper. According to the authors, this usually results in a slightly better performance, and allows you to encode longer sequences without running out of embeddings. This is reflected in the "),$t=n(as,"CODE",{});var cy=l($t);re=a(cy,"reset_position_index_per_cell"),cy.forEach(t),yt=a(as," parameter of "),ss=n(as,"A",{href:!0});var py=l(ss);xs=a(py,"TapasConfig"),py.forEach(t),Gt=a(as,", which is set to "),ns=n(as,"CODE",{});var hy=l(ns);Vs=a(hy,"True"),hy.forEach(t),Nt=a(as," by default. The default versions of the models available on the "),Qt=n(as,"A",{href:!0,rel:!0});var uy=l(Qt);Xs=a(uy,"hub"),uy.forEach(t),Rt=a(as," all use relative position embeddings. You can still use the ones with absolute position embeddings by passing in an additional argument "),ls=n(as,"CODE",{});var my=l(ls);Ys=a(my,'revision="no_reset"'),my.forEach(t),St=a(as," when calling the "),rs=n(as,"CODE",{});var fy=l(rs);Ds=a(fy,"from_pretrained()"),fy.forEach(t),xt=a(as," method. Note that it\u2019s usually advised to pad the inputs on the right rather than the left."),as.forEach(t),Hs=h(pn),st=n(pn,"LI",{});var Zs=l(st);Vt=a(Zs,"TAPAS is based on BERT, so "),is=n(Zs,"CODE",{});var gy=l(is);Ps=a(gy,"TAPAS-base"),gy.forEach(t),Xt=a(Zs," for example corresponds to a "),ds=n(Zs,"CODE",{});var Ty=l(ds);Os=a(Ty,"BERT-base"),Ty.forEach(t),cs=a(Zs," architecture. Of course, "),it=n(Zs,"CODE",{});var My=l(it);ps=a(My,"TAPAS-large"),My.forEach(t),qe=a(Zs," will result in the best performance (the results reported in the paper are from "),hs=n(Zs,"CODE",{});var yy=l(hs);_t=a(yy,"TAPAS-large"),yy.forEach(t),Ls=a(Zs,"). Results of the various sized models are shown on the "),Yt=n(Zs,"A",{href:!0,rel:!0});var _y=l(Yt);Dt=a(_y,"original Github repository"),_y.forEach(t),Ks=a(Zs,"."),Zs.forEach(t),ea=h(pn),dt=n(pn,"LI",{});var Gr=l(dt);ta=a(Gr,"TAPAS has checkpoints fine-tuned on SQA, which are capable of answering questions related to a table in a conversational set-up. This means that you can ask follow-up questions such as \u201Cwhat is his age?\u201D related to the previous question. Note that the forward pass of TAPAS is a bit different in case of a conversational set-up: in that case, you have to feed every table-question pair one by one to the model, such that the "),us=n(Gr,"CODE",{});var wy=l(us);ms=a(wy,"prev_labels"),wy.forEach(t),gt=a(Gr," token type ids can be overwritten by the predicted "),Ht=n(Gr,"CODE",{});var by=l(Ht);C=a(by,"labels"),by.forEach(t),te=a(Gr," of the model to the previous question. See \u201CUsage\u201D section for more info."),Gr.forEach(t),ja=h(pn),sa=n(pn,"LI",{});var jy=l(sa);va=a(jy,"TAPAS is similar to BERT and therefore relies on the masked language modeling (MLM) objective. It is therefore efficient at predicting masked tokens and at NLU in general, but is not optimal for text generation. Models trained with a causal language modeling (CLM) objective are better in that regard. Note that TAPAS can be used as an encoder in the EncoderDecoderModel framework, to combine it with an autoregressive text decoder such as GPT-2."),jy.forEach(t),pn.forEach(t),ha=h(r),Pt=n(r,"H2",{class:!0});var tp=l(Pt);Tt=n(tp,"A",{id:!0,class:!0,href:!0});var vy=l(Tt);aa=n(vy,"SPAN",{});var Jy=l(aa);j(wt.$$.fragment,Jy),Jy.forEach(t),vy.forEach(t),Ja=h(tp),oa=n(tp,"SPAN",{});var Uy=l(oa);Ua=a(Uy,"Usage: fine-tuning"),Uy.forEach(t),tp.forEach(t),ua=h(r),nt=n(r,"P",{});var sp=l(nt);fs=a(sp,"Here we explain how you can fine-tune "),ws=n(sp,"A",{href:!0});var ky=l(ws);ct=a(ky,"TapasForQuestionAnswering"),ky.forEach(t),ka=a(sp," on your own dataset."),sp.forEach(t),ma=h(r),bs=n(r,"P",{});var Iy=l(bs);na=n(Iy,"STRONG",{});var Ey=l(na);gs=a(Ey,"STEP 1: Choose one of the 3 ways in which you can use TAPAS - or experiment"),Ey.forEach(t),Iy.forEach(t),fa=h(r),_e=n(r,"P",{});var ap=l(_e);Ia=a(ap,"Basically, there are 3 different ways in which one can fine-tune "),js=n(ap,"A",{href:!0});var Cy=l(js);Ea=a(Cy,"TapasForQuestionAnswering"),Cy.forEach(t),Ca=a(ap,", corresponding to the different datasets on which Tapas was fine-tuned:"),ap.forEach(t),ga=h(r),Et=n(r,"OL",{});var Nr=l(Et);la=n(Nr,"LI",{});var Ay=l(la);Ts=a(Ay,"SQA: if you\u2019re interested in asking follow-up questions related to a table, in a conversational set-up. For example if you first ask \u201Cwhat\u2019s the name of the first actor?\u201D then you can ask a follow-up question such as \u201Chow old is he?\u201C. Here, questions do not involve any aggregation (all questions are cell selection questions)."),Ay.forEach(t),Aa=h(Nr),$e=n(Nr,"LI",{});var op=l($e);Fa=a(op,"WTQ: if you\u2019re not interested in asking questions in a conversational set-up, but rather just asking questions related to a table, which might involve aggregation, such as counting a number of rows, summing up cell values or averaging cell values. You can then for example ask \u201Cwhat\u2019s the total number of goals Cristiano Ronaldo made in his career?\u201C. This case is also called "),ra=n(op,"STRONG",{});var Fy=l(ra);Za=a(Fy,"weak supervision"),Fy.forEach(t),Ba=a(op,", since the model itself must learn the appropriate aggregation operator (SUM/COUNT/AVERAGE/NONE) given only the answer to the question as supervision."),op.forEach(t),Wa=h(Nr),ue=n(Nr,"LI",{});var np=l(ue);za=a(np,"WikiSQL-supervised: this dataset is based on WikiSQL with the model being given the ground truth aggregation operator during training. This is also called "),ia=n(np,"STRONG",{});var Zy=l(ia);qa=a(Zy,"strong supervision"),Zy.forEach(t),$a=a(np,". Here, learning the appropriate aggregation operator is much easier."),np.forEach(t),Nr.forEach(t),Ta=h(r),vs=n(r,"P",{});var By=l(vs);Ga=a(By,"To summarize:"),By.forEach(t),Ma=h(r),Ye=n(r,"TABLE",{});var lp=l(Ye);da=n(lp,"THEAD",{});var Wy=l(da);Ot=n(Wy,"TR",{});var Qr=l(Ot);ca=n(Qr,"TH",{});var zy=l(ca);li=n(zy,"STRONG",{});var qy=l(li);Hp=a(qy,"Task"),qy.forEach(t),zy.forEach(t),Pp=h(Qr),ri=n(Qr,"TH",{});var $y=l(ri);ii=n($y,"STRONG",{});var Gy=l(ii);Op=a(Gy,"Example dataset"),Gy.forEach(t),$y.forEach(t),Lp=h(Qr),di=n(Qr,"TH",{});var Ny=l(di);ci=n(Ny,"STRONG",{});var Qy=l(ci);Kp=a(Qy,"Description"),Qy.forEach(t),Ny.forEach(t),Qr.forEach(t),Wy.forEach(t),eh=h(lp),Na=n(lp,"TBODY",{});var Rr=l(Na);Qa=n(Rr,"TR",{});var Sr=l(Qa);pi=n(Sr,"TD",{});var Ry=l(pi);th=a(Ry,"Conversational"),Ry.forEach(t),sh=h(Sr),hi=n(Sr,"TD",{});var Sy=l(hi);ah=a(Sy,"SQA"),Sy.forEach(t),oh=h(Sr),ui=n(Sr,"TD",{});var xy=l(ui);nh=a(xy,"Conversational, only cell selection questions"),xy.forEach(t),Sr.forEach(t),lh=h(Rr),Ra=n(Rr,"TR",{});var xr=l(Ra);mi=n(xr,"TD",{});var Vy=l(mi);rh=a(Vy,"Weak supervision for aggregation"),Vy.forEach(t),ih=h(xr),fi=n(xr,"TD",{});var Xy=l(fi);dh=a(Xy,"WTQ"),Xy.forEach(t),ch=h(xr),gi=n(xr,"TD",{});var Yy=l(gi);ph=a(Yy,"Questions might involve aggregation, and the model must learn this given only the answer as supervision"),Yy.forEach(t),xr.forEach(t),hh=h(Rr),Sa=n(Rr,"TR",{});var Vr=l(Sa);Ti=n(Vr,"TD",{});var Dy=l(Ti);uh=a(Dy,"Strong supervision for aggregation"),Dy.forEach(t),mh=h(Vr),Mi=n(Vr,"TD",{});var Hy=l(Mi);fh=a(Hy,"WikiSQL-supervised"),Hy.forEach(t),gh=h(Vr),yi=n(Vr,"TD",{});var Py=l(yi);Th=a(Py,"Questions might involve aggregation, and the model must learn this given the gold aggregation operator"),Py.forEach(t),Vr.forEach(t),Rr.forEach(t),lp.forEach(t),mc=h(r),j(_o.$$.fragment,r),fc=h(r),wo=n(r,"P",{});var rp=l(wo);Mh=a(rp,"What you can also do is start from an already fine-tuned checkpoint. A note here is that the already fine-tuned checkpoint on WTQ has some issues due to the L2-loss which is somewhat brittle. See "),bn=n(rp,"A",{href:!0,rel:!0});var Oy=l(bn);yh=a(Oy,"here"),Oy.forEach(t),_h=a(rp," for more info."),rp.forEach(t),gc=h(r),bo=n(r,"P",{});var ip=l(bo);wh=a(ip,"For a list of all pre-trained and fine-tuned TAPAS checkpoints available on HuggingFace\u2019s  hub, see "),jn=n(ip,"A",{href:!0,rel:!0});var Ly=l(jn);bh=a(Ly,"here"),Ly.forEach(t),jh=a(ip,"."),ip.forEach(t),Tc=h(r),Hl=n(r,"P",{});var Ky=l(Hl);_i=n(Ky,"STRONG",{});var e_=l(_i);vh=a(e_,"STEP 2: Prepare your data in the SQA format"),e_.forEach(t),Ky.forEach(t),Mc=h(r),jo=n(r,"P",{});var dp=l(jo);Jh=a(dp,"Second, no matter what you picked above, you should prepare your dataset in the "),vn=n(dp,"A",{href:!0,rel:!0});var t_=l(vn);Uh=a(t_,"SQA"),t_.forEach(t),kh=a(dp," format. This format is a TSV/CSV file with the following columns:"),dp.forEach(t),yc=h(r),lt=n(r,"UL",{});var Mt=l(lt);Pl=n(Mt,"LI",{});var DM=l(Pl);wi=n(DM,"CODE",{});var s_=l(wi);Ih=a(s_,"id"),s_.forEach(t),Eh=a(DM,": optional, id of the table-question pair, for bookkeeping purposes."),DM.forEach(t),Ch=h(Mt),Ol=n(Mt,"LI",{});var HM=l(Ol);bi=n(HM,"CODE",{});var a_=l(bi);Ah=a(a_,"annotator"),a_.forEach(t),Fh=a(HM,": optional, id of the person who annotated the table-question pair, for bookkeeping purposes."),HM.forEach(t),Zh=h(Mt),Ll=n(Mt,"LI",{});var PM=l(Ll);ji=n(PM,"CODE",{});var o_=l(ji);Bh=a(o_,"position"),o_.forEach(t),Wh=a(PM,": integer indicating if the question is the first, second, third,\u2026 related to the table. Only required in case of conversational setup (SQA). You don\u2019t need this column in case you\u2019re going for WTQ/WikiSQL-supervised."),PM.forEach(t),zh=h(Mt),Kl=n(Mt,"LI",{});var OM=l(Kl);vi=n(OM,"CODE",{});var n_=l(vi);qh=a(n_,"question"),n_.forEach(t),$h=a(OM,": string"),OM.forEach(t),Gh=h(Mt),er=n(Mt,"LI",{});var LM=l(er);Ji=n(LM,"CODE",{});var l_=l(Ji);Nh=a(l_,"table_file"),l_.forEach(t),Qh=a(LM,": string, name of a csv file containing the tabular data"),LM.forEach(t),Rh=h(Mt),tr=n(Mt,"LI",{});var KM=l(tr);Ui=n(KM,"CODE",{});var r_=l(Ui);Sh=a(r_,"answer_coordinates"),r_.forEach(t),xh=a(KM,": list of one or more tuples (each tuple being a cell coordinate, i.e. row, column pair that is part of the answer)"),KM.forEach(t),Vh=h(Mt),sr=n(Mt,"LI",{});var ey=l(sr);ki=n(ey,"CODE",{});var i_=l(ki);Xh=a(i_,"answer_text"),i_.forEach(t),Yh=a(ey,": list of one or more strings (each string being a cell value that is part of the answer)"),ey.forEach(t),Dh=h(Mt),ar=n(Mt,"LI",{});var ty=l(ar);Ii=n(ty,"CODE",{});var d_=l(Ii);Hh=a(d_,"aggregation_label"),d_.forEach(t),Ph=a(ty,": index of the aggregation operator. Only required in case of strong supervision for aggregation (the WikiSQL-supervised case)"),ty.forEach(t),Oh=h(Mt),or=n(Mt,"LI",{});var sy=l(or);Ei=n(sy,"CODE",{});var c_=l(Ei);Lh=a(c_,"float_answer"),c_.forEach(t),Kh=a(sy,": the float answer to the question, if there is one (np.nan if there isn\u2019t). Only required in case of weak supervision for aggregation (such as WTQ and WikiSQL)"),sy.forEach(t),Mt.forEach(t),_c=h(r),Ct=n(r,"P",{});var Bs=l(Ct);eu=a(Bs,"The tables themselves should be present in a folder, each table being a separate csv file. Note that the authors of the TAPAS algorithm used conversion scripts with some automated logic to convert the other datasets (WTQ, WikiSQL) into the SQA format. The author explains this "),Jn=n(Bs,"A",{href:!0,rel:!0});var p_=l(Jn);tu=a(p_,"here"),p_.forEach(t),su=a(Bs,". A conversion of this script that works with HuggingFace\u2019s implementation can be found "),Un=n(Bs,"A",{href:!0,rel:!0});var h_=l(Un);au=a(h_,"here"),h_.forEach(t),ou=a(Bs,". Interestingly, these conversion scripts are not perfect (the "),Ci=n(Bs,"CODE",{});var u_=l(Ci);nu=a(u_,"answer_coordinates"),u_.forEach(t),lu=a(Bs," and "),Ai=n(Bs,"CODE",{});var m_=l(Ai);ru=a(m_,"float_answer"),m_.forEach(t),iu=a(Bs," fields are populated based on the "),Fi=n(Bs,"CODE",{});var f_=l(Fi);du=a(f_,"answer_text"),f_.forEach(t),cu=a(Bs,"), meaning that WTQ and WikiSQL results could actually be improved."),Bs.forEach(t),wc=h(r),nr=n(r,"P",{});var g_=l(nr);Zi=n(g_,"STRONG",{});var T_=l(Zi);pu=a(T_,"STEP 3: Convert your data into tensors using TapasTokenizer"),T_.forEach(t),g_.forEach(t),bc=h(r),j(vo.$$.fragment,r),jc=h(r),De=n(r,"P",{});var mt=l(De);hu=a(mt,"Note that here, we encode each table-question pair independently. This is fine as long as your dataset is "),Bi=n(mt,"STRONG",{});var M_=l(Bi);uu=a(M_,"not conversational"),M_.forEach(t),mu=a(mt,". In case your dataset involves conversational questions (such as in SQA), then you should first group together the "),Wi=n(mt,"CODE",{});var y_=l(Wi);fu=a(y_,"queries"),y_.forEach(t),gu=a(mt,", "),zi=n(mt,"CODE",{});var __=l(zi);Tu=a(__,"answer_coordinates"),__.forEach(t),Mu=a(mt," and "),qi=n(mt,"CODE",{});var w_=l(qi);yu=a(w_,"answer_text"),w_.forEach(t),_u=a(mt," per table (in the order of their "),$i=n(mt,"CODE",{});var b_=l($i);wu=a(b_,"position"),b_.forEach(t),bu=a(mt,`
index) and batch encode each table with its questions. This will make sure that the `),Gi=n(mt,"CODE",{});var j_=l(Gi);ju=a(j_,"prev_labels"),j_.forEach(t),vu=a(mt," token types (see docs of "),lr=n(mt,"A",{href:!0});var v_=l(lr);Ju=a(v_,"TapasTokenizer"),v_.forEach(t),Uu=a(mt,") are set correctly. See "),kn=n(mt,"A",{href:!0,rel:!0});var J_=l(kn);ku=a(J_,"this notebook"),J_.forEach(t),Iu=a(mt," for more info. See "),In=n(mt,"A",{href:!0,rel:!0});var U_=l(In);Eu=a(U_,"this notebook"),U_.forEach(t),Cu=a(mt," for more info regarding using the TensorFlow model."),mt.forEach(t),vc=h(r),rr=n(r,"P",{});var k_=l(rr);Au=a(k_,"**STEP 4: Train (fine-tune) the model"),k_.forEach(t),Jc=h(r),j(Jo.$$.fragment,r),Uc=h(r),xa=n(r,"H2",{class:!0});var cp=l(xa);Uo=n(cp,"A",{id:!0,class:!0,href:!0});var I_=l(Uo);Ni=n(I_,"SPAN",{});var E_=l(Ni);j(En.$$.fragment,E_),E_.forEach(t),I_.forEach(t),Fu=h(cp),Qi=n(cp,"SPAN",{});var C_=l(Qi);Zu=a(C_,"Usage: inference"),C_.forEach(t),cp.forEach(t),kc=h(r),j(ko.$$.fragment,r),Ic=h(r),At=n(r,"P",{});var Ws=l(At);Bu=a(Ws,"In case of a conversational set-up, then each table-question pair must be provided "),Ri=n(Ws,"STRONG",{});var A_=l(Ri);Wu=a(A_,"sequentially"),A_.forEach(t),zu=a(Ws," to the model, such that the "),Si=n(Ws,"CODE",{});var F_=l(Si);qu=a(F_,"prev_labels"),F_.forEach(t),$u=a(Ws," token types can be overwritten by the predicted "),xi=n(Ws,"CODE",{});var Z_=l(xi);Gu=a(Z_,"labels"),Z_.forEach(t),Nu=a(Ws," of the previous table-question pair. Again, more info can be found in "),Cn=n(Ws,"A",{href:!0,rel:!0});var B_=l(Cn);Qu=a(B_,"this notebook"),B_.forEach(t),Ru=a(Ws," (for PyTorch) and "),An=n(Ws,"A",{href:!0,rel:!0});var W_=l(An);Su=a(W_,"this notebook"),W_.forEach(t),xu=a(Ws," (for TensorFlow)."),Ws.forEach(t),Ec=h(r),Va=n(r,"H2",{class:!0});var pp=l(Va);Io=n(pp,"A",{id:!0,class:!0,href:!0});var z_=l(Io);Vi=n(z_,"SPAN",{});var q_=l(Vi);j(Fn.$$.fragment,q_),q_.forEach(t),z_.forEach(t),Vu=h(pp),Xi=n(pp,"SPAN",{});var $_=l(Xi);Xu=a($_,"Documentation resources"),$_.forEach(t),pp.forEach(t),Cc=h(r),Eo=n(r,"UL",{});var hp=l(Eo);Yi=n(hp,"LI",{});var G_=l(Yi);ir=n(G_,"A",{href:!0});var N_=l(ir);Yu=a(N_,"Text classification task guide"),N_.forEach(t),G_.forEach(t),Du=h(hp),Di=n(hp,"LI",{});var Q_=l(Di);dr=n(Q_,"A",{href:!0});var R_=l(dr);Hu=a(R_,"Masked language modeling task guide"),R_.forEach(t),Q_.forEach(t),hp.forEach(t),Ac=h(r),Xa=n(r,"H2",{class:!0});var up=l(Xa);Co=n(up,"A",{id:!0,class:!0,href:!0});var S_=l(Co);Hi=n(S_,"SPAN",{});var x_=l(Hi);j(Zn.$$.fragment,x_),x_.forEach(t),S_.forEach(t),Pu=h(up),Pi=n(up,"SPAN",{});var V_=l(Pi);Ou=a(V_,"TAPAS specific outputs"),V_.forEach(t),up.forEach(t),Fc=h(r),Ya=n(r,"DIV",{class:!0});var mp=l(Ya);j(Bn.$$.fragment,mp),Lu=h(mp),Wn=n(mp,"P",{});var fp=l(Wn);Ku=a(fp,"Output type of "),cr=n(fp,"A",{href:!0});var X_=l(cr);em=a(X_,"TapasForQuestionAnswering"),X_.forEach(t),tm=a(fp,"."),fp.forEach(t),mp.forEach(t),Zc=h(r),Da=n(r,"H2",{class:!0});var gp=l(Da);Ao=n(gp,"A",{id:!0,class:!0,href:!0});var Y_=l(Ao);Oi=n(Y_,"SPAN",{});var D_=l(Oi);j(zn.$$.fragment,D_),D_.forEach(t),Y_.forEach(t),sm=h(gp),Li=n(gp,"SPAN",{});var H_=l(Li);am=a(H_,"TapasConfig"),H_.forEach(t),gp.forEach(t),Bc=h(r),Lt=n(r,"DIV",{class:!0});var _a=l(Lt);j(qn.$$.fragment,_a),om=h(_a),Ha=n(_a,"P",{});var Xr=l(Ha);nm=a(Xr,"This is the configuration class to store the configuration of a "),pr=n(Xr,"A",{href:!0});var P_=l(pr);lm=a(P_,"TapasModel"),P_.forEach(t),rm=a(Xr,`. It is used to instantiate a TAPAS
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 TAPAS
`),$n=n(Xr,"A",{href:!0,rel:!0});var O_=l($n);im=a(O_,"google/tapas-base-finetuned-sqa"),O_.forEach(t),dm=a(Xr," architecture."),Xr.forEach(t),cm=h(_a),Pa=n(_a,"P",{});var Yr=l(Pa);pm=a(Yr,"Configuration objects inherit from "),Ki=n(Yr,"CODE",{});var L_=l(Ki);hm=a(L_,"PreTrainedConfig"),L_.forEach(t),um=a(Yr,` and can be used to control the model outputs. Read the
documentation from `),hr=n(Yr,"A",{href:!0});var K_=l(hr);mm=a(K_,"PretrainedConfig"),K_.forEach(t),fm=a(Yr," for more information."),Yr.forEach(t),gm=h(_a),Gn=n(_a,"P",{});var Tp=l(Gn);Tm=a(Tp,`Hyperparameters additional to BERT are taken from run_task_main.py and hparam_utils.py of the original
implementation. Original implementation available at `),Nn=n(Tp,"A",{href:!0,rel:!0});var ew=l(Nn);Mm=a(ew,"https://github.com/google-research/tapas/tree/master"),ew.forEach(t),ym=a(Tp,"."),Tp.forEach(t),_m=h(_a),j(Fo.$$.fragment,_a),_a.forEach(t),Wc=h(r),Oa=n(r,"H2",{class:!0});var Mp=l(Oa);Zo=n(Mp,"A",{id:!0,class:!0,href:!0});var tw=l(Zo);ed=n(tw,"SPAN",{});var sw=l(ed);j(Qn.$$.fragment,sw),sw.forEach(t),tw.forEach(t),wm=h(Mp),td=n(Mp,"SPAN",{});var aw=l(td);bm=a(aw,"TapasTokenizer"),aw.forEach(t),Mp.forEach(t),zc=h(r),pt=n(r,"DIV",{class:!0});var Ft=l(pt);j(Rn.$$.fragment,Ft),jm=h(Ft),sd=n(Ft,"P",{});var ow=l(sd);vm=a(ow,`Construct a TAPAS tokenizer. Based on WordPiece. Flattens a table and one or more related sentences to be used by
TAPAS models.`),ow.forEach(t),Jm=h(Ft),at=n(Ft,"P",{});var ft=l(at);Um=a(ft,"This tokenizer inherits from "),ur=n(ft,"A",{href:!0});var nw=l(ur);km=a(nw,"PreTrainedTokenizer"),nw.forEach(t),Im=a(ft,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods. `),mr=n(ft,"A",{href:!0});var lw=l(mr);Em=a(lw,"TapasTokenizer"),lw.forEach(t),Cm=a(ft,` creates several token type ids to
encode tabular structure. To be more precise, it adds 7 token type ids, in the following order: `),ad=n(ft,"CODE",{});var rw=l(ad);Am=a(rw,"segment_ids"),rw.forEach(t),Fm=a(ft,`,
`),od=n(ft,"CODE",{});var iw=l(od);Zm=a(iw,"column_ids"),iw.forEach(t),Bm=a(ft,", "),nd=n(ft,"CODE",{});var dw=l(nd);Wm=a(dw,"row_ids"),dw.forEach(t),zm=a(ft,", "),ld=n(ft,"CODE",{});var cw=l(ld);qm=a(cw,"prev_labels"),cw.forEach(t),$m=a(ft,", "),rd=n(ft,"CODE",{});var pw=l(rd);Gm=a(pw,"column_ranks"),pw.forEach(t),Nm=a(ft,", "),id=n(ft,"CODE",{});var hw=l(id);Qm=a(hw,"inv_column_ranks"),hw.forEach(t),Rm=a(ft," and "),dd=n(ft,"CODE",{});var uw=l(dd);Sm=a(uw,"numeric_relations"),uw.forEach(t),xm=a(ft,":"),ft.forEach(t),Vm=h(Ft),bt=n(Ft,"UL",{});var os=l(bt);cd=n(os,"LI",{});var mw=l(cd);Xm=a(mw,`segment_ids: indicate whether a token belongs to the question (0) or the table (1). 0 for special tokens and
padding.`),mw.forEach(t),Ym=h(os),pd=n(os,"LI",{});var fw=l(pd);Dm=a(fw,`column_ids: indicate to which column of the table a token belongs (starting from 1). Is 0 for all question
tokens, special tokens and padding.`),fw.forEach(t),Hm=h(os),hd=n(os,"LI",{});var gw=l(hd);Pm=a(gw,`row_ids: indicate to which row of the table a token belongs (starting from 1). Is 0 for all question tokens,
special tokens and padding. Tokens of column headers are also 0.`),gw.forEach(t),Om=h(os),ud=n(os,"LI",{});var Tw=l(ud);Lm=a(Tw,`prev_labels: indicate whether a token was (part of) an answer to the previous question (1) or not (0). Useful in
a conversational setup (such as SQA).`),Tw.forEach(t),Km=h(os),md=n(os,"LI",{});var Mw=l(md);ef=a(Mw,`column_ranks: indicate the rank of a table token relative to a column, if applicable. For example, if you have a
column \u201Cnumber of movies\u201D with values 87, 53 and 69, then the column ranks of these tokens are 3, 1 and 2
respectively. 0 for all question tokens, special tokens and padding.`),Mw.forEach(t),tf=h(os),fd=n(os,"LI",{});var yw=l(fd);sf=a(yw,`inv_column_ranks: indicate the inverse rank of a table token relative to a column, if applicable. For example, if
you have a column \u201Cnumber of movies\u201D with values 87, 53 and 69, then the inverse column ranks of these tokens are
1, 3 and 2 respectively. 0 for all question tokens, special tokens and padding.`),yw.forEach(t),af=h(os),gd=n(os,"LI",{});var _w=l(gd);of=a(_w,`numeric_relations: indicate numeric relations between the question and the tokens of the table. 0 for all
question tokens, special tokens and padding.`),_w.forEach(t),os.forEach(t),nf=h(Ft),fr=n(Ft,"P",{});var ay=l(fr);gr=n(ay,"A",{href:!0});var ww=l(gr);lf=a(ww,"TapasTokenizer"),ww.forEach(t),rf=a(ay,` runs end-to-end tokenization on a table and associated sentences: punctuation splitting and
wordpiece.`),ay.forEach(t),df=h(Ft),Bo=n(Ft,"DIV",{class:!0});var yp=l(Bo);j(Sn.$$.fragment,yp),cf=h(yp),Td=n(yp,"P",{});var bw=l(Td);pf=a(bw,"Main method to tokenize and prepare for the model one or several sequence(s) related to a table."),bw.forEach(t),yp.forEach(t),hf=h(Ft),ya=n(Ft,"DIV",{class:!0});var Dr=l(ya);j(xn.$$.fragment,Dr),uf=h(Dr),Vn=n(Dr,"P",{});var _p=l(Vn);mf=a(_p,"Converts logits of "),Tr=n(_p,"A",{href:!0});var jw=l(Tr);ff=a(jw,"TapasForQuestionAnswering"),jw.forEach(t),gf=a(_p,` to actual predicted answer coordinates and optional
aggregation indices.`),_p.forEach(t),Tf=h(Dr),Xn=n(Dr,"P",{});var wp=l(Xn);Mf=a(wp,`The original implementation, on which this function is based, can be found
`),Yn=n(wp,"A",{href:!0,rel:!0});var vw=l(Yn);yf=a(vw,"here"),vw.forEach(t),_f=a(wp,"."),wp.forEach(t),Dr.forEach(t),wf=h(Ft),Mr=n(Ft,"DIV",{class:!0});var Jw=l(Mr);j(Dn.$$.fragment,Jw),Jw.forEach(t),Ft.forEach(t),qc=h(r),La=n(r,"H2",{class:!0});var bp=l(La);Wo=n(bp,"A",{id:!0,class:!0,href:!0});var Uw=l(Wo);Md=n(Uw,"SPAN",{});var kw=l(Md);j(Hn.$$.fragment,kw),kw.forEach(t),Uw.forEach(t),bf=h(bp),yd=n(bp,"SPAN",{});var Iw=l(yd);jf=a(Iw,"TapasModel"),Iw.forEach(t),bp.forEach(t),$c=h(r),jt=n(r,"DIV",{class:!0});var zs=l(jt);j(Pn.$$.fragment,zs),vf=h(zs),On=n(zs,"P",{});var jp=l(On);Jf=a(jp,`The bare Tapas Model transformer outputting raw hidden-states without any specific head on top.
This model inherits from `),yr=n(jp,"A",{href:!0});var Ew=l(yr);Uf=a(Ew,"PreTrainedModel"),Ew.forEach(t),kf=a(jp,`. Check the superclass documentation for the generic methods the
library implements for all its models (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),jp.forEach(t),If=h(zs),Ln=n(zs,"P",{});var vp=l(Ln);Ef=a(vp,"This model is also a PyTorch "),Kn=n(vp,"A",{href:!0,rel:!0});var Cw=l(Kn);Cf=a(Cw,"torch.nn.Module"),Cw.forEach(t),Af=a(vp,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),vp.forEach(t),Ff=h(zs),el=n(zs,"P",{});var Jp=l(el);Zf=a(Jp,"This class is a small change compared to "),_r=n(Jp,"A",{href:!0});var Aw=l(_r);Bf=a(Aw,"BertModel"),Aw.forEach(t),Wf=a(Jp,", taking into account the additional token type ids."),Jp.forEach(t),zf=h(zs),tl=n(zs,"P",{});var Up=l(tl);qf=a(Up,`The model can behave as an encoder (with only self-attention) as well as a decoder, in which case a layer of
cross-attention is added between the self-attention layers, following the architecture described in `),sl=n(Up,"A",{href:!0,rel:!0});var Fw=l(sl);$f=a(Fw,`Attention is
all you need`),Fw.forEach(t),Gf=a(Up,` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),Up.forEach(t),Nf=h(zs),Js=n(zs,"DIV",{class:!0});var hn=l(Js);j(al.$$.fragment,hn),Qf=h(hn),Ka=n(hn,"P",{});var Hr=l(Ka);Rf=a(Hr,"The "),wr=n(Hr,"A",{href:!0});var Zw=l(wr);Sf=a(Zw,"TapasModel"),Zw.forEach(t),xf=a(Hr," forward method, overrides the "),_d=n(Hr,"CODE",{});var Bw=l(_d);Vf=a(Bw,"__call__"),Bw.forEach(t),Xf=a(Hr," special method."),Hr.forEach(t),Yf=h(hn),j(zo.$$.fragment,hn),Df=h(hn),j(qo.$$.fragment,hn),hn.forEach(t),zs.forEach(t),Gc=h(r),eo=n(r,"H2",{class:!0});var kp=l(eo);$o=n(kp,"A",{id:!0,class:!0,href:!0});var Ww=l($o);wd=n(Ww,"SPAN",{});var zw=l(wd);j(ol.$$.fragment,zw),zw.forEach(t),Ww.forEach(t),Hf=h(kp),bd=n(kp,"SPAN",{});var qw=l(bd);Pf=a(qw,"TapasForMaskedLM"),qw.forEach(t),kp.forEach(t),Nc=h(r),Ms=n(r,"DIV",{class:!0});var un=l(Ms);j(nl.$$.fragment,un),Of=h(un),to=n(un,"P",{});var Pr=l(to);Lf=a(Pr,"Tapas Model with a "),jd=n(Pr,"CODE",{});var $w=l(jd);Kf=a($w,"language modeling"),$w.forEach(t),eg=a(Pr,` head on top.
This model inherits from `),br=n(Pr,"A",{href:!0});var Gw=l(br);tg=a(Gw,"PreTrainedModel"),Gw.forEach(t),sg=a(Pr,`. Check the superclass documentation for the generic methods the
library implements for all its models (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Pr.forEach(t),ag=h(un),ll=n(un,"P",{});var Ip=l(ll);og=a(Ip,"This model is also a PyTorch "),rl=n(Ip,"A",{href:!0,rel:!0});var Nw=l(rl);ng=a(Nw,"torch.nn.Module"),Nw.forEach(t),lg=a(Ip,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ip.forEach(t),rg=h(un),Us=n(un,"DIV",{class:!0});var mn=l(Us);j(il.$$.fragment,mn),ig=h(mn),so=n(mn,"P",{});var Or=l(so);dg=a(Or,"The "),jr=n(Or,"A",{href:!0});var Qw=l(jr);cg=a(Qw,"TapasForMaskedLM"),Qw.forEach(t),pg=a(Or," forward method, overrides the "),vd=n(Or,"CODE",{});var Rw=l(vd);hg=a(Rw,"__call__"),Rw.forEach(t),ug=a(Or," special method."),Or.forEach(t),mg=h(mn),j(Go.$$.fragment,mn),fg=h(mn),j(No.$$.fragment,mn),mn.forEach(t),un.forEach(t),Qc=h(r),ao=n(r,"H2",{class:!0});var Ep=l(ao);Qo=n(Ep,"A",{id:!0,class:!0,href:!0});var Sw=l(Qo);Jd=n(Sw,"SPAN",{});var xw=l(Jd);j(dl.$$.fragment,xw),xw.forEach(t),Sw.forEach(t),gg=h(Ep),Ud=n(Ep,"SPAN",{});var Vw=l(Ud);Tg=a(Vw,"TapasForSequenceClassification"),Vw.forEach(t),Ep.forEach(t),Rc=h(r),Kt=n(r,"DIV",{class:!0});var wa=l(Kt);j(cl.$$.fragment,wa),Mg=h(wa),kd=n(wa,"P",{});var Xw=l(kd);yg=a(Xw,`Tapas Model with a sequence classification head on top (a linear layer on top of the pooled output), e.g. for table
entailment tasks, such as TabFact (Chen et al., 2020).`),Xw.forEach(t),_g=h(wa),pl=n(wa,"P",{});var Cp=l(pl);wg=a(Cp,"This model inherits from "),vr=n(Cp,"A",{href:!0});var Yw=l(vr);bg=a(Yw,"PreTrainedModel"),Yw.forEach(t),jg=a(Cp,`. Check the superclass documentation for the generic methods the
library implements for all its models (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Cp.forEach(t),vg=h(wa),hl=n(wa,"P",{});var Ap=l(hl);Jg=a(Ap,"This model is also a PyTorch "),ul=n(Ap,"A",{href:!0,rel:!0});var Dw=l(ul);Ug=a(Dw,"torch.nn.Module"),Dw.forEach(t),kg=a(Ap,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ap.forEach(t),Ig=h(wa),ks=n(wa,"DIV",{class:!0});var fn=l(ks);j(ml.$$.fragment,fn),Eg=h(fn),oo=n(fn,"P",{});var Lr=l(oo);Cg=a(Lr,"The "),Jr=n(Lr,"A",{href:!0});var Hw=l(Jr);Ag=a(Hw,"TapasForSequenceClassification"),Hw.forEach(t),Fg=a(Lr," forward method, overrides the "),Id=n(Lr,"CODE",{});var Pw=l(Id);Zg=a(Pw,"__call__"),Pw.forEach(t),Bg=a(Lr," special method."),Lr.forEach(t),Wg=h(fn),j(Ro.$$.fragment,fn),zg=h(fn),j(So.$$.fragment,fn),fn.forEach(t),wa.forEach(t),Sc=h(r),no=n(r,"H2",{class:!0});var Fp=l(no);xo=n(Fp,"A",{id:!0,class:!0,href:!0});var Ow=l(xo);Ed=n(Ow,"SPAN",{});var Lw=l(Ed);j(fl.$$.fragment,Lw),Lw.forEach(t),Ow.forEach(t),qg=h(Fp),Cd=n(Fp,"SPAN",{});var Kw=l(Cd);$g=a(Kw,"TapasForQuestionAnswering"),Kw.forEach(t),Fp.forEach(t),xc=h(r),es=n(r,"DIV",{class:!0});var ba=l(es);j(gl.$$.fragment,ba),Gg=h(ba),lo=n(ba,"P",{});var Kr=l(lo);Ng=a(Kr,`Tapas Model with a cell selection head and optional aggregation head on top for question-answering tasks on tables
(linear layers on top of the hidden-states output to compute `),Ad=n(Kr,"CODE",{});var eb=l(Ad);Qg=a(eb,"logits"),eb.forEach(t),Rg=a(Kr," and optional "),Fd=n(Kr,"CODE",{});var tb=l(Fd);Sg=a(tb,"logits_aggregation"),tb.forEach(t),xg=a(Kr,`), e.g. for
SQA, WTQ or WikiSQL-supervised tasks.`),Kr.forEach(t),Vg=h(ba),Tl=n(ba,"P",{});var Zp=l(Tl);Xg=a(Zp,"This model inherits from "),Ur=n(Zp,"A",{href:!0});var sb=l(Ur);Yg=a(sb,"PreTrainedModel"),sb.forEach(t),Dg=a(Zp,`. Check the superclass documentation for the generic methods the
library implements for all its models (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Zp.forEach(t),Hg=h(ba),Ml=n(ba,"P",{});var Bp=l(Ml);Pg=a(Bp,"This model is also a PyTorch "),yl=n(Bp,"A",{href:!0,rel:!0});var ab=l(yl);Og=a(ab,"torch.nn.Module"),ab.forEach(t),Lg=a(Bp,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Bp.forEach(t),Kg=h(ba),Is=n(ba,"DIV",{class:!0});var gn=l(Is);j(_l.$$.fragment,gn),eT=h(gn),ro=n(gn,"P",{});var ei=l(ro);tT=a(ei,"The "),kr=n(ei,"A",{href:!0});var ob=l(kr);sT=a(ob,"TapasForQuestionAnswering"),ob.forEach(t),aT=a(ei," forward method, overrides the "),Zd=n(ei,"CODE",{});var nb=l(Zd);oT=a(nb,"__call__"),nb.forEach(t),nT=a(ei," special method."),ei.forEach(t),lT=h(gn),j(Vo.$$.fragment,gn),rT=h(gn),j(Xo.$$.fragment,gn),gn.forEach(t),ba.forEach(t),Vc=h(r),io=n(r,"H2",{class:!0});var Wp=l(io);Yo=n(Wp,"A",{id:!0,class:!0,href:!0});var lb=l(Yo);Bd=n(lb,"SPAN",{});var rb=l(Bd);j(wl.$$.fragment,rb),rb.forEach(t),lb.forEach(t),iT=h(Wp),Wd=n(Wp,"SPAN",{});var ib=l(Wd);dT=a(ib,"TFTapasModel"),ib.forEach(t),Wp.forEach(t),Xc=h(r),vt=n(r,"DIV",{class:!0});var qs=l(vt);j(bl.$$.fragment,qs),cT=h(qs),zd=n(qs,"P",{});var db=l(zd);pT=a(db,"The bare Tapas Model transformer outputting raw hidden-states without any specific head on top."),db.forEach(t),hT=h(qs),jl=n(qs,"P",{});var zp=l(jl);uT=a(zp,"This model inherits from "),Ir=n(zp,"A",{href:!0});var cb=l(Ir);mT=a(cb,"TFPreTrainedModel"),cb.forEach(t),fT=a(zp,`. 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.)`),zp.forEach(t),gT=h(qs),vl=n(qs,"P",{});var qp=l(vl);TT=a(qp,"This model is also a "),Jl=n(qp,"A",{href:!0,rel:!0});var pb=l(Jl);MT=a(pb,"tf.keras.Model"),pb.forEach(t),yT=a(qp,` 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.`),qp.forEach(t),_T=h(qs),j(Do.$$.fragment,qs),wT=h(qs),Es=n(qs,"DIV",{class:!0});var Tn=l(Es);j(Ul.$$.fragment,Tn),bT=h(Tn),co=n(Tn,"P",{});var ti=l(co);jT=a(ti,"The "),Er=n(ti,"A",{href:!0});var hb=l(Er);vT=a(hb,"TFTapasModel"),hb.forEach(t),JT=a(ti," forward method, overrides the "),qd=n(ti,"CODE",{});var ub=l(qd);UT=a(ub,"__call__"),ub.forEach(t),kT=a(ti," special method."),ti.forEach(t),IT=h(Tn),j(Ho.$$.fragment,Tn),ET=h(Tn),j(Po.$$.fragment,Tn),Tn.forEach(t),qs.forEach(t),Yc=h(r),po=n(r,"H2",{class:!0});var $p=l(po);Oo=n($p,"A",{id:!0,class:!0,href:!0});var mb=l(Oo);$d=n(mb,"SPAN",{});var fb=l($d);j(kl.$$.fragment,fb),fb.forEach(t),mb.forEach(t),CT=h($p),Gd=n($p,"SPAN",{});var gb=l(Gd);AT=a(gb,"TFTapasForMaskedLM"),gb.forEach(t),$p.forEach(t),Dc=h(r),Jt=n(r,"DIV",{class:!0});var $s=l(Jt);j(Il.$$.fragment,$s),FT=h($s),El=n($s,"P",{});var Gp=l(El);ZT=a(Gp,"Tapas Model with a "),Nd=n(Gp,"CODE",{});var Tb=l(Nd);BT=a(Tb,"language modeling"),Tb.forEach(t),WT=a(Gp," head on top."),Gp.forEach(t),zT=h($s),Cl=n($s,"P",{});var Np=l(Cl);qT=a(Np,"This model inherits from "),Cr=n(Np,"A",{href:!0});var Mb=l(Cr);$T=a(Mb,"TFPreTrainedModel"),Mb.forEach(t),GT=a(Np,`. 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.)`),Np.forEach(t),NT=h($s),Al=n($s,"P",{});var Qp=l(Al);QT=a(Qp,"This model is also a "),Fl=n(Qp,"A",{href:!0,rel:!0});var yb=l(Fl);RT=a(yb,"tf.keras.Model"),yb.forEach(t),ST=a(Qp,` 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.`),Qp.forEach(t),xT=h($s),j(Lo.$$.fragment,$s),VT=h($s),Cs=n($s,"DIV",{class:!0});var Mn=l(Cs);j(Zl.$$.fragment,Mn),XT=h(Mn),ho=n(Mn,"P",{});var si=l(ho);YT=a(si,"The "),Ar=n(si,"A",{href:!0});var _b=l(Ar);DT=a(_b,"TFTapasForMaskedLM"),_b.forEach(t),HT=a(si," forward method, overrides the "),Qd=n(si,"CODE",{});var wb=l(Qd);PT=a(wb,"__call__"),wb.forEach(t),OT=a(si," special method."),si.forEach(t),LT=h(Mn),j(Ko.$$.fragment,Mn),KT=h(Mn),j(en.$$.fragment,Mn),Mn.forEach(t),$s.forEach(t),Hc=h(r),uo=n(r,"H2",{class:!0});var Rp=l(uo);tn=n(Rp,"A",{id:!0,class:!0,href:!0});var bb=l(tn);Rd=n(bb,"SPAN",{});var jb=l(Rd);j(Bl.$$.fragment,jb),jb.forEach(t),bb.forEach(t),eM=h(Rp),Sd=n(Rp,"SPAN",{});var vb=l(Sd);tM=a(vb,"TFTapasForSequenceClassification"),vb.forEach(t),Rp.forEach(t),Pc=h(r),Ut=n(r,"DIV",{class:!0});var Gs=l(Ut);j(Wl.$$.fragment,Gs),sM=h(Gs),xd=n(Gs,"P",{});var Jb=l(xd);aM=a(Jb,`Tapas Model with a sequence classification head on top (a linear layer on top of the pooled output), e.g. for table
entailment tasks, such as TabFact (Chen et al., 2020).`),Jb.forEach(t),oM=h(Gs),zl=n(Gs,"P",{});var Sp=l(zl);nM=a(Sp,"This model inherits from "),Fr=n(Sp,"A",{href:!0});var Ub=l(Fr);lM=a(Ub,"TFPreTrainedModel"),Ub.forEach(t),rM=a(Sp,`. 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.)`),Sp.forEach(t),iM=h(Gs),ql=n(Gs,"P",{});var xp=l(ql);dM=a(xp,"This model is also a "),$l=n(xp,"A",{href:!0,rel:!0});var kb=l($l);cM=a(kb,"tf.keras.Model"),kb.forEach(t),pM=a(xp,` 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.`),xp.forEach(t),hM=h(Gs),j(sn.$$.fragment,Gs),uM=h(Gs),As=n(Gs,"DIV",{class:!0});var yn=l(As);j(Gl.$$.fragment,yn),mM=h(yn),mo=n(yn,"P",{});var ai=l(mo);fM=a(ai,"The "),Zr=n(ai,"A",{href:!0});var Ib=l(Zr);gM=a(Ib,"TFTapasForSequenceClassification"),Ib.forEach(t),TM=a(ai," forward method, overrides the "),Vd=n(ai,"CODE",{});var Eb=l(Vd);MM=a(Eb,"__call__"),Eb.forEach(t),yM=a(ai," special method."),ai.forEach(t),_M=h(yn),j(an.$$.fragment,yn),wM=h(yn),j(on.$$.fragment,yn),yn.forEach(t),Gs.forEach(t),Oc=h(r),fo=n(r,"H2",{class:!0});var Vp=l(fo);nn=n(Vp,"A",{id:!0,class:!0,href:!0});var Cb=l(nn);Xd=n(Cb,"SPAN",{});var Ab=l(Xd);j(Nl.$$.fragment,Ab),Ab.forEach(t),Cb.forEach(t),bM=h(Vp),Yd=n(Vp,"SPAN",{});var Fb=l(Yd);jM=a(Fb,"TFTapasForQuestionAnswering"),Fb.forEach(t),Vp.forEach(t),Lc=h(r),kt=n(r,"DIV",{class:!0});var Ns=l(kt);j(Ql.$$.fragment,Ns),vM=h(Ns),go=n(Ns,"P",{});var oi=l(go);JM=a(oi,`Tapas Model with a cell selection head and optional aggregation head on top for question-answering tasks on tables
(linear layers on top of the hidden-states output to compute `),Dd=n(oi,"CODE",{});var Zb=l(Dd);UM=a(Zb,"logits"),Zb.forEach(t),kM=a(oi," and optional "),Hd=n(oi,"CODE",{});var Bb=l(Hd);IM=a(Bb,"logits_aggregation"),Bb.forEach(t),EM=a(oi,`), e.g. for
SQA, WTQ or WikiSQL-supervised tasks.`),oi.forEach(t),CM=h(Ns),Rl=n(Ns,"P",{});var Xp=l(Rl);AM=a(Xp,"This model inherits from "),Br=n(Xp,"A",{href:!0});var Wb=l(Br);FM=a(Wb,"TFPreTrainedModel"),Wb.forEach(t),ZM=a(Xp,`. 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.)`),Xp.forEach(t),BM=h(Ns),Sl=n(Ns,"P",{});var Yp=l(Sl);WM=a(Yp,"This model is also a "),xl=n(Yp,"A",{href:!0,rel:!0});var zb=l(xl);zM=a(zb,"tf.keras.Model"),zb.forEach(t),qM=a(Yp,` 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.`),Yp.forEach(t),$M=h(Ns),j(ln.$$.fragment,Ns),GM=h(Ns),Fs=n(Ns,"DIV",{class:!0});var _n=l(Fs);j(Vl.$$.fragment,_n),NM=h(_n),To=n(_n,"P",{});var ni=l(To);QM=a(ni,"The "),Wr=n(ni,"A",{href:!0});var qb=l(Wr);RM=a(qb,"TFTapasForQuestionAnswering"),qb.forEach(t),SM=a(ni," forward method, overrides the "),Pd=n(ni,"CODE",{});var $b=l(Pd);xM=a($b,"__call__"),$b.forEach(t),VM=a(ni," special method."),ni.forEach(t),XM=h(_n),j(rn.$$.fragment,_n),YM=h(_n),j(dn.$$.fragment,_n),_n.forEach(t),Ns.forEach(t),this.h()},h(){m(i,"name","hf:doc:metadata"),m(i,"content",JSON.stringify(Ej)),m(f,"id","tapas"),m(f,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(f,"href","#tapas"),m(d,"class","relative group"),m(Y,"id","overview"),m(Y,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Y,"href","#overview"),m($,"class","relative group"),m(R,"href","https://www.aclweb.org/anthology/2020.acl-main.398"),m(R,"rel","nofollow"),m(q,"href","https://www.microsoft.com/en-us/download/details.aspx?id=54253"),m(q,"rel","nofollow"),m(V,"href","https://github.com/ppasupat/WikiTableQuestions"),m(V,"rel","nofollow"),m(Ee,"href","https://github.com/salesforce/WikiSQL"),m(Ee,"rel","nofollow"),m(_,"href","https://github.com/wenhuchen/Table-Fact-Checking"),m(_,"rel","nofollow"),m(ye,"href","https://www.aclweb.org/anthology/2020.findings-emnlp.27/"),m(ye,"rel","nofollow"),Sb(Ge.src,ot="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/tapas_architecture.png")||m(Ge,"src",ot),m(Ge,"alt","drawing"),m(Ge,"width","600"),m(de,"href","https://ai.googleblog.com/2020/04/using-neural-networks-to-find-answers.html"),m(Ve,"href","https://huggingface.co/nielsr"),m(Ve,"rel","nofollow"),m(Ie,"href","https://huggingface.co/kamalkraj"),m(Ie,"rel","nofollow"),m(Wt,"href","https://github.com/google-research/tapas"),m(Wt,"rel","nofollow"),m(ss,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasConfig"),m(Qt,"href","https://huggingface.co/models?search=tapas"),m(Qt,"rel","nofollow"),m(Yt,"href","https://github.com/google-research/tapas%3E"),m(Yt,"rel","nofollow"),m(Tt,"id","usage-finetuning"),m(Tt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Tt,"href","#usage-finetuning"),m(Pt,"class","relative group"),m(ws,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering"),m(js,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering"),m(bn,"href","https://github.com/google-research/tapas/issues/91#issuecomment-735719340"),m(bn,"rel","nofollow"),m(jn,"href","https://huggingface.co/models?search=tapas"),m(jn,"rel","nofollow"),m(vn,"href","https://www.microsoft.com/en-us/download/details.aspx?id=54253"),m(vn,"rel","nofollow"),m(Jn,"href","https://github.com/google-research/tapas/issues/50#issuecomment-705465960"),m(Jn,"rel","nofollow"),m(Un,"href","https://github.com/NielsRogge/tapas_utils"),m(Un,"rel","nofollow"),m(lr,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasTokenizer"),m(kn,"href","https://github.com/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb"),m(kn,"rel","nofollow"),m(In,"href","https://github.com/kamalkraj/Tapas-Tutorial/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb"),m(In,"rel","nofollow"),m(Uo,"id","usage-inference"),m(Uo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Uo,"href","#usage-inference"),m(xa,"class","relative group"),m(Cn,"href","https://github.com/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb"),m(Cn,"rel","nofollow"),m(An,"href","https://github.com/kamalkraj/Tapas-Tutorial/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb"),m(An,"rel","nofollow"),m(Io,"id","documentation-resources"),m(Io,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Io,"href","#documentation-resources"),m(Va,"class","relative group"),m(ir,"href","../tasks/sequence_classification"),m(dr,"href","../tasks/masked_language_modeling"),m(Co,"id","transformers.models.tapas.modeling_tapas.TableQuestionAnsweringOutput"),m(Co,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Co,"href","#transformers.models.tapas.modeling_tapas.TableQuestionAnsweringOutput"),m(Xa,"class","relative group"),m(cr,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering"),m(Ya,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ao,"id","transformers.TapasConfig"),m(Ao,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Ao,"href","#transformers.TapasConfig"),m(Da,"class","relative group"),m(pr,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasModel"),m($n,"href","https://huggingface.co/google/tapas-base-finetuned-sqa"),m($n,"rel","nofollow"),m(hr,"href","/docs/transformers/v4.30.0/en/main_classes/configuration#transformers.PretrainedConfig"),m(Nn,"href","https://github.com/google-research/tapas/tree/master"),m(Nn,"rel","nofollow"),m(Lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Zo,"id","transformers.TapasTokenizer"),m(Zo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Zo,"href","#transformers.TapasTokenizer"),m(Oa,"class","relative group"),m(ur,"href","/docs/transformers/v4.30.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),m(mr,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasTokenizer"),m(gr,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasTokenizer"),m(Bo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Tr,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering"),m(Yn,"href","https://github.com/google-research/tapas/blob/4908213eb4df7aa988573350278b44c4dbe3f71b/tapas/experiments/prediction_utils.py#L288"),m(Yn,"rel","nofollow"),m(ya,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Mr,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Wo,"id","transformers.TapasModel"),m(Wo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Wo,"href","#transformers.TapasModel"),m(La,"class","relative group"),m(yr,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel"),m(Kn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(Kn,"rel","nofollow"),m(_r,"href","/docs/transformers/v4.30.0/en/model_doc/bert#transformers.BertModel"),m(sl,"href","https://arxiv.org/abs/1706.03762"),m(sl,"rel","nofollow"),m(wr,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasModel"),m(Js,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(jt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m($o,"id","transformers.TapasForMaskedLM"),m($o,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m($o,"href","#transformers.TapasForMaskedLM"),m(eo,"class","relative group"),m(br,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel"),m(rl,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(rl,"rel","nofollow"),m(jr,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasForMaskedLM"),m(Us,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ms,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Qo,"id","transformers.TapasForSequenceClassification"),m(Qo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Qo,"href","#transformers.TapasForSequenceClassification"),m(ao,"class","relative group"),m(vr,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel"),m(ul,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(ul,"rel","nofollow"),m(Jr,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasForSequenceClassification"),m(ks,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Kt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(xo,"id","transformers.TapasForQuestionAnswering"),m(xo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(xo,"href","#transformers.TapasForQuestionAnswering"),m(no,"class","relative group"),m(Ur,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.PreTrainedModel"),m(yl,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(yl,"rel","nofollow"),m(kr,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering"),m(Is,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(es,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Yo,"id","transformers.TFTapasModel"),m(Yo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Yo,"href","#transformers.TFTapasModel"),m(io,"class","relative group"),m(Ir,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(Jl,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(Jl,"rel","nofollow"),m(Er,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TFTapasModel"),m(Es,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(vt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Oo,"id","transformers.TFTapasForMaskedLM"),m(Oo,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Oo,"href","#transformers.TFTapasForMaskedLM"),m(po,"class","relative group"),m(Cr,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(Fl,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(Fl,"rel","nofollow"),m(Ar,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TFTapasForMaskedLM"),m(Cs,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Jt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(tn,"id","transformers.TFTapasForSequenceClassification"),m(tn,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(tn,"href","#transformers.TFTapasForSequenceClassification"),m(uo,"class","relative group"),m(Fr,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.TFPreTrainedModel"),m($l,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m($l,"rel","nofollow"),m(Zr,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TFTapasForSequenceClassification"),m(As,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ut,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(nn,"id","transformers.TFTapasForQuestionAnswering"),m(nn,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(nn,"href","#transformers.TFTapasForQuestionAnswering"),m(fo,"class","relative group"),m(Br,"href","/docs/transformers/v4.30.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(xl,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(xl,"rel","nofollow"),m(Wr,"href","/docs/transformers/v4.30.0/en/model_doc/tapas#transformers.TFTapasForQuestionAnswering"),m(Fs,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(kt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(r,T){e(document.head,i),u(r,M,T),u(r,d,T),e(d,f),e(f,y),v(c,y,null),e(d,g),e(d,I),e(I,E),u(r,S,T),u(r,$,T),e($,Y),e(Y,ae),v(w,ae,null),e($,X),e($,L),e(L,W),u(r,x,T),u(r,z,T),e(z,F),e(z,R),e(R,P),e(z,ie),u(r,me,T),u(r,K,T),e(K,ge),u(r,pe,T),u(r,ee,T),e(ee,Te),e(Te,q),e(q,G),e(Te,Q),e(ee,Z),e(ee,D),e(D,V),e(V,we),e(D,Ce),e(ee,he),e(ee,fe),e(fe,Ee),e(Ee,se),e(fe,je),u(r,Me,T),u(r,Ze,T),e(Ze,Fe),u(r,ve,T),u(r,Be,T),e(Be,Ue),u(r,ce,T),u(r,We,T),e(We,be),e(be,O),u(r,Je,T),u(r,H,T),e(H,Re),e(H,oe),e(oe,Se),e(H,xe),e(H,_),e(_,B),e(H,He),e(H,ye),e(ye,Pe),e(H,Oe),u(r,N,T),u(r,Ge,T),u(r,Ne,T),u(r,Qe,T),e(Qe,Le),e(Qe,de),e(de,ke),e(Qe,Ke),u(r,Ae,T),u(r,ne,T),e(ne,et),e(ne,Ve),e(Ve,le),e(ne,Xe),e(ne,Ie),e(Ie,tt),e(ne,Bt),e(ne,Wt),e(Wt,Rs),e(ne,zt),u(r,ys,T),u(r,ts,T),e(ts,qt),u(r,_s,T),u(r,ut,T),e(ut,ze),e(ze,Ss),e(ze,$t),e($t,re),e(ze,yt),e(ze,ss),e(ss,xs),e(ze,Gt),e(ze,ns),e(ns,Vs),e(ze,Nt),e(ze,Qt),e(Qt,Xs),e(ze,Rt),e(ze,ls),e(ls,Ys),e(ze,St),e(ze,rs),e(rs,Ds),e(ze,xt),e(ut,Hs),e(ut,st),e(st,Vt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,pt,T),v(Rn,pt,null),e(pt,jm),e(pt,sd),e(sd,vm),e(pt,Jm),e(pt,at),e(at,Um),e(at,ur),e(ur,km),e(at,Im),e(at,mr),e(mr,Em),e(at,Cm),e(at,ad),e(ad,Am),e(at,Fm),e(at,od),e(od,Zm),e(at,Bm),e(at,nd),e(nd,Wm),e(at,zm),e(at,ld),e(ld,qm),e(at,$m),e(at,rd),e(rd,Gm),e(at,Nm),e(at,id),e(id,Qm),e(at,Rm),e(at,dd),e(dd,Sm),e(at,xm),e(pt,Vm),e(pt,bt),e(bt,cd),e(cd,Xm),e(bt,Ym),e(bt,pd),e(pd,Dm),e(bt,Hm),e(bt,hd),e(hd,Pm),e(bt,Om),e(bt,ud),e(ud,Lm),e(bt,Km),e(bt,md),e(md,ef),e(bt,tf),e(bt,fd),e(fd,sf),e(bt,af),e(bt,gd),e(gd,of),e(pt,nf),e(pt,fr),e(fr,gr),e(gr,lf),e(fr,rf),e(pt,df),e(pt,Bo),v(Sn,Bo,null),e(Bo,cf),e(Bo,Td),e(Td,pf),e(pt,hf),e(pt,ya),v(xn,ya,null),e(ya,uf),e(ya,Vn),e(Vn,mf),e(Vn,Tr),e(Tr,ff),e(Vn,gf),e(ya,Tf),e(ya,Xn),e(Xn,Mf),e(Xn,Yn),e(Yn,yf),e(Xn,_f),e(pt,wf),e(pt,Mr),v(Dn,Mr,null),u(r,qc,T),u(r,La,T),e(La,Wo),e(Wo,Md),v(Hn,Md,null),e(La,bf),e(La,yd),e(yd,jf),u(r,$c,T),u(r,jt,T),v(Pn,jt,null),e(jt,vf),e(jt,On),e(On,Jf),e(On,yr),e(yr,Uf),e(On,kf),e(jt,If),e(jt,Ln),e(Ln,Ef),e(Ln,Kn),e(Kn,Cf),e(Ln,Af),e(jt,Ff),e(jt,el),e(el,Zf),e(el,_r),e(_r,Bf),e(el,Wf),e(jt,zf),e(jt,tl),e(tl,qf),e(tl,sl),e(sl,$f),e(tl,Gf),e(jt,Nf),e(jt,Js),v(al,Js,null),e(Js,Qf),e(Js,Ka),e(Ka,Rf),e(Ka,wr),e(wr,Sf),e(Ka,xf),e(Ka,_d),e(_d,Vf),e(Ka,Xf),e(Js,Yf),v(zo,Js,null),e(Js,Df),v(qo,Js,null),u(r,Gc,T),u(r,eo,T),e(eo,$o),e($o,wd),v(ol,wd,null),e(eo,Hf),e(eo,bd),e(bd,Pf),u(r,Nc,T),u(r,Ms,T),v(nl,Ms,null),e(Ms,Of),e(Ms,to),e(to,Lf),e(to,jd),e(jd,Kf),e(to,eg),e(to,br),e(br,tg),e(to,sg),e(Ms,ag),e(Ms,ll),e(ll,og),e(ll,rl),e(rl,ng),e(ll,lg),e(Ms,rg),e(Ms,Us),v(il,Us,null),e(Us,ig),e(Us,so),e(so,dg),e(so,jr),e(jr,cg),e(so,pg),e(so,vd),e(vd,hg),e(so,ug),e(Us,mg),v(Go,Us,null),e(Us,fg),v(No,Us,null),u(r,Qc,T),u(r,ao,T),e(ao,Qo),e(Qo,Jd),v(dl,Jd,null),e(ao,gg),e(ao,Ud),e(Ud,Tg),u(r,Rc,T),u(r,Kt,T),v(cl,Kt,null),e(Kt,Mg),e(Kt,kd),e(kd,yg),e(Kt,_g),e(Kt,pl),e(pl,wg),e(pl,vr),e(vr,bg),e(pl,jg),e(Kt,vg),e(Kt,hl),e(hl,Jg),e(hl,ul),e(ul,Ug),e(hl,kg),e(Kt,Ig),e(Kt,ks),v(ml,ks,null),e(ks,Eg),e(ks,oo),e(oo,Cg),e(oo,Jr),e(Jr,Ag),e(oo,Fg),e(oo,Id),e(Id,Zg),e(oo,Bg),e(ks,Wg),v(Ro,ks,null),e(ks,zg),v(So,ks,null),u(r,Sc,T),u(r,no,T),e(no,xo),e(xo,Ed),v(fl,Ed,null),e(no,qg),e(no,Cd),e(Cd,$g),u(r,xc,T),u(r,es,T),v(gl,es,null),e(es,Gg),e(es,lo),e(lo,Ng),e(lo,Ad),e(Ad,Qg),e(lo,Rg),e(lo,Fd),e(Fd,Sg),e(lo,xg),e(es,Vg),e(es,Tl),e(Tl,Xg),e(Tl,Ur),e(Ur,Yg),e(Tl,Dg),e(es,Hg),e(es,Ml),e(Ml,Pg),e(Ml,yl),e(yl,Og),e(Ml,Lg),e(es,Kg),e(es,Is),v(_l,Is,null),e(Is,eT),e(Is,ro),e(ro,tT),e(ro,kr),e(kr,sT),e(ro,aT),e(ro,Zd),e(Zd,oT),e(ro,nT),e(Is,lT),v(Vo,Is,null),e(Is,rT),v(Xo,Is,null),u(r,Vc,T),u(r,io,T),e(io,Yo),e(Yo,Bd),v(wl,Bd,null),e(io,iT),e(io,Wd),e(Wd,dT),u(r,Xc,T),u(r,vt,T),v(bl,vt,null),e(vt,cT),e(vt,zd),e(zd,pT),e(vt,hT),e(vt,jl),e(jl,uT),e(jl,Ir),e(Ir,mT),e(jl,fT),e(vt,gT),e(vt,vl),e(vl,TT),e(vl,Jl),e(Jl,MT),e(vl,yT),e(vt,_T),v(Do,vt,null),e(vt,wT),e(vt,Es),v(Ul,Es,null),e(Es,bT),e(Es,co),e(co,jT),e(co,Er),e(Er,vT),e(co,JT),e(co,qd),e(qd,UT),e(co,kT),e(Es,IT),v(Ho,Es,null),e(Es,ET),v(Po,Es,null),u(r,Yc,T),u(r,po,T),e(po,Oo),e(Oo,$d),v(kl,$d,null),e(po,CT),e(po,Gd),e(Gd,AT),u(r,Dc,T),u(r,Jt,T),v(Il,Jt,null),e(Jt,FT),e(Jt,El),e(El,ZT),e(El,Nd),e(Nd,BT),e(El,WT),e(Jt,zT),e(Jt,Cl),e(Cl,qT),e(Cl,Cr),e(Cr,$T),e(Cl,GT),e(Jt,NT),e(Jt,Al),e(Al,QT),e(Al,Fl),e(Fl,RT),e(Al,ST),e(Jt,xT),v(Lo,Jt,null),e(Jt,VT),e(Jt,Cs),v(Zl,Cs,null),e(Cs,XT),e(Cs,ho),e(ho,YT),e(ho,Ar),e(Ar,DT),e(ho,HT),e(ho,Qd),e(Qd,PT),e(ho,OT),e(Cs,LT),v(Ko,Cs,null),e(Cs,KT),v(en,Cs,null),u(r,Hc,T),u(r,uo,T),e(uo,tn),e(tn,Rd),v(Bl,Rd,null),e(uo,eM),e(uo,Sd),e(Sd,tM),u(r,Pc,T),u(r,Ut,T),v(Wl,Ut,null),e(Ut,sM),e(Ut,xd),e(xd,aM),e(Ut,oM),e(Ut,zl),e(zl,nM),e(zl,Fr),e(Fr,lM),e(zl,rM),e(Ut,iM),e(Ut,ql),e(ql,dM),e(ql,$l),e($l,cM),e(ql,pM),e(Ut,hM),v(sn,Ut,null),e(Ut,uM),e(Ut,As),v(Gl,As,null),e(As,mM),e(As,mo),e(mo,fM),e(mo,Zr),e(Zr,gM),e(mo,TM),e(mo,Vd),e(Vd,MM),e(mo,yM),e(As,_M),v(an,As,null),e(As,wM),v(on,As,null),u(r,Oc,T),u(r,fo,T),e(fo,nn),e(nn,Xd),v(Nl,Xd,null),e(fo,bM),e(fo,Yd),e(Yd,jM),u(r,Lc,T),u(r,kt,T),v(Ql,kt,null),e(kt,vM),e(kt,go),e(go,JM),e(go,Dd),e(Dd,UM),e(go,kM),e(go,Hd),e(Hd,IM),e(go,EM),e(kt,CM),e(kt,Rl),e(Rl,AM),e(Rl,Br),e(Br,FM),e(Rl,ZM),e(kt,BM),e(kt,Sl),e(Sl,WM),e(Sl,xl),e(xl,zM),e(Sl,qM),e(kt,$M),v(ln,kt,null),e(kt,GM),e(kt,Fs),v(Vl,Fs,null),e(Fs,NM),e(Fs,To),e(To,QM),e(To,Wr),e(Wr,RM),e(To,SM),e(To,Pd),e(Pd,xM),e(To,VM),e(Fs,XM),v(rn,Fs,null),e(Fs,YM),v(dn,Fs,null),Kc=!0},p(r,[T]){const Xl={};T&2&&(Xl.$$scope={dirty:T,ctx:r}),_o.$set(Xl);const Od={};T&2&&(Od.$$scope={dirty:T,ctx:r}),vo.$set(Od);const Ld={};T&2&&(Ld.$$scope={dirty:T,ctx:r}),Jo.$set(Ld);const Kd={};T&2&&(Kd.$$scope={dirty:T,ctx:r}),ko.$set(Kd);const Yl={};T&2&&(Yl.$$scope={dirty:T,ctx:r}),Fo.$set(Yl);const ec={};T&2&&(ec.$$scope={dirty:T,ctx:r}),zo.$set(ec);const tc={};T&2&&(tc.$$scope={dirty:T,ctx:r}),qo.$set(tc);const sc={};T&2&&(sc.$$scope={dirty:T,ctx:r}),Go.$set(sc);const Dl={};T&2&&(Dl.$$scope={dirty:T,ctx:r}),No.$set(Dl);const ac={};T&2&&(ac.$$scope={dirty:T,ctx:r}),Ro.$set(ac);const oc={};T&2&&(oc.$$scope={dirty:T,ctx:r}),So.$set(oc);const Mo={};T&2&&(Mo.$$scope={dirty:T,ctx:r}),Vo.$set(Mo);const zr={};T&2&&(zr.$$scope={dirty:T,ctx:r}),Xo.$set(zr);const nc={};T&2&&(nc.$$scope={dirty:T,ctx:r}),Do.$set(nc);const qr={};T&2&&(qr.$$scope={dirty:T,ctx:r}),Ho.$set(qr);const lc={};T&2&&(lc.$$scope={dirty:T,ctx:r}),Po.$set(lc);const $r={};T&2&&($r.$$scope={dirty:T,ctx:r}),Lo.$set($r);const rc={};T&2&&(rc.$$scope={dirty:T,ctx:r}),Ko.$set(rc);const ic={};T&2&&(ic.$$scope={dirty:T,ctx:r}),en.$set(ic);const dc={};T&2&&(dc.$$scope={dirty:T,ctx:r}),sn.$set(dc);const cc={};T&2&&(cc.$$scope={dirty:T,ctx:r}),an.$set(cc);const pc={};T&2&&(pc.$$scope={dirty:T,ctx:r}),on.$set(pc);const pa={};T&2&&(pa.$$scope={dirty:T,ctx:r}),ln.$set(pa);const hc={};T&2&&(hc.$$scope={dirty:T,ctx:r}),rn.$set(hc);const uc={};T&2&&(uc.$$scope={dirty:T,ctx:r}),dn.$set(uc)},i(r){Kc||(J(c.$$.fragment,r),J(w.$$.fragment,r),J(wt.$$.fragment,r),J(_o.$$.fragment,r),J(vo.$$.fragment,r),J(Jo.$$.fragment,r),J(En.$$.fragment,r),J(ko.$$.fragment,r),J(Fn.$$.fragment,r),J(Zn.$$.fragment,r),J(Bn.$$.fragment,r),J(zn.$$.fragment,r),J(qn.$$.fragment,r),J(Fo.$$.fragment,r),J(Qn.$$.fragment,r),J(Rn.$$.fragment,r),J(Sn.$$.fragment,r),J(xn.$$.fragment,r),J(Dn.$$.fragment,r),J(Hn.$$.fragment,r),J(Pn.$$.fragment,r),J(al.$$.fragment,r),J(zo.$$.fragment,r),J(qo.$$.fragment,r),J(ol.$$.fragment,r),J(nl.$$.fragment,r),J(il.$$.fragment,r),J(Go.$$.fragment,r),J(No.$$.fragment,r),J(dl.$$.fragment,r),J(cl.$$.fragment,r),J(ml.$$.fragment,r),J(Ro.$$.fragment,r),J(So.$$.fragment,r),J(fl.$$.fragment,r),J(gl.$$.fragment,r),J(_l.$$.fragment,r),J(Vo.$$.fragment,r),J(Xo.$$.fragment,r),J(wl.$$.fragment,r),J(bl.$$.fragment,r),J(Do.$$.fragment,r),J(Ul.$$.fragment,r),J(Ho.$$.fragment,r),J(Po.$$.fragment,r),J(kl.$$.fragment,r),J(Il.$$.fragment,r),J(Lo.$$.fragment,r),J(Zl.$$.fragment,r),J(Ko.$$.fragment,r),J(en.$$.fragment,r),J(Bl.$$.fragment,r),J(Wl.$$.fragment,r),J(sn.$$.fragment,r),J(Gl.$$.fragment,r),J(an.$$.fragment,r),J(on.$$.fragment,r),J(Nl.$$.fragment,r),J(Ql.$$.fragment,r),J(ln.$$.fragment,r),J(Vl.$$.fragment,r),J(rn.$$.fragment,r),J(dn.$$.fragment,r),Kc=!0)},o(r){U(c.$$.fragment,r),U(w.$$.fragment,r),U(wt.$$.fragment,r),U(_o.$$.fragment,r),U(vo.$$.fragment,r),U(Jo.$$.fragment,r),U(En.$$.fragment,r),U(ko.$$.fragment,r),U(Fn.$$.fragment,r),U(Zn.$$.fragment,r),U(Bn.$$.fragment,r),U(zn.$$.fragment,r),U(qn.$$.fragment,r),U(Fo.$$.fragment,r),U(Qn.$$.fragment,r),U(Rn.$$.fragment,r),U(Sn.$$.fragment,r),U(xn.$$.fragment,r),U(Dn.$$.fragment,r),U(Hn.$$.fragment,r),U(Pn.$$.fragment,r),U(al.$$.fragment,r),U(zo.$$.fragment,r),U(qo.$$.fragment,r),U(ol.$$.fragment,r),U(nl.$$.fragment,r),U(il.$$.fragment,r),U(Go.$$.fragment,r),U(No.$$.fragment,r),U(dl.$$.fragment,r),U(cl.$$.fragment,r),U(ml.$$.fragment,r),U(Ro.$$.fragment,r),U(So.$$.fragment,r),U(fl.$$.fragment,r),U(gl.$$.fragment,r),U(_l.$$.fragment,r),U(Vo.$$.fragment,r),U(Xo.$$.fragment,r),U(wl.$$.fragment,r),U(bl.$$.fragment,r),U(Do.$$.fragment,r),U(Ul.$$.fragment,r),U(Ho.$$.fragment,r),U(Po.$$.fragment,r),U(kl.$$.fragment,r),U(Il.$$.fragment,r),U(Lo.$$.fragment,r),U(Zl.$$.fragment,r),U(Ko.$$.fragment,r),U(en.$$.fragment,r),U(Bl.$$.fragment,r),U(Wl.$$.fragment,r),U(sn.$$.fragment,r),U(Gl.$$.fragment,r),U(an.$$.fragment,r),U(on.$$.fragment,r),U(Nl.$$.fragment,r),U(Ql.$$.fragment,r),U(ln.$$.fragment,r),U(Vl.$$.fragment,r),U(rn.$$.fragment,r),U(dn.$$.fragment,r),Kc=!1},d(r){t(i),r&&t(M),r&&t(d),k(c),r&&t(S),r&&t($),k(w),r&&t(x),r&&t(z),r&&t(me),r&&t(K),r&&t(pe),r&&t(ee),r&&t(Me),r&&t(Ze),r&&t(ve),r&&t(Be),r&&t(ce),r&&t(We),r&&t(Je),r&&t(H),r&&t(N),r&&t(Ge),r&&t(Ne),r&&t(Qe),r&&t(Ae),r&&t(ne),r&&t(ys),r&&t(ts),r&&t(_s),r&&t(ut),r&&t(ha),r&&t(Pt),k(wt),r&&t(ua),r&&t(nt),r&&t(ma),r&&t(bs),r&&t(fa),r&&t(_e),r&&t(ga),r&&t(Et),r&&t(Ta),r&&t(vs),r&&t(Ma),r&&t(Ye),r&&t(mc),k(_o,r),r&&t(fc),r&&t(wo),r&&t(gc),r&&t(bo),r&&t(Tc),r&&t(Hl),r&&t(Mc),r&&t(jo),r&&t(yc),r&&t(lt),r&&t(_c),r&&t(Ct),r&&t(wc),r&&t(nr),r&&t(bc),k(vo,r),r&&t(jc),r&&t(De),r&&t(vc),r&&t(rr),r&&t(Jc),k(Jo,r),r&&t(Uc),r&&t(xa),k(En),r&&t(kc),k(ko,r),r&&t(Ic),r&&t(At),r&&t(Ec),r&&t(Va),k(Fn),r&&t(Cc),r&&t(Eo),r&&t(Ac),r&&t(Xa),k(Zn),r&&t(Fc),r&&t(Ya),k(Bn),r&&t(Zc),r&&t(Da),k(zn),r&&t(Bc),r&&t(Lt),k(qn),k(Fo),r&&t(Wc),r&&t(Oa),k(Qn),r&&t(zc),r&&t(pt),k(Rn),k(Sn),k(xn),k(Dn),r&&t(qc),r&&t(La),k(Hn),r&&t($c),r&&t(jt),k(Pn),k(al),k(zo),k(qo),r&&t(Gc),r&&t(eo),k(ol),r&&t(Nc),r&&t(Ms),k(nl),k(il),k(Go),k(No),r&&t(Qc),r&&t(ao),k(dl),r&&t(Rc),r&&t(Kt),k(cl),k(ml),k(Ro),k(So),r&&t(Sc),r&&t(no),k(fl),r&&t(xc),r&&t(es),k(gl),k(_l),k(Vo),k(Xo),r&&t(Vc),r&&t(io),k(wl),r&&t(Xc),r&&t(vt),k(bl),k(Do),k(Ul),k(Ho),k(Po),r&&t(Yc),r&&t(po),k(kl),r&&t(Dc),r&&t(Jt),k(Il),k(Lo),k(Zl),k(Ko),k(en),r&&t(Hc),r&&t(uo),k(Bl),r&&t(Pc),r&&t(Ut),k(Wl),k(sn),k(Gl),k(an),k(on),r&&t(Oc),r&&t(fo),k(Nl),r&&t(Lc),r&&t(kt),k(Ql),k(ln),k(Vl),k(rn),k(dn)}}}const Ej={local:"tapas",sections:[{local:"overview",title:"Overview"},{local:"usage-finetuning",title:"Usage: fine-tuning"},{local:"usage-inference",title:"Usage: inference"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.models.tapas.modeling_tapas.TableQuestionAnsweringOutput",title:"TAPAS specific outputs"},{local:"transformers.TapasConfig",title:"TapasConfig"},{local:"transformers.TapasTokenizer",title:"TapasTokenizer"},{local:"transformers.TapasModel",title:"TapasModel"},{local:"transformers.TapasForMaskedLM",title:"TapasForMaskedLM"},{local:"transformers.TapasForSequenceClassification",title:"TapasForSequenceClassification"},{local:"transformers.TapasForQuestionAnswering",title:"TapasForQuestionAnswering"},{local:"transformers.TFTapasModel",title:"TFTapasModel"},{local:"transformers.TFTapasForMaskedLM",title:"TFTapasForMaskedLM"},{local:"transformers.TFTapasForSequenceClassification",title:"TFTapasForSequenceClassification"},{local:"transformers.TFTapasForQuestionAnswering",title:"TFTapasForQuestionAnswering"}],title:"TAPAS"};function Cj(A){return xb(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $j extends Gb{constructor(i){super();Nb(this,i,Cj,Ij,Qb,{})}}export{$j as default,Ej as metadata};
