import{S as Ly,i as Qy,s as Iy,e as o,k as c,w as y,t as s,M as Wy,c as n,d as t,m as h,a as r,x as k,h as a,b as m,N as Hy,G as e,g as u,y as j,q,o as $,B as E,v as Uy,L as At}from"../../chunks/vendor-hf-doc-builder.js";import{T as Is}from"../../chunks/Tip-hf-doc-builder.js";import{D as it}from"../../chunks/Docstring-hf-doc-builder.js";import{C as ht}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Pt}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{F as Kc,M as wn}from"../../chunks/Markdown-hf-doc-builder.js";import{E as To}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Ry(x){let l,v,d,f,T,p,g,A,F,H,N,G,ae,w,B,X;return f=new ht({props:{code:`from transformers import TapasConfig, TapasForQuestionAnswering

# for example, the base sized model with default SQA configuration
model = TapasForQuestionAnswering.from_pretrained("google/tapas-base")

# or, the base sized model with WTQ configuration
config = TapasConfig.from_pretrained("google/tapas-base-finetuned-wtq")
model = TapasForQuestionAnswering.from_pretrained("google/tapas-base", config=config)

# or, the base sized model with WikiSQL configuration
config = TapasConfig("google-base-finetuned-wikisql-supervised")
model = TapasForQuestionAnswering.from_pretrained("google/tapas-base", config=config)`,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)`}}),B=new ht({props:{code:`from transformers import TapasConfig, TapasForQuestionAnswering

# you can initialize the classification heads any way you want (see docs of TapasConfig)
config = TapasConfig(num_aggregation_labels=3, average_logits_per_cell=True)
# initializing the pre-trained base sized model with our custom classification heads
model = TapasForQuestionAnswering.from_pretrained("google/tapas-base", config=config)`,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(){l=o("p"),v=s("Initializing a model with a pre-trained base and randomly initialized classification heads from the hub can be done as shown below."),d=c(),y(f.$$.fragment),T=c(),p=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 "),A=o("a"),F=s("TapasConfig"),H=s(", and then create a "),N=o("a"),G=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=c(),y(B.$$.fragment),this.h()},l(S){l=n(S,"P",{});var U=r(l);v=a(U,"Initializing a model with a pre-trained base and randomly initialized classification heads from the hub can be done as shown below."),U.forEach(t),d=h(S),k(f.$$.fragment,S),T=h(S),p=n(S,"P",{});var O=r(p);g=a(O,"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 "),A=n(O,"A",{href:!0});var C=r(A);F=a(C,"TapasConfig"),C.forEach(t),H=a(O,", and then create a "),N=n(O,"A",{href:!0});var W=r(N);G=a(W,"TapasForQuestionAnswering"),W.forEach(t),ae=a(O," 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:"),O.forEach(t),w=h(S),k(B.$$.fragment,S),this.h()},h(){m(A,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasConfig"),m(N,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering")},m(S,U){u(S,l,U),e(l,v),u(S,d,U),j(f,S,U),u(S,T,U),u(S,p,U),e(p,g),e(p,A),e(A,F),e(p,H),e(p,N),e(N,G),e(p,ae),u(S,w,U),j(B,S,U),X=!0},p:At,i(S){X||(q(f.$$.fragment,S),q(B.$$.fragment,S),X=!0)},o(S){$(f.$$.fragment,S),$(B.$$.fragment,S),X=!1},d(S){S&&t(l),S&&t(d),E(f,S),S&&t(T),S&&t(p),S&&t(w),E(B,S)}}}function By(x){let l,v;return l=new wn({props:{$$slots:{default:[Ry]},$$scope:{ctx:x}}}),{c(){y(l.$$.fragment)},l(d){k(l.$$.fragment,d)},m(d,f){j(l,d,f),v=!0},p(d,f){const T={};f&2&&(T.$$scope={dirty:f,ctx:d}),l.$set(T)},i(d){v||(q(l.$$.fragment,d),v=!0)},o(d){$(l.$$.fragment,d),v=!1},d(d){E(l,d)}}}function Gy(x){let l,v,d,f,T,p,g,A,F,H,N,G,ae,w,B,X,S,U,O;return g=new ht({props:{code:`from transformers import TapasConfig, TFTapasForQuestionAnswering

# for example, the base sized model with default SQA configuration
model = TFTapasForQuestionAnswering.from_pretrained("google/tapas-base")

# or, the base sized model with WTQ configuration
config = TapasConfig.from_pretrained("google/tapas-base-finetuned-wtq")
model = TFTapasForQuestionAnswering.from_pretrained("google/tapas-base", config=config)

# or, the base sized model with WikiSQL configuration
config = TapasConfig("google-base-finetuned-wikisql-supervised")
model = TFTapasForQuestionAnswering.from_pretrained("google/tapas-base", config=config)`,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)`}}),U=new ht({props:{code:`from transformers import TapasConfig, TFTapasForQuestionAnswering

# you can initialize the classification heads any way you want (see docs of TapasConfig)
config = TapasConfig(num_aggregation_labels=3, average_logits_per_cell=True)
# initializing the pre-trained base sized model with our custom classification heads
model = TFTapasForQuestionAnswering.from_pretrained("google/tapas-base", config=config)`,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(){l=o("p"),v=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"),T=s(" dependency:"),p=c(),y(g.$$.fragment),A=c(),F=o("p"),H=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 "),N=o("a"),G=s("TapasConfig"),ae=s(", and then create a "),w=o("a"),B=s("TFTapasForQuestionAnswering"),X=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:"),S=c(),y(U.$$.fragment),this.h()},l(C){l=n(C,"P",{});var W=r(l);v=a(W,"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(W,"A",{href:!0,rel:!0});var Y=r(d);f=a(Y,"tensorflow_probability"),Y.forEach(t),T=a(W," dependency:"),W.forEach(t),p=h(C),k(g.$$.fragment,C),A=h(C),F=n(C,"P",{});var le=r(F);H=a(le,"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=n(le,"A",{href:!0});var me=r(N);G=a(me,"TapasConfig"),me.forEach(t),ae=a(le,", and then create a "),w=n(le,"A",{href:!0});var Z=r(w);B=a(Z,"TFTapasForQuestionAnswering"),Z.forEach(t),X=a(le," 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:"),le.forEach(t),S=h(C),k(U.$$.fragment,C),this.h()},h(){m(d,"href","https://github.com/tensorflow/probability"),m(d,"rel","nofollow"),m(N,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasConfig"),m(w,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TFTapasForQuestionAnswering")},m(C,W){u(C,l,W),e(l,v),e(l,d),e(d,f),e(l,T),u(C,p,W),j(g,C,W),u(C,A,W),u(C,F,W),e(F,H),e(F,N),e(N,G),e(F,ae),e(F,w),e(w,B),e(F,X),u(C,S,W),j(U,C,W),O=!0},p:At,i(C){O||(q(g.$$.fragment,C),q(U.$$.fragment,C),O=!0)},o(C){$(g.$$.fragment,C),$(U.$$.fragment,C),O=!1},d(C){C&&t(l),C&&t(p),E(g,C),C&&t(A),C&&t(F),C&&t(S),E(U,C)}}}function Ky(x){let l,v;return l=new wn({props:{$$slots:{default:[Gy]},$$scope:{ctx:x}}}),{c(){y(l.$$.fragment)},l(d){k(l.$$.fragment,d)},m(d,f){j(l,d,f),v=!0},p(d,f){const T={};f&2&&(T.$$scope={dirty:f,ctx:d}),l.$set(T)},i(d){v||(q(l.$$.fragment,d),v=!0)},o(d){$(l.$$.fragment,d),v=!1},d(d){E(l,d)}}}function Vy(x){let l,v,d,f,T,p,g,A,F,H,N,G,ae,w,B,X,S,U,O,C,W,Y,le,me,Z,ge,ce,ee,_e,D,L,I,P,K,R,we,ze,he,fe,Fe,se,ke,ve,Pe,Ce,je,Me,$e,pe,Se,ye,J,qe,V,We,oe,He,Ue,b,M,Ve,Te,Ye,Je,Q,Le,ot,Qe,Ie,Xe,de,Ee,Ze,xe,ne,et,Re,re,Be,Ae,tt,Mt,St,Ws,Ot,Ts,ts,Dt,bs,ut,Oe,Hs,Nt,ie,Tt,ss,Us,Lt,ns,Rs,Qt,It,Bs,Wt,rs,Gs,Ht,is,Ks,Ut,Vs,st,Rt,ls,Ys,Bt,ds,Js,ps,lt,cs,De,hs,bt,Xs,Gt,Kt,Zs,ea,dt,ta,us,ms,gt,Vt;return lt=new ht({props:{code:`from transformers import TapasTokenizer
import pandas as pd

model_name = "google/tapas-base"
tokenizer = TapasTokenizer.from_pretrained(model_name)

data = {"Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"], "Number of movies": ["87", "53", "69"]}
queries = [
    "What is the name of the first actor?",
    "How many movies has George Clooney played in?",
    "What is the total number of movies?",
]
answer_coordinates = [[(0, 0)], [(2, 1)], [(0, 1), (1, 1), (2, 1)]]
answer_text = [["Brad Pitt"], ["69"], ["209"]]
table = pd.DataFrame.from_dict(data)
inputs = tokenizer(
    table=table,
    queries=queries,
    answer_coordinates=answer_coordinates,
    answer_text=answer_text,
    padding="max_length",
    return_tensors="pt",
)
inputs`,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:`import torch
import pandas as pd

tsv_path = "your_path_to_the_tsv_file"
table_csv_path = "your_path_to_a_directory_containing_all_csv_files"


class TableDataset(torch.utils.data.Dataset):
    def __init__(self, data, tokenizer):
        self.data = data
        self.tokenizer = tokenizer

    def __getitem__(self, idx):
        item = data.iloc[idx]
        table = pd.read_csv(table_csv_path + item.table_file).astype(
            str
        )  # be sure to make your table data text only
        encoding = self.tokenizer(
            table=table,
            queries=item.question,
            answer_coordinates=item.answer_coordinates,
            answer_text=item.answer_text,
            truncation=True,
            padding="max_length",
            return_tensors="pt",
        )
        # remove the batch dimension which the tokenizer adds by default
        encoding = {key: val.squeeze(0) for key, val in encoding.items()}
        # add the float_answer which is also required (weak supervision for aggregation case)
        encoding["float_answer"] = torch.tensor(item.float_answer)
        return encoding

    def __len__(self):
        return len(self.data)


data = pd.read_csv(tsv_path, sep="\\t")
train_dataset = TableDataset(data, tokenizer)
train_dataloader = torch.utils.data.DataLoader(train_dataset, batch_size=32)`,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(){l=o("p"),v=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"),T=s(" to convert table-question pairs into "),p=o("code"),g=s("input_ids"),A=s(", "),F=o("code"),H=s("attention_mask"),N=s(", "),G=o("code"),ae=s("token_type_ids"),w=s(" and so on. Again, based on which of the three cases you picked above, "),B=o("a"),X=s("TapasForQuestionAnswering"),S=s(` requires different
inputs to be fine-tuned:`),U=c(),O=o("table"),C=o("thead"),W=o("tr"),Y=o("th"),le=o("strong"),me=s("Task"),Z=c(),ge=o("th"),ce=o("strong"),ee=s("Required inputs"),_e=c(),D=o("tbody"),L=o("tr"),I=o("td"),P=s("Conversational"),K=c(),R=o("td"),we=o("code"),ze=s("input_ids"),he=s(", "),fe=o("code"),Fe=s("attention_mask"),se=s(", "),ke=o("code"),ve=s("token_type_ids"),Pe=s(", "),Ce=o("code"),je=s("labels"),Me=c(),$e=o("tr"),pe=o("td"),Se=s("Weak supervision for aggregation"),ye=c(),J=o("td"),qe=o("code"),V=s("input_ids"),We=s(", "),oe=o("code"),He=s("attention_mask"),Ue=s(", "),b=o("code"),M=s("token_type_ids"),Ve=s(", "),Te=o("code"),Ye=s("labels"),Je=s(", "),Q=o("code"),Le=s("numeric_values"),ot=s(", "),Qe=o("code"),Ie=s("numeric_values_scale"),Xe=s(", "),de=o("code"),Ee=s("float_answer"),Ze=c(),xe=o("tr"),ne=o("td"),et=s("Strong supervision for aggregation"),Re=c(),re=o("td"),Be=o("code"),Ae=s("input ids"),tt=s(", "),Mt=o("code"),St=s("attention mask"),Ws=s(", "),Ot=o("code"),Ts=s("token type ids"),ts=s(", "),Dt=o("code"),bs=s("labels"),ut=s(", "),Oe=o("code"),Hs=s("aggregation_labels"),Nt=c(),ie=o("p"),Tt=o("a"),ss=s("TapasTokenizer"),Us=s(" creates the "),Lt=o("code"),ns=s("labels"),Rs=s(", "),Qt=o("code"),It=s("numeric_values"),Bs=s(" and "),Wt=o("code"),rs=s("numeric_values_scale"),Gs=s(" based on the "),Ht=o("code"),is=s("answer_coordinates"),Ks=s(" and "),Ut=o("code"),Vs=s("answer_text"),st=s(" columns of the TSV file. The "),Rt=o("code"),ls=s("float_answer"),Ys=s(" and "),Bt=o("code"),ds=s("aggregation_labels"),Js=s(" are already in the TSV file of step 2. Here\u2019s an example:"),ps=c(),y(lt.$$.fragment),cs=c(),De=o("p"),hs=s("Note that "),bt=o("a"),Xs=s("TapasTokenizer"),Gt=s(" expects the data of the table to be "),Kt=o("strong"),Zs=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=c(),y(gt.$$.fragment),this.h()},l(z){l=n(z,"P",{});var te=r(l);v=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 ka=r(d);f=a(ka,"TapasTokenizer"),ka.forEach(t),T=a(te," to convert table-question pairs into "),p=n(te,"CODE",{});var sa=r(p);g=a(sa,"input_ids"),sa.forEach(t),A=a(te,", "),F=n(te,"CODE",{});var ja=r(F);H=a(ja,"attention_mask"),ja.forEach(t),N=a(te,", "),G=n(te,"CODE",{});var ha=r(G);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, "),B=n(te,"A",{href:!0});var Yt=r(B);X=a(Yt,"TapasForQuestionAnswering"),Yt.forEach(t),S=a(te,` requires different
inputs to be fine-tuned:`),te.forEach(t),U=h(z),O=n(z,"TABLE",{});var _t=r(O);C=n(_t,"THEAD",{});var aa=r(C);W=n(aa,"TR",{});var wt=r(W);Y=n(wt,"TH",{});var qa=r(Y);le=n(qa,"STRONG",{});var oa=r(le);me=a(oa,"Task"),oa.forEach(t),qa.forEach(t),Z=h(wt),ge=n(wt,"TH",{});var $a=r(ge);ce=n($a,"STRONG",{});var ua=r(ce);ee=a(ua,"Required inputs"),ua.forEach(t),$a.forEach(t),wt.forEach(t),aa.forEach(t),_e=h(_t),D=n(_t,"TBODY",{});var nt=r(D);L=n(nt,"TR",{});var fs=r(L);I=n(fs,"TD",{});var ws=r(I);P=a(ws,"Conversational"),ws.forEach(t),K=h(fs),R=n(fs,"TD",{});var pt=r(R);we=n(pt,"CODE",{});var Ea=r(we);ze=a(Ea,"input_ids"),Ea.forEach(t),he=a(pt,", "),fe=n(pt,"CODE",{});var ma=r(fe);Fe=a(ma,"attention_mask"),ma.forEach(t),se=a(pt,", "),ke=n(pt,"CODE",{});var ys=r(ke);ve=a(ys,"token_type_ids"),ys.forEach(t),Pe=a(pt,", "),Ce=n(pt,"CODE",{});var na=r(Ce);je=a(na,"labels"),na.forEach(t),pt.forEach(t),fs.forEach(t),Me=h(nt),$e=n(nt,"TR",{});var gs=r($e);pe=n(gs,"TD",{});var fa=r(pe);Se=a(fa,"Weak supervision for aggregation"),fa.forEach(t),ye=h(gs),J=n(gs,"TD",{});var be=r(J);qe=n(be,"CODE",{});var Aa=r(qe);V=a(Aa,"input_ids"),Aa.forEach(t),We=a(be,", "),oe=n(be,"CODE",{});var ks=r(oe);He=a(ks,"attention_mask"),ks.forEach(t),Ue=a(be,", "),b=n(be,"CODE",{});var Fa=r(b);M=a(Fa,"token_type_ids"),Fa.forEach(t),Ve=a(be,", "),Te=n(be,"CODE",{});var za=r(Te);Ye=a(za,"labels"),za.forEach(t),Je=a(be,", "),Q=n(be,"CODE",{});var ga=r(Q);Le=a(ga,"numeric_values"),ga.forEach(t),ot=a(be,", "),Qe=n(be,"CODE",{});var Ft=r(Qe);Ie=a(Ft,"numeric_values_scale"),Ft.forEach(t),Xe=a(be,", "),de=n(be,"CODE",{});var ra=r(de);Ee=a(ra,"float_answer"),ra.forEach(t),be.forEach(t),gs.forEach(t),Ze=h(nt),xe=n(nt,"TR",{});var _s=r(xe);ne=n(_s,"TD",{});var xa=r(ne);et=a(xa,"Strong supervision for aggregation"),xa.forEach(t),Re=h(_s),re=n(_s,"TD",{});var Ne=r(re);Be=n(Ne,"CODE",{});var Ca=r(Be);Ae=a(Ca,"input ids"),Ca.forEach(t),tt=a(Ne,", "),Mt=n(Ne,"CODE",{});var ia=r(Mt);St=a(ia,"attention mask"),ia.forEach(t),Ws=a(Ne,", "),Ot=n(Ne,"CODE",{});var Pa=r(Ot);Ts=a(Pa,"token type ids"),Pa.forEach(t),ts=a(Ne,", "),Dt=n(Ne,"CODE",{});var Ma=r(Dt);bs=a(Ma,"labels"),Ma.forEach(t),ut=a(Ne,", "),Oe=n(Ne,"CODE",{});var Sa=r(Oe);Hs=a(Sa,"aggregation_labels"),Sa.forEach(t),Ne.forEach(t),_s.forEach(t),nt.forEach(t),_t.forEach(t),Nt=h(z),ie=n(z,"P",{});var ue=r(ie);Tt=n(ue,"A",{href:!0});var Oa=r(Tt);ss=a(Oa,"TapasTokenizer"),Oa.forEach(t),Us=a(ue," creates the "),Lt=n(ue,"CODE",{});var la=r(Lt);ns=a(la,"labels"),la.forEach(t),Rs=a(ue,", "),Qt=n(ue,"CODE",{});var Da=r(Qt);It=a(Da,"numeric_values"),Da.forEach(t),Bs=a(ue," and "),Wt=n(ue,"CODE",{});var Na=r(Wt);rs=a(Na,"numeric_values_scale"),Na.forEach(t),Gs=a(ue," based on the "),Ht=n(ue,"CODE",{});var _a=r(Ht);is=a(_a,"answer_coordinates"),_a.forEach(t),Ks=a(ue," and "),Ut=n(ue,"CODE",{});var js=r(Ut);Vs=a(js,"answer_text"),js.forEach(t),st=a(ue," columns of the TSV file. The "),Rt=n(ue,"CODE",{});var La=r(Rt);ls=a(La,"float_answer"),La.forEach(t),Ys=a(ue," and "),Bt=n(ue,"CODE",{});var va=r(Bt);ds=a(va,"aggregation_labels"),va.forEach(t),Js=a(ue," are already in the TSV file of step 2. Here\u2019s an example:"),ue.forEach(t),ps=h(z),k(lt.$$.fragment,z),cs=h(z),De=n(z,"P",{});var Ge=r(De);hs=a(Ge,"Note that "),bt=n(Ge,"A",{href:!0});var da=r(bt);Xs=a(da,"TapasTokenizer"),da.forEach(t),Gt=a(Ge," expects the data of the table to be "),Kt=n(Ge,"STRONG",{});var Jt=r(Kt);Zs=a(Jt,"text-only"),Jt.forEach(t),ea=a(Ge,". You can use "),dt=n(Ge,"CODE",{});var pa=r(dt);ta=a(pa,".astype(str)"),pa.forEach(t),us=a(Ge,` 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:`),Ge.forEach(t),ms=h(z),k(gt.$$.fragment,z),this.h()},h(){m(d,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasTokenizer"),m(B,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering"),m(Tt,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasTokenizer"),m(bt,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasTokenizer")},m(z,te){u(z,l,te),e(l,v),e(l,d),e(d,f),e(l,T),e(l,p),e(p,g),e(l,A),e(l,F),e(F,H),e(l,N),e(l,G),e(G,ae),e(l,w),e(l,B),e(B,X),e(l,S),u(z,U,te),u(z,O,te),e(O,C),e(C,W),e(W,Y),e(Y,le),e(le,me),e(W,Z),e(W,ge),e(ge,ce),e(ce,ee),e(O,_e),e(O,D),e(D,L),e(L,I),e(I,P),e(L,K),e(L,R),e(R,we),e(we,ze),e(R,he),e(R,fe),e(fe,Fe),e(R,se),e(R,ke),e(ke,ve),e(R,Pe),e(R,Ce),e(Ce,je),e(D,Me),e(D,$e),e($e,pe),e(pe,Se),e($e,ye),e($e,J),e(J,qe),e(qe,V),e(J,We),e(J,oe),e(oe,He),e(J,Ue),e(J,b),e(b,M),e(J,Ve),e(J,Te),e(Te,Ye),e(J,Je),e(J,Q),e(Q,Le),e(J,ot),e(J,Qe),e(Qe,Ie),e(J,Xe),e(J,de),e(de,Ee),e(D,Ze),e(D,xe),e(xe,ne),e(ne,et),e(xe,Re),e(xe,re),e(re,Be),e(Be,Ae),e(re,tt),e(re,Mt),e(Mt,St),e(re,Ws),e(re,Ot),e(Ot,Ts),e(re,ts),e(re,Dt),e(Dt,bs),e(re,ut),e(re,Oe),e(Oe,Hs),u(z,Nt,te),u(z,ie,te),e(ie,Tt),e(Tt,ss),e(ie,Us),e(ie,Lt),e(Lt,ns),e(ie,Rs),e(ie,Qt),e(Qt,It),e(ie,Bs),e(ie,Wt),e(Wt,rs),e(ie,Gs),e(ie,Ht),e(Ht,is),e(ie,Ks),e(ie,Ut),e(Ut,Vs),e(ie,st),e(ie,Rt),e(Rt,ls),e(ie,Ys),e(ie,Bt),e(Bt,ds),e(ie,Js),u(z,ps,te),j(lt,z,te),u(z,cs,te),u(z,De,te),e(De,hs),e(De,bt),e(bt,Xs),e(De,Gt),e(De,Kt),e(Kt,Zs),e(De,ea),e(De,dt),e(dt,ta),e(De,us),u(z,ms,te),j(gt,z,te),Vt=!0},p:At,i(z){Vt||(q(lt.$$.fragment,z),q(gt.$$.fragment,z),Vt=!0)},o(z){$(lt.$$.fragment,z),$(gt.$$.fragment,z),Vt=!1},d(z){z&&t(l),z&&t(U),z&&t(O),z&&t(Nt),z&&t(ie),z&&t(ps),E(lt,z),z&&t(cs),z&&t(De),z&&t(ms),E(gt,z)}}}function Yy(x){let l,v;return l=new wn({props:{$$slots:{default:[Vy]},$$scope:{ctx:x}}}),{c(){y(l.$$.fragment)},l(d){k(l.$$.fragment,d)},m(d,f){j(l,d,f),v=!0},p(d,f){const T={};f&2&&(T.$$scope={dirty:f,ctx:d}),l.$set(T)},i(d){v||(q(l.$$.fragment,d),v=!0)},o(d){$(l.$$.fragment,d),v=!1},d(d){E(l,d)}}}function Jy(x){let l,v,d,f,T,p,g,A,F,H,N,G,ae,w,B,X,S,U,O,C,W,Y,le,me,Z,ge,ce,ee,_e,D,L,I,P,K,R,we,ze,he,fe,Fe,se,ke,ve,Pe,Ce,je,Me,$e,pe,Se,ye,J,qe,V,We,oe,He,Ue,b,M,Ve,Te,Ye,Je,Q,Le,ot,Qe,Ie,Xe,de,Ee,Ze,xe,ne,et,Re,re,Be,Ae,tt,Mt,St,Ws,Ot,Ts,ts,Dt,bs,ut,Oe,Hs,Nt,ie,Tt,ss,Us,Lt,ns,Rs,Qt,It,Bs,Wt,rs,Gs,Ht,is,Ks,Ut,Vs,st,Rt,ls,Ys,Bt,ds,Js,ps,lt,cs,De,hs,bt,Xs,Gt,Kt,Zs,ea,dt,ta,us,ms,gt,Vt;return lt=new ht({props:{code:`from transformers import TapasTokenizer
import pandas as pd

model_name = "google/tapas-base"
tokenizer = TapasTokenizer.from_pretrained(model_name)

data = {"Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"], "Number of movies": ["87", "53", "69"]}
queries = [
    "What is the name of the first actor?",
    "How many movies has George Clooney played in?",
    "What is the total number of movies?",
]
answer_coordinates = [[(0, 0)], [(2, 1)], [(0, 1), (1, 1), (2, 1)]]
answer_text = [["Brad Pitt"], ["69"], ["209"]]
table = pd.DataFrame.from_dict(data)
inputs = tokenizer(
    table=table,
    queries=queries,
    answer_coordinates=answer_coordinates,
    answer_text=answer_text,
    padding="max_length",
    return_tensors="tf",
)
inputs`,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;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:`import tensorflow as tf
import pandas as pd

tsv_path = "your_path_to_the_tsv_file"
table_csv_path = "your_path_to_a_directory_containing_all_csv_files"


class TableDataset:
    def __init__(self, data, tokenizer):
        self.data = data
        self.tokenizer = tokenizer

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

    def __len__(self):
        return len(self.data)


data = pd.read_csv(tsv_path, sep="\\t")
train_dataset = TableDataset(data, tokenizer)
output_signature = (
    tf.TensorSpec(shape=(512,), dtype=tf.int32),
    tf.TensorSpec(shape=(512,), dtype=tf.int32),
    tf.TensorSpec(shape=(512,), dtype=tf.float32),
    tf.TensorSpec(shape=(512,), dtype=tf.float32),
    tf.TensorSpec(shape=(512, 7), dtype=tf.int32),
    tf.TensorSpec(shape=(512,), dtype=tf.int32),
    tf.TensorSpec(shape=(512,), dtype=tf.float32),
)
train_dataloader = tf.data.Dataset.from_generator(train_dataset, output_signature=output_signature).batch(32)`,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(){l=o("p"),v=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"),T=s(" to convert table-question pairs into "),p=o("code"),g=s("input_ids"),A=s(", "),F=o("code"),H=s("attention_mask"),N=s(", "),G=o("code"),ae=s("token_type_ids"),w=s(" and so on. Again, based on which of the three cases you picked above, "),B=o("a"),X=s("TFTapasForQuestionAnswering"),S=s(` requires different
inputs to be fine-tuned:`),U=c(),O=o("table"),C=o("thead"),W=o("tr"),Y=o("th"),le=o("strong"),me=s("Task"),Z=c(),ge=o("th"),ce=o("strong"),ee=s("Required inputs"),_e=c(),D=o("tbody"),L=o("tr"),I=o("td"),P=s("Conversational"),K=c(),R=o("td"),we=o("code"),ze=s("input_ids"),he=s(", "),fe=o("code"),Fe=s("attention_mask"),se=s(", "),ke=o("code"),ve=s("token_type_ids"),Pe=s(", "),Ce=o("code"),je=s("labels"),Me=c(),$e=o("tr"),pe=o("td"),Se=s("Weak supervision for aggregation"),ye=c(),J=o("td"),qe=o("code"),V=s("input_ids"),We=s(", "),oe=o("code"),He=s("attention_mask"),Ue=s(", "),b=o("code"),M=s("token_type_ids"),Ve=s(", "),Te=o("code"),Ye=s("labels"),Je=s(", "),Q=o("code"),Le=s("numeric_values"),ot=s(", "),Qe=o("code"),Ie=s("numeric_values_scale"),Xe=s(", "),de=o("code"),Ee=s("float_answer"),Ze=c(),xe=o("tr"),ne=o("td"),et=s("Strong supervision for aggregation"),Re=c(),re=o("td"),Be=o("code"),Ae=s("input ids"),tt=s(", "),Mt=o("code"),St=s("attention mask"),Ws=s(", "),Ot=o("code"),Ts=s("token type ids"),ts=s(", "),Dt=o("code"),bs=s("labels"),ut=s(", "),Oe=o("code"),Hs=s("aggregation_labels"),Nt=c(),ie=o("p"),Tt=o("a"),ss=s("TapasTokenizer"),Us=s(" creates the "),Lt=o("code"),ns=s("labels"),Rs=s(", "),Qt=o("code"),It=s("numeric_values"),Bs=s(" and "),Wt=o("code"),rs=s("numeric_values_scale"),Gs=s(" based on the "),Ht=o("code"),is=s("answer_coordinates"),Ks=s(" and "),Ut=o("code"),Vs=s("answer_text"),st=s(" columns of the TSV file. The "),Rt=o("code"),ls=s("float_answer"),Ys=s(" and "),Bt=o("code"),ds=s("aggregation_labels"),Js=s(" are already in the TSV file of step 2. Here\u2019s an example:"),ps=c(),y(lt.$$.fragment),cs=c(),De=o("p"),hs=s("Note that "),bt=o("a"),Xs=s("TapasTokenizer"),Gt=s(" expects the data of the table to be "),Kt=o("strong"),Zs=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=c(),y(gt.$$.fragment),this.h()},l(z){l=n(z,"P",{});var te=r(l);v=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 ka=r(d);f=a(ka,"TapasTokenizer"),ka.forEach(t),T=a(te," to convert table-question pairs into "),p=n(te,"CODE",{});var sa=r(p);g=a(sa,"input_ids"),sa.forEach(t),A=a(te,", "),F=n(te,"CODE",{});var ja=r(F);H=a(ja,"attention_mask"),ja.forEach(t),N=a(te,", "),G=n(te,"CODE",{});var ha=r(G);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, "),B=n(te,"A",{href:!0});var Yt=r(B);X=a(Yt,"TFTapasForQuestionAnswering"),Yt.forEach(t),S=a(te,` requires different
inputs to be fine-tuned:`),te.forEach(t),U=h(z),O=n(z,"TABLE",{});var _t=r(O);C=n(_t,"THEAD",{});var aa=r(C);W=n(aa,"TR",{});var wt=r(W);Y=n(wt,"TH",{});var qa=r(Y);le=n(qa,"STRONG",{});var oa=r(le);me=a(oa,"Task"),oa.forEach(t),qa.forEach(t),Z=h(wt),ge=n(wt,"TH",{});var $a=r(ge);ce=n($a,"STRONG",{});var ua=r(ce);ee=a(ua,"Required inputs"),ua.forEach(t),$a.forEach(t),wt.forEach(t),aa.forEach(t),_e=h(_t),D=n(_t,"TBODY",{});var nt=r(D);L=n(nt,"TR",{});var fs=r(L);I=n(fs,"TD",{});var ws=r(I);P=a(ws,"Conversational"),ws.forEach(t),K=h(fs),R=n(fs,"TD",{});var pt=r(R);we=n(pt,"CODE",{});var Ea=r(we);ze=a(Ea,"input_ids"),Ea.forEach(t),he=a(pt,", "),fe=n(pt,"CODE",{});var ma=r(fe);Fe=a(ma,"attention_mask"),ma.forEach(t),se=a(pt,", "),ke=n(pt,"CODE",{});var ys=r(ke);ve=a(ys,"token_type_ids"),ys.forEach(t),Pe=a(pt,", "),Ce=n(pt,"CODE",{});var na=r(Ce);je=a(na,"labels"),na.forEach(t),pt.forEach(t),fs.forEach(t),Me=h(nt),$e=n(nt,"TR",{});var gs=r($e);pe=n(gs,"TD",{});var fa=r(pe);Se=a(fa,"Weak supervision for aggregation"),fa.forEach(t),ye=h(gs),J=n(gs,"TD",{});var be=r(J);qe=n(be,"CODE",{});var Aa=r(qe);V=a(Aa,"input_ids"),Aa.forEach(t),We=a(be,", "),oe=n(be,"CODE",{});var ks=r(oe);He=a(ks,"attention_mask"),ks.forEach(t),Ue=a(be,", "),b=n(be,"CODE",{});var Fa=r(b);M=a(Fa,"token_type_ids"),Fa.forEach(t),Ve=a(be,", "),Te=n(be,"CODE",{});var za=r(Te);Ye=a(za,"labels"),za.forEach(t),Je=a(be,", "),Q=n(be,"CODE",{});var ga=r(Q);Le=a(ga,"numeric_values"),ga.forEach(t),ot=a(be,", "),Qe=n(be,"CODE",{});var Ft=r(Qe);Ie=a(Ft,"numeric_values_scale"),Ft.forEach(t),Xe=a(be,", "),de=n(be,"CODE",{});var ra=r(de);Ee=a(ra,"float_answer"),ra.forEach(t),be.forEach(t),gs.forEach(t),Ze=h(nt),xe=n(nt,"TR",{});var _s=r(xe);ne=n(_s,"TD",{});var xa=r(ne);et=a(xa,"Strong supervision for aggregation"),xa.forEach(t),Re=h(_s),re=n(_s,"TD",{});var Ne=r(re);Be=n(Ne,"CODE",{});var Ca=r(Be);Ae=a(Ca,"input ids"),Ca.forEach(t),tt=a(Ne,", "),Mt=n(Ne,"CODE",{});var ia=r(Mt);St=a(ia,"attention mask"),ia.forEach(t),Ws=a(Ne,", "),Ot=n(Ne,"CODE",{});var Pa=r(Ot);Ts=a(Pa,"token type ids"),Pa.forEach(t),ts=a(Ne,", "),Dt=n(Ne,"CODE",{});var Ma=r(Dt);bs=a(Ma,"labels"),Ma.forEach(t),ut=a(Ne,", "),Oe=n(Ne,"CODE",{});var Sa=r(Oe);Hs=a(Sa,"aggregation_labels"),Sa.forEach(t),Ne.forEach(t),_s.forEach(t),nt.forEach(t),_t.forEach(t),Nt=h(z),ie=n(z,"P",{});var ue=r(ie);Tt=n(ue,"A",{href:!0});var Oa=r(Tt);ss=a(Oa,"TapasTokenizer"),Oa.forEach(t),Us=a(ue," creates the "),Lt=n(ue,"CODE",{});var la=r(Lt);ns=a(la,"labels"),la.forEach(t),Rs=a(ue,", "),Qt=n(ue,"CODE",{});var Da=r(Qt);It=a(Da,"numeric_values"),Da.forEach(t),Bs=a(ue," and "),Wt=n(ue,"CODE",{});var Na=r(Wt);rs=a(Na,"numeric_values_scale"),Na.forEach(t),Gs=a(ue," based on the "),Ht=n(ue,"CODE",{});var _a=r(Ht);is=a(_a,"answer_coordinates"),_a.forEach(t),Ks=a(ue," and "),Ut=n(ue,"CODE",{});var js=r(Ut);Vs=a(js,"answer_text"),js.forEach(t),st=a(ue," columns of the TSV file. The "),Rt=n(ue,"CODE",{});var La=r(Rt);ls=a(La,"float_answer"),La.forEach(t),Ys=a(ue," and "),Bt=n(ue,"CODE",{});var va=r(Bt);ds=a(va,"aggregation_labels"),va.forEach(t),Js=a(ue," are already in the TSV file of step 2. Here\u2019s an example:"),ue.forEach(t),ps=h(z),k(lt.$$.fragment,z),cs=h(z),De=n(z,"P",{});var Ge=r(De);hs=a(Ge,"Note that "),bt=n(Ge,"A",{href:!0});var da=r(bt);Xs=a(da,"TapasTokenizer"),da.forEach(t),Gt=a(Ge," expects the data of the table to be "),Kt=n(Ge,"STRONG",{});var Jt=r(Kt);Zs=a(Jt,"text-only"),Jt.forEach(t),ea=a(Ge,". You can use "),dt=n(Ge,"CODE",{});var pa=r(dt);ta=a(pa,".astype(str)"),pa.forEach(t),us=a(Ge,` 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:`),Ge.forEach(t),ms=h(z),k(gt.$$.fragment,z),this.h()},h(){m(d,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasTokenizer"),m(B,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TFTapasForQuestionAnswering"),m(Tt,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasTokenizer"),m(bt,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasTokenizer")},m(z,te){u(z,l,te),e(l,v),e(l,d),e(d,f),e(l,T),e(l,p),e(p,g),e(l,A),e(l,F),e(F,H),e(l,N),e(l,G),e(G,ae),e(l,w),e(l,B),e(B,X),e(l,S),u(z,U,te),u(z,O,te),e(O,C),e(C,W),e(W,Y),e(Y,le),e(le,me),e(W,Z),e(W,ge),e(ge,ce),e(ce,ee),e(O,_e),e(O,D),e(D,L),e(L,I),e(I,P),e(L,K),e(L,R),e(R,we),e(we,ze),e(R,he),e(R,fe),e(fe,Fe),e(R,se),e(R,ke),e(ke,ve),e(R,Pe),e(R,Ce),e(Ce,je),e(D,Me),e(D,$e),e($e,pe),e(pe,Se),e($e,ye),e($e,J),e(J,qe),e(qe,V),e(J,We),e(J,oe),e(oe,He),e(J,Ue),e(J,b),e(b,M),e(J,Ve),e(J,Te),e(Te,Ye),e(J,Je),e(J,Q),e(Q,Le),e(J,ot),e(J,Qe),e(Qe,Ie),e(J,Xe),e(J,de),e(de,Ee),e(D,Ze),e(D,xe),e(xe,ne),e(ne,et),e(xe,Re),e(xe,re),e(re,Be),e(Be,Ae),e(re,tt),e(re,Mt),e(Mt,St),e(re,Ws),e(re,Ot),e(Ot,Ts),e(re,ts),e(re,Dt),e(Dt,bs),e(re,ut),e(re,Oe),e(Oe,Hs),u(z,Nt,te),u(z,ie,te),e(ie,Tt),e(Tt,ss),e(ie,Us),e(ie,Lt),e(Lt,ns),e(ie,Rs),e(ie,Qt),e(Qt,It),e(ie,Bs),e(ie,Wt),e(Wt,rs),e(ie,Gs),e(ie,Ht),e(Ht,is),e(ie,Ks),e(ie,Ut),e(Ut,Vs),e(ie,st),e(ie,Rt),e(Rt,ls),e(ie,Ys),e(ie,Bt),e(Bt,ds),e(ie,Js),u(z,ps,te),j(lt,z,te),u(z,cs,te),u(z,De,te),e(De,hs),e(De,bt),e(bt,Xs),e(De,Gt),e(De,Kt),e(Kt,Zs),e(De,ea),e(De,dt),e(dt,ta),e(De,us),u(z,ms,te),j(gt,z,te),Vt=!0},p:At,i(z){Vt||(q(lt.$$.fragment,z),q(gt.$$.fragment,z),Vt=!0)},o(z){$(lt.$$.fragment,z),$(gt.$$.fragment,z),Vt=!1},d(z){z&&t(l),z&&t(U),z&&t(O),z&&t(Nt),z&&t(ie),z&&t(ps),E(lt,z),z&&t(cs),z&&t(De),z&&t(ms),E(gt,z)}}}function Xy(x){let l,v;return l=new wn({props:{$$slots:{default:[Jy]},$$scope:{ctx:x}}}),{c(){y(l.$$.fragment)},l(d){k(l.$$.fragment,d)},m(d,f){j(l,d,f),v=!0},p(d,f){const T={};f&2&&(T.$$scope={dirty:f,ctx:d}),l.$set(T)},i(d){v||(q(l.$$.fragment,d),v=!0)},o(d){$(l.$$.fragment,d),v=!1},d(d){E(l,d)}}}function Zy(x){let l,v,d,f,T,p,g,A;return g=new ht({props:{code:`from transformers import TapasConfig, TapasForQuestionAnswering, AdamW

# this is the default WTQ configuration
config = TapasConfig(
    num_aggregation_labels=4,
    use_answer_as_supervision=True,
    answer_loss_cutoff=0.664694,
    cell_selection_preference=0.207951,
    huber_loss_delta=0.121194,
    init_cell_selection_weights_to_zero=True,
    select_one_column=True,
    allow_empty_column_selection=False,
    temperature=0.0352513,
)
model = TapasForQuestionAnswering.from_pretrained("google/tapas-base", config=config)

optimizer = AdamW(model.parameters(), lr=5e-5)

model.train()
for epoch in range(2):  # loop over the dataset multiple times
    for batch in train_dataloader:
        # get the inputs;
        input_ids = batch["input_ids"]
        attention_mask = batch["attention_mask"]
        token_type_ids = batch["token_type_ids"]
        labels = batch["labels"]
        numeric_values = batch["numeric_values"]
        numeric_values_scale = batch["numeric_values_scale"]
        float_answer = batch["float_answer"]

        # zero the parameter gradients
        optimizer.zero_grad()

        # forward + backward + optimize
        outputs = model(
            input_ids=input_ids,
            attention_mask=attention_mask,
            token_type_ids=token_type_ids,
            labels=labels,
            numeric_values=numeric_values,
            numeric_values_scale=numeric_values_scale,
            float_answer=float_answer,
        )
        loss = outputs.loss
        loss.backward()
        optimizer.step()`,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(){l=o("p"),v=s("You can then fine-tune "),d=o("a"),f=s("TapasForQuestionAnswering"),T=s(" as follows (shown here for the weak supervision for aggregation case):"),p=c(),y(g.$$.fragment),this.h()},l(F){l=n(F,"P",{});var H=r(l);v=a(H,"You can then fine-tune "),d=n(H,"A",{href:!0});var N=r(d);f=a(N,"TapasForQuestionAnswering"),N.forEach(t),T=a(H," as follows (shown here for the weak supervision for aggregation case):"),H.forEach(t),p=h(F),k(g.$$.fragment,F),this.h()},h(){m(d,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering")},m(F,H){u(F,l,H),e(l,v),e(l,d),e(d,f),e(l,T),u(F,p,H),j(g,F,H),A=!0},p:At,i(F){A||(q(g.$$.fragment,F),A=!0)},o(F){$(g.$$.fragment,F),A=!1},d(F){F&&t(l),F&&t(p),E(g,F)}}}function ek(x){let l,v;return l=new wn({props:{$$slots:{default:[Zy]},$$scope:{ctx:x}}}),{c(){y(l.$$.fragment)},l(d){k(l.$$.fragment,d)},m(d,f){j(l,d,f),v=!0},p(d,f){const T={};f&2&&(T.$$scope={dirty:f,ctx:d}),l.$set(T)},i(d){v||(q(l.$$.fragment,d),v=!0)},o(d){$(l.$$.fragment,d),v=!1},d(d){E(l,d)}}}function tk(x){let l,v,d,f,T,p,g,A;return g=new ht({props:{code:`import tensorflow as tf
from transformers import TapasConfig, TFTapasForQuestionAnswering

# this is the default WTQ configuration
config = TapasConfig(
    num_aggregation_labels=4,
    use_answer_as_supervision=True,
    answer_loss_cutoff=0.664694,
    cell_selection_preference=0.207951,
    huber_loss_delta=0.121194,
    init_cell_selection_weights_to_zero=True,
    select_one_column=True,
    allow_empty_column_selection=False,
    temperature=0.0352513,
)
model = TFTapasForQuestionAnswering.from_pretrained("google/tapas-base", config=config)

optimizer = tf.keras.optimizers.Adam(learning_rate=5e-5)

for epoch in range(2):  # loop over the dataset multiple times
    for batch in train_dataloader:
        # get the inputs;
        input_ids = batch[0]
        attention_mask = batch[1]
        token_type_ids = batch[4]
        labels = batch[-1]
        numeric_values = batch[2]
        numeric_values_scale = batch[3]
        float_answer = batch[6]

        # forward + backward + optimize
        with tf.GradientTape() as tape:
            outputs = model(
                input_ids=input_ids,
                attention_mask=attention_mask,
                token_type_ids=token_type_ids,
                labels=labels,
                numeric_values=numeric_values,
                numeric_values_scale=numeric_values_scale,
                float_answer=float_answer,
            )
        grads = tape.gradient(outputs.loss, model.trainable_weights)
        optimizer.apply_gradients(zip(grads, model.trainable_weights))`,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(){l=o("p"),v=s("You can then fine-tune "),d=o("a"),f=s("TFTapasForQuestionAnswering"),T=s(" as follows (shown here for the weak supervision for aggregation case):"),p=c(),y(g.$$.fragment),this.h()},l(F){l=n(F,"P",{});var H=r(l);v=a(H,"You can then fine-tune "),d=n(H,"A",{href:!0});var N=r(d);f=a(N,"TFTapasForQuestionAnswering"),N.forEach(t),T=a(H," as follows (shown here for the weak supervision for aggregation case):"),H.forEach(t),p=h(F),k(g.$$.fragment,F),this.h()},h(){m(d,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TFTapasForQuestionAnswering")},m(F,H){u(F,l,H),e(l,v),e(l,d),e(d,f),e(l,T),u(F,p,H),j(g,F,H),A=!0},p:At,i(F){A||(q(g.$$.fragment,F),A=!0)},o(F){$(g.$$.fragment,F),A=!1},d(F){F&&t(l),F&&t(p),E(g,F)}}}function sk(x){let l,v;return l=new wn({props:{$$slots:{default:[tk]},$$scope:{ctx:x}}}),{c(){y(l.$$.fragment)},l(d){k(l.$$.fragment,d)},m(d,f){j(l,d,f),v=!0},p(d,f){const T={};f&2&&(T.$$scope={dirty:f,ctx:d}),l.$set(T)},i(d){v||(q(l.$$.fragment,d),v=!0)},o(d){$(l.$$.fragment,d),v=!1},d(d){E(l,d)}}}function ak(x){let l,v,d,f,T,p,g,A,F,H,N,G,ae,w,B,X,S,U,O,C,W,Y,le,me,Z,ge,ce,ee,_e,D,L,I;return L=new ht({props:{code:`from transformers import TapasTokenizer, TapasForQuestionAnswering
import pandas as pd

model_name = "google/tapas-base-finetuned-wtq"
model = TapasForQuestionAnswering.from_pretrained(model_name)
tokenizer = TapasTokenizer.from_pretrained(model_name)

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

# let's print out the results:
id2aggregation = {0: "NONE", 1: "SUM", 2: "AVERAGE", 3: "COUNT"}
aggregation_predictions_string = [id2aggregation[x] for x in predicted_aggregation_indices]

answers = []
for coordinates in predicted_answer_coordinates:
    if len(coordinates) == 1:
        # only a single cell:
        answers.append(table.iat[coordinates[0]])
    else:
        # multiple cells
        cell_values = []
        for coordinate in coordinates:
            cell_values.append(table.iat[coordinate])
        answers.append(", ".join(cell_values))

display(table)
print("")
for query, answer, predicted_agg in zip(queries, answers, aggregation_predictions_string):
    print(query)
    if predicted_agg == "NONE":
        print("Predicted answer: " + answer)
    else:
        print("Predicted answer: " + predicted_agg + " > " + answer)`,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(){l=o("p"),v=s("Here we explain how you can use "),d=o("a"),f=s("TapasForQuestionAnswering"),T=s(" or "),p=o("a"),g=s("TFTapasForQuestionAnswering"),A=s(" for inference (i.e. making predictions on new data). For inference, only "),F=o("code"),H=s("input_ids"),N=s(", "),G=o("code"),ae=s("attention_mask"),w=s(" and "),B=o("code"),X=s("token_type_ids"),S=s(" (which you can obtain using "),U=o("a"),O=s("TapasTokenizer"),C=s(") have to be provided to the model to obtain the logits. Next, you can use the handy "),W=o("code"),Y=s("~models.tapas.tokenization_tapas.convert_logits_to_predictions"),le=s(" method to convert these into predicted coordinates and optional aggregation indices."),me=c(),Z=o("p"),ge=s("However, note that inference is "),ce=o("strong"),ee=s("different"),_e=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:"),D=c(),y(L.$$.fragment),this.h()},l(P){l=n(P,"P",{});var K=r(l);v=a(K,"Here we explain how you can use "),d=n(K,"A",{href:!0});var R=r(d);f=a(R,"TapasForQuestionAnswering"),R.forEach(t),T=a(K," or "),p=n(K,"A",{href:!0});var we=r(p);g=a(we,"TFTapasForQuestionAnswering"),we.forEach(t),A=a(K," for inference (i.e. making predictions on new data). For inference, only "),F=n(K,"CODE",{});var ze=r(F);H=a(ze,"input_ids"),ze.forEach(t),N=a(K,", "),G=n(K,"CODE",{});var he=r(G);ae=a(he,"attention_mask"),he.forEach(t),w=a(K," and "),B=n(K,"CODE",{});var fe=r(B);X=a(fe,"token_type_ids"),fe.forEach(t),S=a(K," (which you can obtain using "),U=n(K,"A",{href:!0});var Fe=r(U);O=a(Fe,"TapasTokenizer"),Fe.forEach(t),C=a(K,") have to be provided to the model to obtain the logits. Next, you can use the handy "),W=n(K,"CODE",{});var se=r(W);Y=a(se,"~models.tapas.tokenization_tapas.convert_logits_to_predictions"),se.forEach(t),le=a(K," method to convert these into predicted coordinates and optional aggregation indices."),K.forEach(t),me=h(P),Z=n(P,"P",{});var ke=r(Z);ge=a(ke,"However, note that inference is "),ce=n(ke,"STRONG",{});var ve=r(ce);ee=a(ve,"different"),ve.forEach(t),_e=a(ke," 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:"),ke.forEach(t),D=h(P),k(L.$$.fragment,P),this.h()},h(){m(d,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering"),m(p,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TFTapasForQuestionAnswering"),m(U,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasTokenizer")},m(P,K){u(P,l,K),e(l,v),e(l,d),e(d,f),e(l,T),e(l,p),e(p,g),e(l,A),e(l,F),e(F,H),e(l,N),e(l,G),e(G,ae),e(l,w),e(l,B),e(B,X),e(l,S),e(l,U),e(U,O),e(l,C),e(l,W),e(W,Y),e(l,le),u(P,me,K),u(P,Z,K),e(Z,ge),e(Z,ce),e(ce,ee),e(Z,_e),u(P,D,K),j(L,P,K),I=!0},p:At,i(P){I||(q(L.$$.fragment,P),I=!0)},o(P){$(L.$$.fragment,P),I=!1},d(P){P&&t(l),P&&t(me),P&&t(Z),P&&t(D),E(L,P)}}}function ok(x){let l,v;return l=new wn({props:{$$slots:{default:[ak]},$$scope:{ctx:x}}}),{c(){y(l.$$.fragment)},l(d){k(l.$$.fragment,d)},m(d,f){j(l,d,f),v=!0},p(d,f){const T={};f&2&&(T.$$scope={dirty:f,ctx:d}),l.$set(T)},i(d){v||(q(l.$$.fragment,d),v=!0)},o(d){$(l.$$.fragment,d),v=!1},d(d){E(l,d)}}}function nk(x){let l,v,d,f,T,p,g,A,F,H,N,G,ae,w,B,X,S,U,O,C,W,Y,le,me,Z,ge,ce,ee,_e;return ee=new ht({props:{code:`from transformers import TapasTokenizer, TFTapasForQuestionAnswering
import pandas as pd

model_name = "google/tapas-base-finetuned-wtq"
model = TFTapasForQuestionAnswering.from_pretrained(model_name)
tokenizer = TapasTokenizer.from_pretrained(model_name)

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

# let's print out the results:
id2aggregation = {0: "NONE", 1: "SUM", 2: "AVERAGE", 3: "COUNT"}
aggregation_predictions_string = [id2aggregation[x] for x in predicted_aggregation_indices]

answers = []
for coordinates in predicted_answer_coordinates:
    if len(coordinates) == 1:
        # only a single cell:
        answers.append(table.iat[coordinates[0]])
    else:
        # multiple cells
        cell_values = []
        for coordinate in coordinates:
            cell_values.append(table.iat[coordinate])
        answers.append(", ".join(cell_values))

display(table)
print("")
for query, answer, predicted_agg in zip(queries, answers, aggregation_predictions_string):
    print(query)
    if predicted_agg == "NONE":
        print("Predicted answer: " + answer)
    else:
        print("Predicted answer: " + predicted_agg + " > " + answer)`,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(){l=o("p"),v=s("Here we explain how you can use "),d=o("a"),f=s("TFTapasForQuestionAnswering"),T=s(" for inference (i.e. making predictions on new data). For inference, only "),p=o("code"),g=s("input_ids"),A=s(", "),F=o("code"),H=s("attention_mask"),N=s(" and "),G=o("code"),ae=s("token_type_ids"),w=s(" (which you can obtain using "),B=o("a"),X=s("TapasTokenizer"),S=s(") have to be provided to the model to obtain the logits. Next, you can use the handy "),U=o("code"),O=s("~models.tapas.tokenization_tapas.convert_logits_to_predictions"),C=s(" method to convert these into predicted coordinates and optional aggregation indices."),W=c(),Y=o("p"),le=s("However, note that inference is "),me=o("strong"),Z=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:"),ce=c(),y(ee.$$.fragment),this.h()},l(D){l=n(D,"P",{});var L=r(l);v=a(L,"Here we explain how you can use "),d=n(L,"A",{href:!0});var I=r(d);f=a(I,"TFTapasForQuestionAnswering"),I.forEach(t),T=a(L," for inference (i.e. making predictions on new data). For inference, only "),p=n(L,"CODE",{});var P=r(p);g=a(P,"input_ids"),P.forEach(t),A=a(L,", "),F=n(L,"CODE",{});var K=r(F);H=a(K,"attention_mask"),K.forEach(t),N=a(L," and "),G=n(L,"CODE",{});var R=r(G);ae=a(R,"token_type_ids"),R.forEach(t),w=a(L," (which you can obtain using "),B=n(L,"A",{href:!0});var we=r(B);X=a(we,"TapasTokenizer"),we.forEach(t),S=a(L,") have to be provided to the model to obtain the logits. Next, you can use the handy "),U=n(L,"CODE",{});var ze=r(U);O=a(ze,"~models.tapas.tokenization_tapas.convert_logits_to_predictions"),ze.forEach(t),C=a(L," method to convert these into predicted coordinates and optional aggregation indices."),L.forEach(t),W=h(D),Y=n(D,"P",{});var he=r(Y);le=a(he,"However, note that inference is "),me=n(he,"STRONG",{});var fe=r(me);Z=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),ce=h(D),k(ee.$$.fragment,D),this.h()},h(){m(d,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TFTapasForQuestionAnswering"),m(B,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasTokenizer")},m(D,L){u(D,l,L),e(l,v),e(l,d),e(d,f),e(l,T),e(l,p),e(p,g),e(l,A),e(l,F),e(F,H),e(l,N),e(l,G),e(G,ae),e(l,w),e(l,B),e(B,X),e(l,S),e(l,U),e(U,O),e(l,C),u(D,W,L),u(D,Y,L),e(Y,le),e(Y,me),e(me,Z),e(Y,ge),u(D,ce,L),j(ee,D,L),_e=!0},p:At,i(D){_e||(q(ee.$$.fragment,D),_e=!0)},o(D){$(ee.$$.fragment,D),_e=!1},d(D){D&&t(l),D&&t(W),D&&t(Y),D&&t(ce),E(ee,D)}}}function rk(x){let l,v;return l=new wn({props:{$$slots:{default:[nk]},$$scope:{ctx:x}}}),{c(){y(l.$$.fragment)},l(d){k(l.$$.fragment,d)},m(d,f){j(l,d,f),v=!0},p(d,f){const T={};f&2&&(T.$$scope={dirty:f,ctx:d}),l.$set(T)},i(d){v||(q(l.$$.fragment,d),v=!0)},o(d){$(l.$$.fragment,d),v=!1},d(d){E(l,d)}}}function ik(x){let l,v,d,f,T;return f=new ht({props:{code:`from transformers import TapasModel, TapasConfig

# Initializing a default (SQA) Tapas configuration
configuration = TapasConfig()
# Initializing a model from the configuration
model = TapasModel(configuration)
# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> 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(){l=o("p"),v=s("Example:"),d=c(),y(f.$$.fragment)},l(p){l=n(p,"P",{});var g=r(l);v=a(g,"Example:"),g.forEach(t),d=h(p),k(f.$$.fragment,p)},m(p,g){u(p,l,g),e(l,v),u(p,d,g),j(f,p,g),T=!0},p:At,i(p){T||(q(f.$$.fragment,p),T=!0)},o(p){$(f.$$.fragment,p),T=!1},d(p){p&&t(l),p&&t(d),E(f,p)}}}function lk(x){let l,v,d,f,T;return{c(){l=o("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=o("code"),f=s("Module"),T=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(p){l=n(p,"P",{});var g=r(l);v=a(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=n(g,"CODE",{});var A=r(d);f=a(A,"Module"),A.forEach(t),T=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(p,g){u(p,l,g),e(l,v),e(l,d),e(d,f),e(l,T)},d(p){p&&t(l)}}}function dk(x){let l,v,d,f,T;return f=new ht({props:{code:`from transformers import AutoTokenizer, TapasModel
import pandas as pd

tokenizer = AutoTokenizer.from_pretrained("google/tapas-base")
model = TapasModel.from_pretrained("google/tapas-base")

data = {
    "Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"],
    "Age": ["56", "45", "59"],
    "Number of movies": ["87", "53", "69"],
}
table = pd.DataFrame.from_dict(data)
queries = ["How many movies has George Clooney played in?", "How old is Brad Pitt?"]

inputs = tokenizer(table=table, queries=queries, padding="max_length", return_tensors="pt")
outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, 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(){l=o("p"),v=s("Examples:"),d=c(),y(f.$$.fragment)},l(p){l=n(p,"P",{});var g=r(l);v=a(g,"Examples:"),g.forEach(t),d=h(p),k(f.$$.fragment,p)},m(p,g){u(p,l,g),e(l,v),u(p,d,g),j(f,p,g),T=!0},p:At,i(p){T||(q(f.$$.fragment,p),T=!0)},o(p){$(f.$$.fragment,p),T=!1},d(p){p&&t(l),p&&t(d),E(f,p)}}}function pk(x){let l,v,d,f,T;return{c(){l=o("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=o("code"),f=s("Module"),T=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(p){l=n(p,"P",{});var g=r(l);v=a(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=n(g,"CODE",{});var A=r(d);f=a(A,"Module"),A.forEach(t),T=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(p,g){u(p,l,g),e(l,v),e(l,d),e(d,f),e(l,T)},d(p){p&&t(l)}}}function ck(x){let l,v,d,f,T;return f=new ht({props:{code:`from transformers import AutoTokenizer, TapasForMaskedLM
import pandas as pd

tokenizer = AutoTokenizer.from_pretrained("google/tapas-base")
model = TapasForMaskedLM.from_pretrained("google/tapas-base")

data = {
    "Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"],
    "Age": ["56", "45", "59"],
    "Number of movies": ["87", "53", "69"],
}
table = pd.DataFrame.from_dict(data)

inputs = tokenizer(
    table=table, queries="How many [MASK] has George [MASK] played in?", return_tensors="pt"
)
labels = tokenizer(
    table=table, queries="How many movies has George Clooney played in?", return_tensors="pt"
)["input_ids"]

outputs = model(**inputs, labels=labels)
logits = outputs.logits`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, 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(){l=o("p"),v=s("Examples:"),d=c(),y(f.$$.fragment)},l(p){l=n(p,"P",{});var g=r(l);v=a(g,"Examples:"),g.forEach(t),d=h(p),k(f.$$.fragment,p)},m(p,g){u(p,l,g),e(l,v),u(p,d,g),j(f,p,g),T=!0},p:At,i(p){T||(q(f.$$.fragment,p),T=!0)},o(p){$(f.$$.fragment,p),T=!1},d(p){p&&t(l),p&&t(d),E(f,p)}}}function hk(x){let l,v,d,f,T;return{c(){l=o("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=o("code"),f=s("Module"),T=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(p){l=n(p,"P",{});var g=r(l);v=a(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=n(g,"CODE",{});var A=r(d);f=a(A,"Module"),A.forEach(t),T=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(p,g){u(p,l,g),e(l,v),e(l,d),e(d,f),e(l,T)},d(p){p&&t(l)}}}function uk(x){let l,v,d,f,T;return f=new ht({props:{code:`from transformers import AutoTokenizer, TapasForSequenceClassification
import torch
import pandas as pd

tokenizer = AutoTokenizer.from_pretrained("google/tapas-base-finetuned-tabfact")
model = TapasForSequenceClassification.from_pretrained("google/tapas-base-finetuned-tabfact")

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

inputs = tokenizer(table=table, queries=queries, padding="max_length", return_tensors="pt")
labels = torch.tensor([1, 0])  # 1 means entailed, 0 means refuted

outputs = model(**inputs, labels=labels)
loss = outputs.loss
logits = outputs.logits`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, 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(){l=o("p"),v=s("Examples:"),d=c(),y(f.$$.fragment)},l(p){l=n(p,"P",{});var g=r(l);v=a(g,"Examples:"),g.forEach(t),d=h(p),k(f.$$.fragment,p)},m(p,g){u(p,l,g),e(l,v),u(p,d,g),j(f,p,g),T=!0},p:At,i(p){T||(q(f.$$.fragment,p),T=!0)},o(p){$(f.$$.fragment,p),T=!1},d(p){p&&t(l),p&&t(d),E(f,p)}}}function mk(x){let l,v,d,f,T;return{c(){l=o("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=o("code"),f=s("Module"),T=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(p){l=n(p,"P",{});var g=r(l);v=a(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=n(g,"CODE",{});var A=r(d);f=a(A,"Module"),A.forEach(t),T=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(p,g){u(p,l,g),e(l,v),e(l,d),e(d,f),e(l,T)},d(p){p&&t(l)}}}function fk(x){let l,v,d,f,T;return f=new ht({props:{code:`from transformers import AutoTokenizer, TapasForQuestionAnswering
import pandas as pd

tokenizer = AutoTokenizer.from_pretrained("google/tapas-base-finetuned-wtq")
model = TapasForQuestionAnswering.from_pretrained("google/tapas-base-finetuned-wtq")

data = {
    "Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"],
    "Age": ["56", "45", "59"],
    "Number of movies": ["87", "53", "69"],
}
table = pd.DataFrame.from_dict(data)
queries = ["How many movies has George Clooney played in?", "How old is Brad Pitt?"]

inputs = tokenizer(table=table, queries=queries, padding="max_length", return_tensors="pt")
outputs = model(**inputs)

logits = outputs.logits
logits_aggregation = outputs.logits_aggregation`,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(){l=o("p"),v=s("Examples:"),d=c(),y(f.$$.fragment)},l(p){l=n(p,"P",{});var g=r(l);v=a(g,"Examples:"),g.forEach(t),d=h(p),k(f.$$.fragment,p)},m(p,g){u(p,l,g),e(l,v),u(p,d,g),j(f,p,g),T=!0},p:At,i(p){T||(q(f.$$.fragment,p),T=!0)},o(p){$(f.$$.fragment,p),T=!1},d(p){p&&t(l),p&&t(d),E(f,p)}}}function gk(x){let l,v,d,f,T,p,g,A,F,H,N,G,ae,w,B,X,S,U,O,C,W,Y,le,me,Z,ge,ce,ee,_e,D,L,I,P,K,R,we,ze,he,fe,Fe,se,ke,ve,Pe,Ce,je,Me,$e,pe,Se,ye,J,qe,V,We,oe,He,Ue;return{c(){l=o("p"),v=s("TensorFlow models and layers in "),d=o("code"),f=s("transformers"),T=s(" accept two formats as input:"),p=c(),g=o("ul"),A=o("li"),F=s("having all inputs as keyword arguments (like PyTorch models), or"),H=c(),N=o("li"),G=s("having all inputs as a list, tuple or dict in the first positional argument."),ae=c(),w=o("p"),B=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 `),X=o("code"),S=s("model.fit()"),U=s(` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),O=o("code"),C=s("model.fit()"),W=s(` supports! If, however, you want to use the second
format outside of Keras methods like `),Y=o("code"),le=s("fit()"),me=s(" and "),Z=o("code"),ge=s("predict()"),ce=s(`, such as when creating your own layers or models with
the Keras `),ee=o("code"),_e=s("Functional"),D=s(` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),L=c(),I=o("ul"),P=o("li"),K=s("a single Tensor with "),R=o("code"),we=s("input_ids"),ze=s(" only and nothing else: "),he=o("code"),fe=s("model(input_ids)"),Fe=c(),se=o("li"),ke=s(`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),ve=o("code"),Pe=s("model([input_ids, attention_mask])"),Ce=s(" or "),je=o("code"),Me=s("model([input_ids, attention_mask, token_type_ids])"),$e=c(),pe=o("li"),Se=s(`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ye=o("code"),J=s('model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),qe=c(),V=o("p"),We=s(`Note that when creating models and layers with
`),oe=o("a"),He=s("subclassing"),Ue=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(b){l=n(b,"P",{});var M=r(l);v=a(M,"TensorFlow models and layers in "),d=n(M,"CODE",{});var Ve=r(d);f=a(Ve,"transformers"),Ve.forEach(t),T=a(M," accept two formats as input:"),M.forEach(t),p=h(b),g=n(b,"UL",{});var Te=r(g);A=n(Te,"LI",{});var Ye=r(A);F=a(Ye,"having all inputs as keyword arguments (like PyTorch models), or"),Ye.forEach(t),H=h(Te),N=n(Te,"LI",{});var Je=r(N);G=a(Je,"having all inputs as a list, tuple or dict in the first positional argument."),Je.forEach(t),Te.forEach(t),ae=h(b),w=n(b,"P",{});var Q=r(w);B=a(Q,`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 `),X=n(Q,"CODE",{});var Le=r(X);S=a(Le,"model.fit()"),Le.forEach(t),U=a(Q,` things should \u201Cjust work\u201D for you - just
pass your inputs and labels in any format that `),O=n(Q,"CODE",{});var ot=r(O);C=a(ot,"model.fit()"),ot.forEach(t),W=a(Q,` supports! If, however, you want to use the second
format outside of Keras methods like `),Y=n(Q,"CODE",{});var Qe=r(Y);le=a(Qe,"fit()"),Qe.forEach(t),me=a(Q," and "),Z=n(Q,"CODE",{});var Ie=r(Z);ge=a(Ie,"predict()"),Ie.forEach(t),ce=a(Q,`, such as when creating your own layers or models with
the Keras `),ee=n(Q,"CODE",{});var Xe=r(ee);_e=a(Xe,"Functional"),Xe.forEach(t),D=a(Q,` API, there are three possibilities you can use to gather all the input Tensors in the first
positional argument:`),Q.forEach(t),L=h(b),I=n(b,"UL",{});var de=r(I);P=n(de,"LI",{});var Ee=r(P);K=a(Ee,"a single Tensor with "),R=n(Ee,"CODE",{});var Ze=r(R);we=a(Ze,"input_ids"),Ze.forEach(t),ze=a(Ee," only and nothing else: "),he=n(Ee,"CODE",{});var xe=r(he);fe=a(xe,"model(input_ids)"),xe.forEach(t),Ee.forEach(t),Fe=h(de),se=n(de,"LI",{});var ne=r(se);ke=a(ne,`a list of varying length with one or several input Tensors IN THE ORDER given in the docstring:
`),ve=n(ne,"CODE",{});var et=r(ve);Pe=a(et,"model([input_ids, attention_mask])"),et.forEach(t),Ce=a(ne," or "),je=n(ne,"CODE",{});var Re=r(je);Me=a(Re,"model([input_ids, attention_mask, token_type_ids])"),Re.forEach(t),ne.forEach(t),$e=h(de),pe=n(de,"LI",{});var re=r(pe);Se=a(re,`a dictionary with one or several input Tensors associated to the input names given in the docstring:
`),ye=n(re,"CODE",{});var Be=r(ye);J=a(Be,'model({"input_ids": input_ids, "token_type_ids": token_type_ids})'),Be.forEach(t),re.forEach(t),de.forEach(t),qe=h(b),V=n(b,"P",{});var Ae=r(V);We=a(Ae,`Note that when creating models and layers with
`),oe=n(Ae,"A",{href:!0,rel:!0});var tt=r(oe);He=a(tt,"subclassing"),tt.forEach(t),Ue=a(Ae,` 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!`),Ae.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,M){u(b,l,M),e(l,v),e(l,d),e(d,f),e(l,T),u(b,p,M),u(b,g,M),e(g,A),e(A,F),e(g,H),e(g,N),e(N,G),u(b,ae,M),u(b,w,M),e(w,B),e(w,X),e(X,S),e(w,U),e(w,O),e(O,C),e(w,W),e(w,Y),e(Y,le),e(w,me),e(w,Z),e(Z,ge),e(w,ce),e(w,ee),e(ee,_e),e(w,D),u(b,L,M),u(b,I,M),e(I,P),e(P,K),e(P,R),e(R,we),e(P,ze),e(P,he),e(he,fe),e(I,Fe),e(I,se),e(se,ke),e(se,ve),e(ve,Pe),e(se,Ce),e(se,je),e(je,Me),e(I,$e),e(I,pe),e(pe,Se),e(pe,ye),e(ye,J),u(b,qe,M),u(b,V,M),e(V,We),e(V,oe),e(oe,He),e(V,Ue)},d(b){b&&t(l),b&&t(p),b&&t(g),b&&t(ae),b&&t(w),b&&t(L),b&&t(I),b&&t(qe),b&&t(V)}}}function _k(x){let l,v,d,f,T;return{c(){l=o("p"),v=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),d=o("code"),f=s("Module"),T=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(p){l=n(p,"P",{});var g=r(l);v=a(g,"Although the recipe for forward pass needs to be defined within this function, one should call the "),d=n(g,"CODE",{});var A=r(d);f=a(A,"Module"),A.forEach(t),T=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(p,g){u(p,l,g),e(l,v),e(l,d),e(d,f),e(l,T)},d(p){p&&t(l)}}}function vk(x){let l,v,d,f,T;return f=new ht({props:{code:`from transformers import AutoTokenizer, TapasModel
import pandas as pd

tokenizer = AutoTokenizer.from_pretrained("google/tapas-base")
model = TapasModel.from_pretrained("google/tapas-base")

data = {
    "Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"],
    "Age": ["56", "45", "59"],
    "Number of movies": ["87", "53", "69"],
}
table = pd.DataFrame.from_dict(data)
queries = ["How many movies has George Clooney played in?", "How old is Brad Pitt?"]

inputs = tokenizer(table=table, queries=queries, padding="max_length", return_tensors="tf")
outputs = model(**inputs)

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

tokenizer = AutoTokenizer.from_pretrained("google/tapas-base")
model = TapasForMaskedLM.from_pretrained("google/tapas-base")

data = {
    "Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"],
    "Age": ["56", "45", "59"],
    "Number of movies": ["87", "53", "69"],
}
table = pd.DataFrame.from_dict(data)

inputs = tokenizer(
    table=table, queries="How many [MASK] has George [MASK] played in?", return_tensors="tf"
)
labels = tokenizer(
    table=table, queries="How many movies has George Clooney played in?", return_tensors="tf"
)["input_ids"]

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

tokenizer = AutoTokenizer.from_pretrained("google/tapas-base-finetuned-tabfact")
model = TapasForSequenceClassification.from_pretrained("google/tapas-base-finetuned-tabfact")

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

inputs = tokenizer(table=table, queries=queries, padding="max_length", return_tensors="tf")
labels = tf.convert_to_tensor([1, 0])  # 1 means entailed, 0 means refuted

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

tokenizer = AutoTokenizer.from_pretrained("google/tapas-base-finetuned-wtq")
model = TapasForQuestionAnswering.from_pretrained("google/tapas-base-finetuned-wtq")

data = {
    "Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"],
    "Age": ["56", "45", "59"],
    "Number of movies": ["87", "53", "69"],
}
table = pd.DataFrame.from_dict(data)
queries = ["How many movies has George Clooney played in?", "How old is Brad Pitt?"]

inputs = tokenizer(table=table, queries=queries, padding="max_length", return_tensors="tf")
outputs = model(**inputs)

logits = outputs.logits
logits_aggregation = outputs.logits_aggregation`,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(){l=o("p"),v=s("Examples:"),d=c(),y(f.$$.fragment)},l(p){l=n(p,"P",{});var g=r(l);v=a(g,"Examples:"),g.forEach(t),d=h(p),k(f.$$.fragment,p)},m(p,g){u(p,l,g),e(l,v),u(p,d,g),j(f,p,g),T=!0},p:At,i(p){T||(q(f.$$.fragment,p),T=!0)},o(p){$(f.$$.fragment,p),T=!1},d(p){p&&t(l),p&&t(d),E(f,p)}}}function Ak(x){let l,v,d,f,T,p,g,A,F,H,N,G,ae,w,B,X,S,U,O,C,W,Y,le,me,Z,ge,ce,ee,_e,D,L,I,P,K,R,we,ze,he,fe,Fe,se,ke,ve,Pe,Ce,je,Me,$e,pe,Se,ye,J,qe,V,We,oe,He,Ue,b,M,Ve,Te,Ye,Je,Q,Le,ot,Qe,Ie,Xe,de,Ee,Ze,xe,ne,et,Re,re,Be,Ae,tt,Mt,St,Ws,Ot,Ts,ts,Dt,bs,ut,Oe,Hs,Nt,ie,Tt,ss,Us,Lt,ns,Rs,Qt,It,Bs,Wt,rs,Gs,Ht,is,Ks,Ut,Vs,st,Rt,ls,Ys,Bt,ds,Js,ps,lt,cs,De,hs,bt,Xs,Gt,Kt,Zs,ea,dt,ta,us,ms,gt,Vt,z,te,ka,sa,ja,ha,Yt,_t,aa,wt,qa,oa,$a,ua,nt,fs,ws,pt,Ea,ma,ys,na,gs,fa,be,Aa,ks,Fa,za,ga,Ft,ra,_s,xa,Ne,Ca,ia,Pa,Ma,Sa,ue,Oa,la,Da,Na,_a,js,La,va,Ge,da,Jt,pa,rl,Vc,Yc,il,ll,Jc,Xc,dl,pl,Zc,eh,Qa,Ia,cl,th,sh,hl,ah,oh,ul,nh,rh,Wa,ml,ih,lh,fl,dh,ph,gl,ch,hh,Ha,_l,uh,mh,vl,fh,gh,Tl,_h,mp,bo,fp,wo,vh,yn,Th,bh,gp,yo,wh,kn,yh,kh,_p,Vr,bl,jh,vp,ko,qh,jn,$h,Eh,Tp,rt,Yr,wl,Ah,Fh,zh,Jr,yl,xh,Ch,Ph,Xr,kl,Mh,Sh,Oh,Zr,jl,Dh,Nh,Lh,ei,ql,Qh,Ih,Wh,ti,$l,Hh,Uh,Rh,si,El,Bh,Gh,Kh,ai,Al,Vh,Yh,Jh,oi,Fl,Xh,Zh,bp,zt,eu,qn,tu,su,$n,au,ou,zl,nu,ru,xl,iu,lu,Cl,du,pu,wp,ni,Pl,cu,yp,jo,kp,Ke,hu,Ml,uu,mu,Sl,fu,gu,Ol,_u,vu,Dl,Tu,bu,Nl,wu,yu,Ll,ku,ju,ri,qu,$u,En,Eu,Au,An,Fu,zu,jp,ii,xu,qp,qo,$p,Ua,$o,Ql,Fn,Cu,Il,Pu,Ep,Eo,Ap,xt,Mu,Wl,Su,Ou,Hl,Du,Nu,Ul,Lu,Qu,zn,Iu,Wu,xn,Hu,Uu,Fp,Ra,Ao,Rl,Cn,Ru,Bl,Bu,zp,Fo,Gl,li,Gu,Ku,Kl,di,Vu,xp,Ba,zo,Vl,Pn,Yu,Yl,Ju,Cp,Ga,Mn,Xu,Sn,Zu,pi,em,tm,Pp,Ka,xo,Jl,On,sm,Xl,am,Mp,Xt,Dn,om,Va,nm,ci,rm,im,Nn,lm,dm,pm,Ya,cm,Zl,hm,um,hi,mm,fm,gm,Ln,_m,Qn,vm,Tm,bm,Co,Sp,Ja,Po,ed,In,wm,td,ym,Op,ct,Wn,km,sd,jm,qm,at,$m,ui,Em,Am,mi,Fm,zm,ad,xm,Cm,od,Pm,Mm,nd,Sm,Om,rd,Dm,Nm,id,Lm,Qm,ld,Im,Wm,dd,Hm,Um,Rm,yt,pd,Bm,Gm,cd,Km,Vm,hd,Ym,Jm,ud,Xm,Zm,md,ef,tf,fd,sf,af,gd,of,nf,fi,gi,rf,lf,df,Mo,Hn,pf,_d,cf,hf,Ta,Un,uf,Rn,mf,_i,ff,gf,_f,Bn,vf,Gn,Tf,bf,wf,vi,Kn,Dp,Xa,So,vd,Vn,yf,Td,kf,Np,kt,Yn,jf,Jn,qf,Ti,$f,Ef,Af,Xn,Ff,Zn,zf,xf,Cf,er,Pf,bi,Mf,Sf,Of,tr,Df,sr,Nf,Lf,Qf,qs,ar,If,Za,Wf,wi,Hf,Uf,bd,Rf,Bf,Gf,Oo,Kf,Do,Lp,eo,No,wd,or,Vf,yd,Yf,Qp,vs,nr,Jf,to,Xf,kd,Zf,eg,yi,tg,sg,ag,rr,og,ir,ng,rg,ig,$s,lr,lg,so,dg,ki,pg,cg,jd,hg,ug,mg,Lo,fg,Qo,Ip,ao,Io,qd,dr,gg,$d,_g,Wp,Zt,pr,vg,Ed,Tg,bg,cr,wg,ji,yg,kg,jg,hr,qg,ur,$g,Eg,Ag,Es,mr,Fg,oo,zg,qi,xg,Cg,Ad,Pg,Mg,Sg,Wo,Og,Ho,Hp,no,Uo,Fd,fr,Dg,zd,Ng,Up,es,gr,Lg,ro,Qg,xd,Ig,Wg,Cd,Hg,Ug,Rg,_r,Bg,$i,Gg,Kg,Vg,vr,Yg,Tr,Jg,Xg,Zg,As,br,e_,io,t_,Ei,s_,a_,Pd,o_,n_,r_,Ro,i_,Bo,Rp,lo,Go,Md,wr,l_,Sd,d_,Bp,jt,yr,p_,Od,c_,h_,kr,u_,Ai,m_,f_,g_,jr,__,qr,v_,T_,b_,Ko,w_,Fs,$r,y_,po,k_,Fi,j_,q_,Dd,$_,E_,A_,Vo,F_,Yo,Gp,co,Jo,Nd,Er,z_,Ld,x_,Kp,qt,Ar,C_,Fr,P_,Qd,M_,S_,O_,zr,D_,zi,N_,L_,Q_,xr,I_,Cr,W_,H_,U_,Xo,R_,zs,Pr,B_,ho,G_,xi,K_,V_,Id,Y_,J_,X_,Zo,Z_,en,Vp,uo,tn,Wd,Mr,ev,Hd,tv,Yp,$t,Sr,sv,Ud,av,ov,Or,nv,Ci,rv,iv,lv,Dr,dv,Nr,pv,cv,hv,sn,uv,xs,Lr,mv,mo,fv,Pi,gv,_v,Rd,vv,Tv,bv,an,wv,on,Jp,fo,nn,Bd,Qr,yv,Gd,kv,Xp,Et,Ir,jv,go,qv,Kd,$v,Ev,Vd,Av,Fv,zv,Wr,xv,Mi,Cv,Pv,Mv,Hr,Sv,Ur,Ov,Dv,Nv,rn,Lv,Cs,Rr,Qv,_o,Iv,Si,Wv,Hv,Yd,Uv,Rv,Bv,ln,Gv,dn,Zp;return p=new Pt({}),w=new Pt({}),wt=new Pt({}),bo=new Kc({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Ky],pytorch:[By]},$$scope:{ctx:x}}}),jo=new Kc({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Xy],pytorch:[Yy]},$$scope:{ctx:x}}}),qo=new Kc({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[sk],pytorch:[ek]},$$scope:{ctx:x}}}),Fn=new Pt({}),Eo=new Kc({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[rk],pytorch:[ok]},$$scope:{ctx:x}}}),Cn=new Pt({}),Pn=new Pt({}),Mn=new it({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.29.0/src/transformers/models/tapas/modeling_tapas.py#L91"}}),On=new Pt({}),Dn=new it({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.29.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.29.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.29.0/src/transformers/models/tapas/configuration_tapas.py#L45"}}),Co=new To({props:{anchor:"transformers.TapasConfig.example",$$slots:{default:[ik]},$$scope:{ctx:x}}}),In=new Pt({}),Wn=new it({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.29.0/src/transformers/models/tapas/tokenization_tapas.py#L236"}}),Hn=new it({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.29.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.29.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.29.0/src/transformers/models/tapas/tokenization_tapas.py#L575"}}),Un=new it({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.29.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.29.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>
`}}),Kn=new it({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.29.0/src/transformers/models/tapas/tokenization_tapas.py#L443"}}),Vn=new Pt({}),Yn=new it({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.29.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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/tapas/modeling_tapas.py#L841"}}),ar=new it({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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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.29.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.29.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/tapas/modeling_tapas.py#L878",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_outputs.BaseModelOutputWithPooling"
>transformers.modeling_outputs.BaseModelOutputWithPooling</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Oo=new Is({props:{$$slots:{default:[lk]},$$scope:{ctx:x}}}),Do=new To({props:{anchor:"transformers.TapasModel.forward.example",$$slots:{default:[dk]},$$scope:{ctx:x}}}),or=new Pt({}),nr=new it({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.29.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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/tapas/modeling_tapas.py#L993"}}),lr=new it({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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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.29.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.29.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.29.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.29.0/src/transformers/models/tapas/modeling_tapas.py#L1013",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_outputs.MaskedLMOutput"
>transformers.modeling_outputs.MaskedLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Lo=new Is({props:{$$slots:{default:[pk]},$$scope:{ctx:x}}}),Qo=new To({props:{anchor:"transformers.TapasForMaskedLM.forward.example",$$slots:{default:[ck]},$$scope:{ctx:x}}}),dr=new Pt({}),pr=new it({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.29.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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/tapas/modeling_tapas.py#L1454"}}),mr=new it({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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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.29.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.29.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.29.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.29.0/src/transformers/models/tapas/modeling_tapas.py#L1466",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.29.0/en/model_doc/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.29.0/en/main_classes/output#transformers.modeling_outputs.SequenceClassifierOutput"
>transformers.modeling_outputs.SequenceClassifierOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Wo=new Is({props:{$$slots:{default:[hk]},$$scope:{ctx:x}}}),Ho=new To({props:{anchor:"transformers.TapasForSequenceClassification.forward.example",$$slots:{default:[uk]},$$scope:{ctx:x}}}),fr=new Pt({}),gr=new it({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.29.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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/tapas/modeling_tapas.py#L1109"}}),br=new it({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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.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.29.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.29.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.29.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.29.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.29.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.29.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.29.0/src/transformers/models/tapas/modeling_tapas.py#L1144",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.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>
`}}),Ro=new Is({props:{$$slots:{default:[mk]},$$scope:{ctx:x}}}),Bo=new To({props:{anchor:"transformers.TapasForQuestionAnswering.forward.example",$$slots:{default:[fk]},$$scope:{ctx:x}}}),wr=new Pt({}),yr=new it({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.29.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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/tapas/modeling_tf_tapas.py#L985"}}),Ko=new Is({props:{$$slots:{default:[gk]},$$scope:{ctx:x}}}),$r=new it({props:{name:"call",anchor:"transformers.TFTapasModel.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"token_type_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"position_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"inputs_embeds",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = 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:"training",val:": typing.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.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.29.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.29.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.29.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.29.0/src/transformers/models/tapas/modeling_tf_tapas.py#L991",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling"
>transformers.modeling_tf_outputs.TFBaseModelOutputWithPooling</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Vo=new Is({props:{$$slots:{default:[_k]},$$scope:{ctx:x}}}),Yo=new To({props:{anchor:"transformers.TFTapasModel.call.example",$$slots:{default:[vk]},$$scope:{ctx:x}}}),Er=new Pt({}),Ar=new it({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.29.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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/tapas/modeling_tf_tapas.py#L1060"}}),Xo=new Is({props:{$$slots:{default:[Tk]},$$scope:{ctx:x}}}),Pr=new it({props:{name:"call",anchor:"transformers.TFTapasForMaskedLM.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"token_type_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"position_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"inputs_embeds",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = 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:"labels",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"training",val:": typing.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.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.29.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.29.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.29.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.29.0/src/transformers/models/tapas/modeling_tf_tapas.py#L1076",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.0/en/main_classes/output#transformers.modeling_tf_outputs.TFMaskedLMOutput"
>transformers.modeling_tf_outputs.TFMaskedLMOutput</a> or <code>tuple(tf.Tensor)</code></p>
`}}),Zo=new Is({props:{$$slots:{default:[bk]},$$scope:{ctx:x}}}),en=new To({props:{anchor:"transformers.TFTapasForMaskedLM.call.example",$$slots:{default:[wk]},$$scope:{ctx:x}}}),Mr=new Pt({}),Sr=new it({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.29.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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/tapas/modeling_tf_tapas.py#L1602"}}),sn=new Is({props:{$$slots:{default:[yk]},$$scope:{ctx:x}}}),Lr=new it({props:{name:"call",anchor:"transformers.TFTapasForSequenceClassification.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"token_type_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"position_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"inputs_embeds",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = 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:"labels",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"training",val:": typing.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.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.29.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.29.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.29.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.29.0/src/transformers/models/tapas/modeling_tf_tapas.py#L1613",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.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.29.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.29.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 Is({props:{$$slots:{default:[kk]},$$scope:{ctx:x}}}),on=new To({props:{anchor:"transformers.TFTapasForSequenceClassification.call.example",$$slots:{default:[jk]},$$scope:{ctx:x}}}),Qr=new Pt({}),Ir=new it({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.29.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.29.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/tapas/modeling_tf_tapas.py#L1266"}}),rn=new Is({props:{$$slots:{default:[qk]},$$scope:{ctx:x}}}),Rr=new it({props:{name:"call",anchor:"transformers.TFTapasForQuestionAnswering.call",parameters:[{name:"input_ids",val:": typing.Union[typing.List[tensorflow.python.framework.ops.Tensor], typing.List[numpy.ndarray], typing.List[keras.engine.keras_tensor.KerasTensor], typing.Dict[str, tensorflow.python.framework.ops.Tensor], typing.Dict[str, numpy.ndarray], typing.Dict[str, keras.engine.keras_tensor.KerasTensor], tensorflow.python.framework.ops.Tensor, numpy.ndarray, keras.engine.keras_tensor.KerasTensor, NoneType] = None"},{name:"attention_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"token_type_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"position_ids",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"head_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"inputs_embeds",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"table_mask",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"aggregation_labels",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"float_answer",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"numeric_values",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"numeric_values_scale",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = 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:"labels",val:": typing.Union[numpy.ndarray, tensorflow.python.framework.ops.Tensor, NoneType] = None"},{name:"training",val:": typing.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.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.29.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.29.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.29.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.29.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.29.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.29.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.29.0/src/transformers/models/tapas/modeling_tf_tapas.py#L1288",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.29.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>
`}}),ln=new Is({props:{$$slots:{default:[$k]},$$scope:{ctx:x}}}),dn=new To({props:{anchor:"transformers.TFTapasForQuestionAnswering.call.example",$$slots:{default:[Ek]},$$scope:{ctx:x}}}),{c(){l=o("meta"),v=c(),d=o("h1"),f=o("a"),T=o("span"),y(p.$$.fragment),g=c(),A=o("span"),F=s("TAPAS"),H=c(),N=o("h2"),G=o("a"),ae=o("span"),y(w.$$.fragment),B=c(),X=o("span"),S=s("Overview"),U=c(),O=o("p"),C=s("The TAPAS model was proposed in "),W=o("a"),Y=s("TAPAS: Weakly Supervised Table Parsing via Pre-training"),le=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=c(),Z=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:"),ce=c(),ee=o("ul"),_e=o("li"),D=o("a"),L=s("SQA"),I=s(" (Sequential Question Answering by Microsoft)"),P=c(),K=o("li"),R=o("a"),we=s("WTQ"),ze=s(" (Wiki Table Questions by Stanford University)"),he=c(),fe=o("li"),Fe=o("a"),se=s("WikiSQL"),ke=s(" (by Salesforce)."),ve=c(),Pe=o("p"),Ce=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."),je=c(),Me=o("p"),$e=s("The abstract from the paper is the following:"),pe=c(),Se=o("p"),ye=o("em"),J=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."),qe=c(),V=o("p"),We=s("In addition, the authors have further pre-trained TAPAS to recognize "),oe=o("strong"),He=s("table entailment"),Ue=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 "),b=o("a"),M=s("TabFact"),Ve=s(", a large-scale dataset with 16k Wikipedia tables for table entailment (a binary classification task). For more details, see their follow-up paper: "),Te=o("a"),Ye=s("Understanding tables with intermediate pre-training"),Je=s(" by Julian Martin Eisenschlos, Syrine Krichene and Thomas M\xFCller."),Q=c(),Le=o("img"),Qe=c(),Ie=o("small"),Xe=s("TAPAS architecture. Taken from the "),de=o("a"),Ee=s("original blog post"),Ze=s("."),xe=c(),ne=o("p"),et=s("This model was contributed by "),Re=o("a"),re=s("nielsr"),Be=s(". The Tensorflow version of this model was contributed by "),Ae=o("a"),tt=s("kamalkraj"),Mt=s(". The original code can be found "),St=o("a"),Ws=s("here"),Ot=s("."),Ts=c(),ts=o("p"),Dt=s("Tips:"),bs=c(),ut=o("ul"),Oe=o("li"),Hs=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 "),Nt=o("code"),ie=s("reset_position_index_per_cell"),Tt=s(" parameter of "),ss=o("a"),Us=s("TapasConfig"),Lt=s(", which is set to "),ns=o("code"),Rs=s("True"),Qt=s(" by default. The default versions of the models available on the "),It=o("a"),Bs=s("hub"),Wt=s(" all use relative position embeddings. You can still use the ones with absolute position embeddings by passing in an additional argument "),rs=o("code"),Gs=s('revision="no_reset"'),Ht=s(" when calling the "),is=o("code"),Ks=s("from_pretrained()"),Ut=s(" method. Note that it\u2019s usually advised to pad the inputs on the right rather than the left."),Vs=c(),st=o("li"),Rt=s("TAPAS is based on BERT, so "),ls=o("code"),Ys=s("TAPAS-base"),Bt=s(" for example corresponds to a "),ds=o("code"),Js=s("BERT-base"),ps=s(" architecture. Of course, "),lt=o("code"),cs=s("TAPAS-large"),De=s(" will result in the best performance (the results reported in the paper are from "),hs=o("code"),bt=s("TAPAS-large"),Xs=s("). Results of the various sized models are shown on the "),Gt=o("a"),Kt=s("original Github repository"),Zs=s("."),ea=c(),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 "),Vt=o("code"),z=s("labels"),te=s(" of the model to the previous question. See \u201CUsage\u201D section for more info."),ka=c(),sa=o("li"),ja=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=c(),Yt=o("h2"),_t=o("a"),aa=o("span"),y(wt.$$.fragment),qa=c(),oa=o("span"),$a=s("Usage: fine-tuning"),ua=c(),nt=o("p"),fs=s("Here we explain how you can fine-tune "),ws=o("a"),pt=s("TapasForQuestionAnswering"),Ea=s(" on your own dataset."),ma=c(),ys=o("p"),na=o("strong"),gs=s("STEP 1: Choose one of the 3 ways in which you can use TAPAS - or experiment"),fa=c(),be=o("p"),Aa=s("Basically, there are 3 different ways in which one can fine-tune "),ks=o("a"),Fa=s("TapasForQuestionAnswering"),za=s(", corresponding to the different datasets on which Tapas was fine-tuned:"),ga=c(),Ft=o("ol"),ra=o("li"),_s=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)."),xa=c(),Ne=o("li"),Ca=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 "),ia=o("strong"),Pa=s("weak supervision"),Ma=s(", since the model itself must learn the appropriate aggregation operator (SUM/COUNT/AVERAGE/NONE) given only the answer to the question as supervision."),Sa=c(),ue=o("li"),Oa=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 "),la=o("strong"),Da=s("strong supervision"),Na=s(". Here, learning the appropriate aggregation operator is much easier."),_a=c(),js=o("p"),La=s("To summarize:"),va=c(),Ge=o("table"),da=o("thead"),Jt=o("tr"),pa=o("th"),rl=o("strong"),Vc=s("Task"),Yc=c(),il=o("th"),ll=o("strong"),Jc=s("Example dataset"),Xc=c(),dl=o("th"),pl=o("strong"),Zc=s("Description"),eh=c(),Qa=o("tbody"),Ia=o("tr"),cl=o("td"),th=s("Conversational"),sh=c(),hl=o("td"),ah=s("SQA"),oh=c(),ul=o("td"),nh=s("Conversational, only cell selection questions"),rh=c(),Wa=o("tr"),ml=o("td"),ih=s("Weak supervision for aggregation"),lh=c(),fl=o("td"),dh=s("WTQ"),ph=c(),gl=o("td"),ch=s("Questions might involve aggregation, and the model must learn this given only the answer as supervision"),hh=c(),Ha=o("tr"),_l=o("td"),uh=s("Strong supervision for aggregation"),mh=c(),vl=o("td"),fh=s("WikiSQL-supervised"),gh=c(),Tl=o("td"),_h=s("Questions might involve aggregation, and the model must learn this given the gold aggregation operator"),mp=c(),y(bo.$$.fragment),fp=c(),wo=o("p"),vh=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 "),yn=o("a"),Th=s("here"),bh=s(" for more info."),gp=c(),yo=o("p"),wh=s("For a list of all pre-trained and fine-tuned TAPAS checkpoints available on HuggingFace\u2019s  hub, see "),kn=o("a"),yh=s("here"),kh=s("."),_p=c(),Vr=o("p"),bl=o("strong"),jh=s("STEP 2: Prepare your data in the SQA format"),vp=c(),ko=o("p"),qh=s("Second, no matter what you picked above, you should prepare your dataset in the "),jn=o("a"),$h=s("SQA"),Eh=s(" format. This format is a TSV/CSV file with the following columns:"),Tp=c(),rt=o("ul"),Yr=o("li"),wl=o("code"),Ah=s("id"),Fh=s(": optional, id of the table-question pair, for bookkeeping purposes."),zh=c(),Jr=o("li"),yl=o("code"),xh=s("annotator"),Ch=s(": optional, id of the person who annotated the table-question pair, for bookkeeping purposes."),Ph=c(),Xr=o("li"),kl=o("code"),Mh=s("position"),Sh=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."),Oh=c(),Zr=o("li"),jl=o("code"),Dh=s("question"),Nh=s(": string"),Lh=c(),ei=o("li"),ql=o("code"),Qh=s("table_file"),Ih=s(": string, name of a csv file containing the tabular data"),Wh=c(),ti=o("li"),$l=o("code"),Hh=s("answer_coordinates"),Uh=s(": list of one or more tuples (each tuple being a cell coordinate, i.e. row, column pair that is part of the answer)"),Rh=c(),si=o("li"),El=o("code"),Bh=s("answer_text"),Gh=s(": list of one or more strings (each string being a cell value that is part of the answer)"),Kh=c(),ai=o("li"),Al=o("code"),Vh=s("aggregation_label"),Yh=s(": index of the aggregation operator. Only required in case of strong supervision for aggregation (the WikiSQL-supervised case)"),Jh=c(),oi=o("li"),Fl=o("code"),Xh=s("float_answer"),Zh=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)"),bp=c(),zt=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 "),qn=o("a"),tu=s("here"),su=s(". A conversion of this script that works with HuggingFace\u2019s implementation can be found "),$n=o("a"),au=s("here"),ou=s(". Interestingly, these conversion scripts are not perfect (the "),zl=o("code"),nu=s("answer_coordinates"),ru=s(" and "),xl=o("code"),iu=s("float_answer"),lu=s(" fields are populated based on the "),Cl=o("code"),du=s("answer_text"),pu=s("), meaning that WTQ and WikiSQL results could actually be improved."),wp=c(),ni=o("p"),Pl=o("strong"),cu=s("STEP 3: Convert your data into tensors using TapasTokenizer"),yp=c(),y(jo.$$.fragment),kp=c(),Ke=o("p"),hu=s("Note that here, we encode each table-question pair independently. This is fine as long as your dataset is "),Ml=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 "),Sl=o("code"),fu=s("queries"),gu=s(", "),Ol=o("code"),_u=s("answer_coordinates"),vu=s(" and "),Dl=o("code"),Tu=s("answer_text"),bu=s(" per table (in the order of their "),Nl=o("code"),wu=s("position"),yu=s(`
index) and batch encode each table with its questions. This will make sure that the `),Ll=o("code"),ku=s("prev_labels"),ju=s(" token types (see docs of "),ri=o("a"),qu=s("TapasTokenizer"),$u=s(") are set correctly. See "),En=o("a"),Eu=s("this notebook"),Au=s(" for more info. See "),An=o("a"),Fu=s("this notebook"),zu=s(" for more info regarding using the TensorFlow model."),jp=c(),ii=o("p"),xu=s("**STEP 4: Train (fine-tune) the model"),qp=c(),y(qo.$$.fragment),$p=c(),Ua=o("h2"),$o=o("a"),Ql=o("span"),y(Fn.$$.fragment),Cu=c(),Il=o("span"),Pu=s("Usage: inference"),Ep=c(),y(Eo.$$.fragment),Ap=c(),xt=o("p"),Mu=s("In case of a conversational set-up, then each table-question pair must be provided "),Wl=o("strong"),Su=s("sequentially"),Ou=s(" to the model, such that the "),Hl=o("code"),Du=s("prev_labels"),Nu=s(" token types can be overwritten by the predicted "),Ul=o("code"),Lu=s("labels"),Qu=s(" of the previous table-question pair. Again, more info can be found in "),zn=o("a"),Iu=s("this notebook"),Wu=s(" (for PyTorch) and "),xn=o("a"),Hu=s("this notebook"),Uu=s(" (for TensorFlow)."),Fp=c(),Ra=o("h2"),Ao=o("a"),Rl=o("span"),y(Cn.$$.fragment),Ru=c(),Bl=o("span"),Bu=s("Documentation resources"),zp=c(),Fo=o("ul"),Gl=o("li"),li=o("a"),Gu=s("Text classification task guide"),Ku=c(),Kl=o("li"),di=o("a"),Vu=s("Masked language modeling task guide"),xp=c(),Ba=o("h2"),zo=o("a"),Vl=o("span"),y(Pn.$$.fragment),Yu=c(),Yl=o("span"),Ju=s("TAPAS specific outputs"),Cp=c(),Ga=o("div"),y(Mn.$$.fragment),Xu=c(),Sn=o("p"),Zu=s("Output type of "),pi=o("a"),em=s("TapasForQuestionAnswering"),tm=s("."),Pp=c(),Ka=o("h2"),xo=o("a"),Jl=o("span"),y(On.$$.fragment),sm=c(),Xl=o("span"),am=s("TapasConfig"),Mp=c(),Xt=o("div"),y(Dn.$$.fragment),om=c(),Va=o("p"),nm=s("This is the configuration class to store the configuration of a "),ci=o("a"),rm=s("TapasModel"),im=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
`),Nn=o("a"),lm=s("google/tapas-base-finetuned-sqa"),dm=s(" architecture."),pm=c(),Ya=o("p"),cm=s("Configuration objects inherit from "),Zl=o("code"),hm=s("PreTrainedConfig"),um=s(` and can be used to control the model outputs. Read the
documentation from `),hi=o("a"),mm=s("PretrainedConfig"),fm=s(" for more information."),gm=c(),Ln=o("p"),_m=s(`Hyperparameters additional to BERT are taken from run_task_main.py and hparam_utils.py of the original
implementation. Original implementation available at `),Qn=o("a"),vm=s("https://github.com/google-research/tapas/tree/master"),Tm=s("."),bm=c(),y(Co.$$.fragment),Sp=c(),Ja=o("h2"),Po=o("a"),ed=o("span"),y(In.$$.fragment),wm=c(),td=o("span"),ym=s("TapasTokenizer"),Op=c(),ct=o("div"),y(Wn.$$.fragment),km=c(),sd=o("p"),jm=s(`Construct a TAPAS tokenizer. Based on WordPiece. Flattens a table and one or more related sentences to be used by
TAPAS models.`),qm=c(),at=o("p"),$m=s("This tokenizer inherits from "),ui=o("a"),Em=s("PreTrainedTokenizer"),Am=s(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods. `),mi=o("a"),Fm=s("TapasTokenizer"),zm=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"),xm=s("segment_ids"),Cm=s(`,
`),od=o("code"),Pm=s("column_ids"),Mm=s(", "),nd=o("code"),Sm=s("row_ids"),Om=s(", "),rd=o("code"),Dm=s("prev_labels"),Nm=s(", "),id=o("code"),Lm=s("column_ranks"),Qm=s(", "),ld=o("code"),Im=s("inv_column_ranks"),Wm=s(" and "),dd=o("code"),Hm=s("numeric_relations"),Um=s(":"),Rm=c(),yt=o("ul"),pd=o("li"),Bm=s(`segment_ids: indicate whether a token belongs to the question (0) or the table (1). 0 for special tokens and
padding.`),Gm=c(),cd=o("li"),Km=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.`),Vm=c(),hd=o("li"),Ym=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.`),Jm=c(),ud=o("li"),Xm=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).`),Zm=c(),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=c(),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=c(),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=c(),fi=o("p"),gi=o("a"),rf=s("TapasTokenizer"),lf=s(` runs end-to-end tokenization on a table and associated sentences: punctuation splitting and
wordpiece.`),df=c(),Mo=o("div"),y(Hn.$$.fragment),pf=c(),_d=o("p"),cf=s("Main method to tokenize and prepare for the model one or several sequence(s) related to a table."),hf=c(),Ta=o("div"),y(Un.$$.fragment),uf=c(),Rn=o("p"),mf=s("Converts logits of "),_i=o("a"),ff=s("TapasForQuestionAnswering"),gf=s(` to actual predicted answer coordinates and optional
aggregation indices.`),_f=c(),Bn=o("p"),vf=s(`The original implementation, on which this function is based, can be found
`),Gn=o("a"),Tf=s("here"),bf=s("."),wf=c(),vi=o("div"),y(Kn.$$.fragment),Dp=c(),Xa=o("h2"),So=o("a"),vd=o("span"),y(Vn.$$.fragment),yf=c(),Td=o("span"),kf=s("TapasModel"),Np=c(),kt=o("div"),y(Yn.$$.fragment),jf=c(),Jn=o("p"),qf=s(`The bare Tapas Model transformer outputting raw hidden-states without any specific head on top.
This model inherits from `),Ti=o("a"),$f=s("PreTrainedModel"),Ef=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.)`),Af=c(),Xn=o("p"),Ff=s("This model is also a PyTorch "),Zn=o("a"),zf=s("torch.nn.Module"),xf=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Cf=c(),er=o("p"),Pf=s("This class is a small change compared to "),bi=o("a"),Mf=s("BertModel"),Sf=s(", taking into account the additional token type ids."),Of=c(),tr=o("p"),Df=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 `),sr=o("a"),Nf=s(`Attention is
all you need`),Lf=s(` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),Qf=c(),qs=o("div"),y(ar.$$.fragment),If=c(),Za=o("p"),Wf=s("The "),wi=o("a"),Hf=s("TapasModel"),Uf=s(" forward method, overrides the "),bd=o("code"),Rf=s("__call__"),Bf=s(" special method."),Gf=c(),y(Oo.$$.fragment),Kf=c(),y(Do.$$.fragment),Lp=c(),eo=o("h2"),No=o("a"),wd=o("span"),y(or.$$.fragment),Vf=c(),yd=o("span"),Yf=s("TapasForMaskedLM"),Qp=c(),vs=o("div"),y(nr.$$.fragment),Jf=c(),to=o("p"),Xf=s("Tapas Model with a "),kd=o("code"),Zf=s("language modeling"),eg=s(` head on top.
This model inherits from `),yi=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=c(),rr=o("p"),og=s("This model is also a PyTorch "),ir=o("a"),ng=s("torch.nn.Module"),rg=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=c(),$s=o("div"),y(lr.$$.fragment),lg=c(),so=o("p"),dg=s("The "),ki=o("a"),pg=s("TapasForMaskedLM"),cg=s(" forward method, overrides the "),jd=o("code"),hg=s("__call__"),ug=s(" special method."),mg=c(),y(Lo.$$.fragment),fg=c(),y(Qo.$$.fragment),Ip=c(),ao=o("h2"),Io=o("a"),qd=o("span"),y(dr.$$.fragment),gg=c(),$d=o("span"),_g=s("TapasForSequenceClassification"),Wp=c(),Zt=o("div"),y(pr.$$.fragment),vg=c(),Ed=o("p"),Tg=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).`),bg=c(),cr=o("p"),wg=s("This model inherits from "),ji=o("a"),yg=s("PreTrainedModel"),kg=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.)`),jg=c(),hr=o("p"),qg=s("This model is also a PyTorch "),ur=o("a"),$g=s("torch.nn.Module"),Eg=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ag=c(),Es=o("div"),y(mr.$$.fragment),Fg=c(),oo=o("p"),zg=s("The "),qi=o("a"),xg=s("TapasForSequenceClassification"),Cg=s(" forward method, overrides the "),Ad=o("code"),Pg=s("__call__"),Mg=s(" special method."),Sg=c(),y(Wo.$$.fragment),Og=c(),y(Ho.$$.fragment),Hp=c(),no=o("h2"),Uo=o("a"),Fd=o("span"),y(fr.$$.fragment),Dg=c(),zd=o("span"),Ng=s("TapasForQuestionAnswering"),Up=c(),es=o("div"),y(gr.$$.fragment),Lg=c(),ro=o("p"),Qg=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 `),xd=o("code"),Ig=s("logits"),Wg=s(" and optional "),Cd=o("code"),Hg=s("logits_aggregation"),Ug=s(`), e.g. for
SQA, WTQ or WikiSQL-supervised tasks.`),Rg=c(),_r=o("p"),Bg=s("This model inherits from "),$i=o("a"),Gg=s("PreTrainedModel"),Kg=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=c(),vr=o("p"),Yg=s("This model is also a PyTorch "),Tr=o("a"),Jg=s("torch.nn.Module"),Xg=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Zg=c(),As=o("div"),y(br.$$.fragment),e_=c(),io=o("p"),t_=s("The "),Ei=o("a"),s_=s("TapasForQuestionAnswering"),a_=s(" forward method, overrides the "),Pd=o("code"),o_=s("__call__"),n_=s(" special method."),r_=c(),y(Ro.$$.fragment),i_=c(),y(Bo.$$.fragment),Rp=c(),lo=o("h2"),Go=o("a"),Md=o("span"),y(wr.$$.fragment),l_=c(),Sd=o("span"),d_=s("TFTapasModel"),Bp=c(),jt=o("div"),y(yr.$$.fragment),p_=c(),Od=o("p"),c_=s("The bare Tapas Model transformer outputting raw hidden-states without any specific head on top."),h_=c(),kr=o("p"),u_=s("This model inherits from "),Ai=o("a"),m_=s("TFPreTrainedModel"),f_=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.)`),g_=c(),jr=o("p"),__=s("This model is also a "),qr=o("a"),v_=s("tf.keras.Model"),T_=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.`),b_=c(),y(Ko.$$.fragment),w_=c(),Fs=o("div"),y($r.$$.fragment),y_=c(),po=o("p"),k_=s("The "),Fi=o("a"),j_=s("TFTapasModel"),q_=s(" forward method, overrides the "),Dd=o("code"),$_=s("__call__"),E_=s(" special method."),A_=c(),y(Vo.$$.fragment),F_=c(),y(Yo.$$.fragment),Gp=c(),co=o("h2"),Jo=o("a"),Nd=o("span"),y(Er.$$.fragment),z_=c(),Ld=o("span"),x_=s("TFTapasForMaskedLM"),Kp=c(),qt=o("div"),y(Ar.$$.fragment),C_=c(),Fr=o("p"),P_=s("Tapas Model with a "),Qd=o("code"),M_=s("language modeling"),S_=s(" head on top."),O_=c(),zr=o("p"),D_=s("This model inherits from "),zi=o("a"),N_=s("TFPreTrainedModel"),L_=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.)`),Q_=c(),xr=o("p"),I_=s("This model is also a "),Cr=o("a"),W_=s("tf.keras.Model"),H_=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.`),U_=c(),y(Xo.$$.fragment),R_=c(),zs=o("div"),y(Pr.$$.fragment),B_=c(),ho=o("p"),G_=s("The "),xi=o("a"),K_=s("TFTapasForMaskedLM"),V_=s(" forward method, overrides the "),Id=o("code"),Y_=s("__call__"),J_=s(" special method."),X_=c(),y(Zo.$$.fragment),Z_=c(),y(en.$$.fragment),Vp=c(),uo=o("h2"),tn=o("a"),Wd=o("span"),y(Mr.$$.fragment),ev=c(),Hd=o("span"),tv=s("TFTapasForSequenceClassification"),Yp=c(),$t=o("div"),y(Sr.$$.fragment),sv=c(),Ud=o("p"),av=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).`),ov=c(),Or=o("p"),nv=s("This model inherits from "),Ci=o("a"),rv=s("TFPreTrainedModel"),iv=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.)`),lv=c(),Dr=o("p"),dv=s("This model is also a "),Nr=o("a"),pv=s("tf.keras.Model"),cv=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.`),hv=c(),y(sn.$$.fragment),uv=c(),xs=o("div"),y(Lr.$$.fragment),mv=c(),mo=o("p"),fv=s("The "),Pi=o("a"),gv=s("TFTapasForSequenceClassification"),_v=s(" forward method, overrides the "),Rd=o("code"),vv=s("__call__"),Tv=s(" special method."),bv=c(),y(an.$$.fragment),wv=c(),y(on.$$.fragment),Jp=c(),fo=o("h2"),nn=o("a"),Bd=o("span"),y(Qr.$$.fragment),yv=c(),Gd=o("span"),kv=s("TFTapasForQuestionAnswering"),Xp=c(),Et=o("div"),y(Ir.$$.fragment),jv=c(),go=o("p"),qv=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 `),Kd=o("code"),$v=s("logits"),Ev=s(" and optional "),Vd=o("code"),Av=s("logits_aggregation"),Fv=s(`), e.g. for
SQA, WTQ or WikiSQL-supervised tasks.`),zv=c(),Wr=o("p"),xv=s("This model inherits from "),Mi=o("a"),Cv=s("TFPreTrainedModel"),Pv=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.)`),Mv=c(),Hr=o("p"),Sv=s("This model is also a "),Ur=o("a"),Ov=s("tf.keras.Model"),Dv=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.`),Nv=c(),y(rn.$$.fragment),Lv=c(),Cs=o("div"),y(Rr.$$.fragment),Qv=c(),_o=o("p"),Iv=s("The "),Si=o("a"),Wv=s("TFTapasForQuestionAnswering"),Hv=s(" forward method, overrides the "),Yd=o("code"),Uv=s("__call__"),Rv=s(" special method."),Bv=c(),y(ln.$$.fragment),Gv=c(),y(dn.$$.fragment),this.h()},l(i){const _=Wy('[data-svelte="svelte-1phssyn"]',document.head);l=n(_,"META",{name:!0,content:!0}),_.forEach(t),v=h(i),d=n(i,"H1",{class:!0});var Br=r(d);f=n(Br,"A",{id:!0,class:!0,href:!0});var Jd=r(f);T=n(Jd,"SPAN",{});var Xd=r(T);k(p.$$.fragment,Xd),Xd.forEach(t),Jd.forEach(t),g=h(Br),A=n(Br,"SPAN",{});var Zd=r(A);F=a(Zd,"TAPAS"),Zd.forEach(t),Br.forEach(t),H=h(i),N=n(i,"H2",{class:!0});var Gr=r(N);G=n(Gr,"A",{id:!0,class:!0,href:!0});var ep=r(G);ae=n(ep,"SPAN",{});var tp=r(ae);k(w.$$.fragment,tp),tp.forEach(t),ep.forEach(t),B=h(Gr),X=n(Gr,"SPAN",{});var sp=r(X);S=a(sp,"Overview"),sp.forEach(t),Gr.forEach(t),U=h(i),O=n(i,"P",{});var Kr=r(O);C=a(Kr,"The TAPAS model was proposed in "),W=n(Kr,"A",{href:!0,rel:!0});var ap=r(W);Y=a(ap,"TAPAS: Weakly Supervised Table Parsing via Pre-training"),ap.forEach(t),le=a(Kr,`
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.`),Kr.forEach(t),me=h(i),Z=n(i,"P",{});var op=r(Z);ge=a(op,"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:"),op.forEach(t),ce=h(i),ee=n(i,"UL",{});var vo=r(ee);_e=n(vo,"LI",{});var Oi=r(_e);D=n(Oi,"A",{href:!0,rel:!0});var np=r(D);L=a(np,"SQA"),np.forEach(t),I=a(Oi," (Sequential Question Answering by Microsoft)"),Oi.forEach(t),P=h(vo),K=n(vo,"LI",{});var Di=r(K);R=n(Di,"A",{href:!0,rel:!0});var rp=r(R);we=a(rp,"WTQ"),rp.forEach(t),ze=a(Di," (Wiki Table Questions by Stanford University)"),Di.forEach(t),he=h(vo),fe=n(vo,"LI",{});var Ni=r(fe);Fe=n(Ni,"A",{href:!0,rel:!0});var ip=r(Fe);se=a(ip,"WikiSQL"),ip.forEach(t),ke=a(Ni," (by Salesforce)."),Ni.forEach(t),vo.forEach(t),ve=h(i),Pe=n(i,"P",{});var lp=r(Pe);Ce=a(lp,"It achieves state-of-the-art on both SQA and WTQ, while having comparable performance to SOTA on WikiSQL, with a much simpler architecture."),lp.forEach(t),je=h(i),Me=n(i,"P",{});var dp=r(Me);$e=a(dp,"The abstract from the paper is the following:"),dp.forEach(t),pe=h(i),Se=n(i,"P",{});var pp=r(Se);ye=n(pp,"EM",{});var cp=r(ye);J=a(cp,"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."),cp.forEach(t),pp.forEach(t),qe=h(i),V=n(i,"P",{});var ca=r(V);We=a(ca,"In addition, the authors have further pre-trained TAPAS to recognize "),oe=n(ca,"STRONG",{});var hp=r(oe);He=a(hp,"table entailment"),hp.forEach(t),Ue=a(ca,", 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 "),b=n(ca,"A",{href:!0,rel:!0});var up=r(b);M=a(up,"TabFact"),up.forEach(t),Ve=a(ca,", a large-scale dataset with 16k Wikipedia tables for table entailment (a binary classification task). For more details, see their follow-up paper: "),Te=n(ca,"A",{href:!0,rel:!0});var oT=r(Te);Ye=a(oT,"Understanding tables with intermediate pre-training"),oT.forEach(t),Je=a(ca," by Julian Martin Eisenschlos, Syrine Krichene and Thomas M\xFCller."),ca.forEach(t),Q=h(i),Le=n(i,"IMG",{src:!0,alt:!0,width:!0}),Qe=h(i),Ie=n(i,"SMALL",{});var ec=r(Ie);Xe=a(ec,"TAPAS architecture. Taken from the "),de=n(ec,"A",{href:!0});var nT=r(de);Ee=a(nT,"original blog post"),nT.forEach(t),Ze=a(ec,"."),ec.forEach(t),xe=h(i),ne=n(i,"P",{});var pn=r(ne);et=a(pn,"This model was contributed by "),Re=n(pn,"A",{href:!0,rel:!0});var rT=r(Re);re=a(rT,"nielsr"),rT.forEach(t),Be=a(pn,". The Tensorflow version of this model was contributed by "),Ae=n(pn,"A",{href:!0,rel:!0});var iT=r(Ae);tt=a(iT,"kamalkraj"),iT.forEach(t),Mt=a(pn,". The original code can be found "),St=n(pn,"A",{href:!0,rel:!0});var lT=r(St);Ws=a(lT,"here"),lT.forEach(t),Ot=a(pn,"."),pn.forEach(t),Ts=h(i),ts=n(i,"P",{});var dT=r(ts);Dt=a(dT,"Tips:"),dT.forEach(t),bs=h(i),ut=n(i,"UL",{});var cn=r(ut);Oe=n(cn,"LI",{});var as=r(Oe);Hs=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 "),Nt=n(as,"CODE",{});var pT=r(Nt);ie=a(pT,"reset_position_index_per_cell"),pT.forEach(t),Tt=a(as," parameter of "),ss=n(as,"A",{href:!0});var cT=r(ss);Us=a(cT,"TapasConfig"),cT.forEach(t),Lt=a(as,", which is set to "),ns=n(as,"CODE",{});var hT=r(ns);Rs=a(hT,"True"),hT.forEach(t),Qt=a(as," by default. The default versions of the models available on the "),It=n(as,"A",{href:!0,rel:!0});var uT=r(It);Bs=a(uT,"hub"),uT.forEach(t),Wt=a(as," all use relative position embeddings. You can still use the ones with absolute position embeddings by passing in an additional argument "),rs=n(as,"CODE",{});var mT=r(rs);Gs=a(mT,'revision="no_reset"'),mT.forEach(t),Ht=a(as," when calling the "),is=n(as,"CODE",{});var fT=r(is);Ks=a(fT,"from_pretrained()"),fT.forEach(t),Ut=a(as," method. Note that it\u2019s usually advised to pad the inputs on the right rather than the left."),as.forEach(t),Vs=h(cn),st=n(cn,"LI",{});var Ps=r(st);Rt=a(Ps,"TAPAS is based on BERT, so "),ls=n(Ps,"CODE",{});var gT=r(ls);Ys=a(gT,"TAPAS-base"),gT.forEach(t),Bt=a(Ps," for example corresponds to a "),ds=n(Ps,"CODE",{});var _T=r(ds);Js=a(_T,"BERT-base"),_T.forEach(t),ps=a(Ps," architecture. Of course, "),lt=n(Ps,"CODE",{});var vT=r(lt);cs=a(vT,"TAPAS-large"),vT.forEach(t),De=a(Ps," will result in the best performance (the results reported in the paper are from "),hs=n(Ps,"CODE",{});var TT=r(hs);bt=a(TT,"TAPAS-large"),TT.forEach(t),Xs=a(Ps,"). Results of the various sized models are shown on the "),Gt=n(Ps,"A",{href:!0,rel:!0});var bT=r(Gt);Kt=a(bT,"original Github repository"),bT.forEach(t),Zs=a(Ps,"."),Ps.forEach(t),ea=h(cn),dt=n(cn,"LI",{});var Li=r(dt);ta=a(Li,"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(Li,"CODE",{});var wT=r(us);ms=a(wT,"prev_labels"),wT.forEach(t),gt=a(Li," token type ids can be overwritten by the predicted "),Vt=n(Li,"CODE",{});var yT=r(Vt);z=a(yT,"labels"),yT.forEach(t),te=a(Li," of the model to the previous question. See \u201CUsage\u201D section for more info."),Li.forEach(t),ka=h(cn),sa=n(cn,"LI",{});var kT=r(sa);ja=a(kT,"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."),kT.forEach(t),cn.forEach(t),ha=h(i),Yt=n(i,"H2",{class:!0});var tc=r(Yt);_t=n(tc,"A",{id:!0,class:!0,href:!0});var jT=r(_t);aa=n(jT,"SPAN",{});var qT=r(aa);k(wt.$$.fragment,qT),qT.forEach(t),jT.forEach(t),qa=h(tc),oa=n(tc,"SPAN",{});var $T=r(oa);$a=a($T,"Usage: fine-tuning"),$T.forEach(t),tc.forEach(t),ua=h(i),nt=n(i,"P",{});var sc=r(nt);fs=a(sc,"Here we explain how you can fine-tune "),ws=n(sc,"A",{href:!0});var ET=r(ws);pt=a(ET,"TapasForQuestionAnswering"),ET.forEach(t),Ea=a(sc," on your own dataset."),sc.forEach(t),ma=h(i),ys=n(i,"P",{});var AT=r(ys);na=n(AT,"STRONG",{});var FT=r(na);gs=a(FT,"STEP 1: Choose one of the 3 ways in which you can use TAPAS - or experiment"),FT.forEach(t),AT.forEach(t),fa=h(i),be=n(i,"P",{});var ac=r(be);Aa=a(ac,"Basically, there are 3 different ways in which one can fine-tune "),ks=n(ac,"A",{href:!0});var zT=r(ks);Fa=a(zT,"TapasForQuestionAnswering"),zT.forEach(t),za=a(ac,", corresponding to the different datasets on which Tapas was fine-tuned:"),ac.forEach(t),ga=h(i),Ft=n(i,"OL",{});var Qi=r(Ft);ra=n(Qi,"LI",{});var xT=r(ra);_s=a(xT,"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)."),xT.forEach(t),xa=h(Qi),Ne=n(Qi,"LI",{});var oc=r(Ne);Ca=a(oc,"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 "),ia=n(oc,"STRONG",{});var CT=r(ia);Pa=a(CT,"weak supervision"),CT.forEach(t),Ma=a(oc,", since the model itself must learn the appropriate aggregation operator (SUM/COUNT/AVERAGE/NONE) given only the answer to the question as supervision."),oc.forEach(t),Sa=h(Qi),ue=n(Qi,"LI",{});var nc=r(ue);Oa=a(nc,"WikiSQL-supervised: this dataset is based on WikiSQL with the model being given the ground truth aggregation operator during training. This is also called "),la=n(nc,"STRONG",{});var PT=r(la);Da=a(PT,"strong supervision"),PT.forEach(t),Na=a(nc,". Here, learning the appropriate aggregation operator is much easier."),nc.forEach(t),Qi.forEach(t),_a=h(i),js=n(i,"P",{});var MT=r(js);La=a(MT,"To summarize:"),MT.forEach(t),va=h(i),Ge=n(i,"TABLE",{});var rc=r(Ge);da=n(rc,"THEAD",{});var ST=r(da);Jt=n(ST,"TR",{});var Ii=r(Jt);pa=n(Ii,"TH",{});var OT=r(pa);rl=n(OT,"STRONG",{});var DT=r(rl);Vc=a(DT,"Task"),DT.forEach(t),OT.forEach(t),Yc=h(Ii),il=n(Ii,"TH",{});var NT=r(il);ll=n(NT,"STRONG",{});var LT=r(ll);Jc=a(LT,"Example dataset"),LT.forEach(t),NT.forEach(t),Xc=h(Ii),dl=n(Ii,"TH",{});var QT=r(dl);pl=n(QT,"STRONG",{});var IT=r(pl);Zc=a(IT,"Description"),IT.forEach(t),QT.forEach(t),Ii.forEach(t),ST.forEach(t),eh=h(rc),Qa=n(rc,"TBODY",{});var Wi=r(Qa);Ia=n(Wi,"TR",{});var Hi=r(Ia);cl=n(Hi,"TD",{});var WT=r(cl);th=a(WT,"Conversational"),WT.forEach(t),sh=h(Hi),hl=n(Hi,"TD",{});var HT=r(hl);ah=a(HT,"SQA"),HT.forEach(t),oh=h(Hi),ul=n(Hi,"TD",{});var UT=r(ul);nh=a(UT,"Conversational, only cell selection questions"),UT.forEach(t),Hi.forEach(t),rh=h(Wi),Wa=n(Wi,"TR",{});var Ui=r(Wa);ml=n(Ui,"TD",{});var RT=r(ml);ih=a(RT,"Weak supervision for aggregation"),RT.forEach(t),lh=h(Ui),fl=n(Ui,"TD",{});var BT=r(fl);dh=a(BT,"WTQ"),BT.forEach(t),ph=h(Ui),gl=n(Ui,"TD",{});var GT=r(gl);ch=a(GT,"Questions might involve aggregation, and the model must learn this given only the answer as supervision"),GT.forEach(t),Ui.forEach(t),hh=h(Wi),Ha=n(Wi,"TR",{});var Ri=r(Ha);_l=n(Ri,"TD",{});var KT=r(_l);uh=a(KT,"Strong supervision for aggregation"),KT.forEach(t),mh=h(Ri),vl=n(Ri,"TD",{});var VT=r(vl);fh=a(VT,"WikiSQL-supervised"),VT.forEach(t),gh=h(Ri),Tl=n(Ri,"TD",{});var YT=r(Tl);_h=a(YT,"Questions might involve aggregation, and the model must learn this given the gold aggregation operator"),YT.forEach(t),Ri.forEach(t),Wi.forEach(t),rc.forEach(t),mp=h(i),k(bo.$$.fragment,i),fp=h(i),wo=n(i,"P",{});var ic=r(wo);vh=a(ic,"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 "),yn=n(ic,"A",{href:!0,rel:!0});var JT=r(yn);Th=a(JT,"here"),JT.forEach(t),bh=a(ic," for more info."),ic.forEach(t),gp=h(i),yo=n(i,"P",{});var lc=r(yo);wh=a(lc,"For a list of all pre-trained and fine-tuned TAPAS checkpoints available on HuggingFace\u2019s  hub, see "),kn=n(lc,"A",{href:!0,rel:!0});var XT=r(kn);yh=a(XT,"here"),XT.forEach(t),kh=a(lc,"."),lc.forEach(t),_p=h(i),Vr=n(i,"P",{});var ZT=r(Vr);bl=n(ZT,"STRONG",{});var eb=r(bl);jh=a(eb,"STEP 2: Prepare your data in the SQA format"),eb.forEach(t),ZT.forEach(t),vp=h(i),ko=n(i,"P",{});var dc=r(ko);qh=a(dc,"Second, no matter what you picked above, you should prepare your dataset in the "),jn=n(dc,"A",{href:!0,rel:!0});var tb=r(jn);$h=a(tb,"SQA"),tb.forEach(t),Eh=a(dc," format. This format is a TSV/CSV file with the following columns:"),dc.forEach(t),Tp=h(i),rt=n(i,"UL",{});var vt=r(rt);Yr=n(vt,"LI",{});var Kv=r(Yr);wl=n(Kv,"CODE",{});var sb=r(wl);Ah=a(sb,"id"),sb.forEach(t),Fh=a(Kv,": optional, id of the table-question pair, for bookkeeping purposes."),Kv.forEach(t),zh=h(vt),Jr=n(vt,"LI",{});var Vv=r(Jr);yl=n(Vv,"CODE",{});var ab=r(yl);xh=a(ab,"annotator"),ab.forEach(t),Ch=a(Vv,": optional, id of the person who annotated the table-question pair, for bookkeeping purposes."),Vv.forEach(t),Ph=h(vt),Xr=n(vt,"LI",{});var Yv=r(Xr);kl=n(Yv,"CODE",{});var ob=r(kl);Mh=a(ob,"position"),ob.forEach(t),Sh=a(Yv,": 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."),Yv.forEach(t),Oh=h(vt),Zr=n(vt,"LI",{});var Jv=r(Zr);jl=n(Jv,"CODE",{});var nb=r(jl);Dh=a(nb,"question"),nb.forEach(t),Nh=a(Jv,": string"),Jv.forEach(t),Lh=h(vt),ei=n(vt,"LI",{});var Xv=r(ei);ql=n(Xv,"CODE",{});var rb=r(ql);Qh=a(rb,"table_file"),rb.forEach(t),Ih=a(Xv,": string, name of a csv file containing the tabular data"),Xv.forEach(t),Wh=h(vt),ti=n(vt,"LI",{});var Zv=r(ti);$l=n(Zv,"CODE",{});var ib=r($l);Hh=a(ib,"answer_coordinates"),ib.forEach(t),Uh=a(Zv,": list of one or more tuples (each tuple being a cell coordinate, i.e. row, column pair that is part of the answer)"),Zv.forEach(t),Rh=h(vt),si=n(vt,"LI",{});var eT=r(si);El=n(eT,"CODE",{});var lb=r(El);Bh=a(lb,"answer_text"),lb.forEach(t),Gh=a(eT,": list of one or more strings (each string being a cell value that is part of the answer)"),eT.forEach(t),Kh=h(vt),ai=n(vt,"LI",{});var tT=r(ai);Al=n(tT,"CODE",{});var db=r(Al);Vh=a(db,"aggregation_label"),db.forEach(t),Yh=a(tT,": index of the aggregation operator. Only required in case of strong supervision for aggregation (the WikiSQL-supervised case)"),tT.forEach(t),Jh=h(vt),oi=n(vt,"LI",{});var sT=r(oi);Fl=n(sT,"CODE",{});var pb=r(Fl);Xh=a(pb,"float_answer"),pb.forEach(t),Zh=a(sT,": 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)"),sT.forEach(t),vt.forEach(t),bp=h(i),zt=n(i,"P",{});var Ms=r(zt);eu=a(Ms,"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 "),qn=n(Ms,"A",{href:!0,rel:!0});var cb=r(qn);tu=a(cb,"here"),cb.forEach(t),su=a(Ms,". A conversion of this script that works with HuggingFace\u2019s implementation can be found "),$n=n(Ms,"A",{href:!0,rel:!0});var hb=r($n);au=a(hb,"here"),hb.forEach(t),ou=a(Ms,". Interestingly, these conversion scripts are not perfect (the "),zl=n(Ms,"CODE",{});var ub=r(zl);nu=a(ub,"answer_coordinates"),ub.forEach(t),ru=a(Ms," and "),xl=n(Ms,"CODE",{});var mb=r(xl);iu=a(mb,"float_answer"),mb.forEach(t),lu=a(Ms," fields are populated based on the "),Cl=n(Ms,"CODE",{});var fb=r(Cl);du=a(fb,"answer_text"),fb.forEach(t),pu=a(Ms,"), meaning that WTQ and WikiSQL results could actually be improved."),Ms.forEach(t),wp=h(i),ni=n(i,"P",{});var gb=r(ni);Pl=n(gb,"STRONG",{});var _b=r(Pl);cu=a(_b,"STEP 3: Convert your data into tensors using TapasTokenizer"),_b.forEach(t),gb.forEach(t),yp=h(i),k(jo.$$.fragment,i),kp=h(i),Ke=n(i,"P",{});var mt=r(Ke);hu=a(mt,"Note that here, we encode each table-question pair independently. This is fine as long as your dataset is "),Ml=n(mt,"STRONG",{});var vb=r(Ml);uu=a(vb,"not conversational"),vb.forEach(t),mu=a(mt,". In case your dataset involves conversational questions (such as in SQA), then you should first group together the "),Sl=n(mt,"CODE",{});var Tb=r(Sl);fu=a(Tb,"queries"),Tb.forEach(t),gu=a(mt,", "),Ol=n(mt,"CODE",{});var bb=r(Ol);_u=a(bb,"answer_coordinates"),bb.forEach(t),vu=a(mt," and "),Dl=n(mt,"CODE",{});var wb=r(Dl);Tu=a(wb,"answer_text"),wb.forEach(t),bu=a(mt," per table (in the order of their "),Nl=n(mt,"CODE",{});var yb=r(Nl);wu=a(yb,"position"),yb.forEach(t),yu=a(mt,`
index) and batch encode each table with its questions. This will make sure that the `),Ll=n(mt,"CODE",{});var kb=r(Ll);ku=a(kb,"prev_labels"),kb.forEach(t),ju=a(mt," token types (see docs of "),ri=n(mt,"A",{href:!0});var jb=r(ri);qu=a(jb,"TapasTokenizer"),jb.forEach(t),$u=a(mt,") are set correctly. See "),En=n(mt,"A",{href:!0,rel:!0});var qb=r(En);Eu=a(qb,"this notebook"),qb.forEach(t),Au=a(mt," for more info. See "),An=n(mt,"A",{href:!0,rel:!0});var $b=r(An);Fu=a($b,"this notebook"),$b.forEach(t),zu=a(mt," for more info regarding using the TensorFlow model."),mt.forEach(t),jp=h(i),ii=n(i,"P",{});var Eb=r(ii);xu=a(Eb,"**STEP 4: Train (fine-tune) the model"),Eb.forEach(t),qp=h(i),k(qo.$$.fragment,i),$p=h(i),Ua=n(i,"H2",{class:!0});var pc=r(Ua);$o=n(pc,"A",{id:!0,class:!0,href:!0});var Ab=r($o);Ql=n(Ab,"SPAN",{});var Fb=r(Ql);k(Fn.$$.fragment,Fb),Fb.forEach(t),Ab.forEach(t),Cu=h(pc),Il=n(pc,"SPAN",{});var zb=r(Il);Pu=a(zb,"Usage: inference"),zb.forEach(t),pc.forEach(t),Ep=h(i),k(Eo.$$.fragment,i),Ap=h(i),xt=n(i,"P",{});var Ss=r(xt);Mu=a(Ss,"In case of a conversational set-up, then each table-question pair must be provided "),Wl=n(Ss,"STRONG",{});var xb=r(Wl);Su=a(xb,"sequentially"),xb.forEach(t),Ou=a(Ss," to the model, such that the "),Hl=n(Ss,"CODE",{});var Cb=r(Hl);Du=a(Cb,"prev_labels"),Cb.forEach(t),Nu=a(Ss," token types can be overwritten by the predicted "),Ul=n(Ss,"CODE",{});var Pb=r(Ul);Lu=a(Pb,"labels"),Pb.forEach(t),Qu=a(Ss," of the previous table-question pair. Again, more info can be found in "),zn=n(Ss,"A",{href:!0,rel:!0});var Mb=r(zn);Iu=a(Mb,"this notebook"),Mb.forEach(t),Wu=a(Ss," (for PyTorch) and "),xn=n(Ss,"A",{href:!0,rel:!0});var Sb=r(xn);Hu=a(Sb,"this notebook"),Sb.forEach(t),Uu=a(Ss," (for TensorFlow)."),Ss.forEach(t),Fp=h(i),Ra=n(i,"H2",{class:!0});var cc=r(Ra);Ao=n(cc,"A",{id:!0,class:!0,href:!0});var Ob=r(Ao);Rl=n(Ob,"SPAN",{});var Db=r(Rl);k(Cn.$$.fragment,Db),Db.forEach(t),Ob.forEach(t),Ru=h(cc),Bl=n(cc,"SPAN",{});var Nb=r(Bl);Bu=a(Nb,"Documentation resources"),Nb.forEach(t),cc.forEach(t),zp=h(i),Fo=n(i,"UL",{});var hc=r(Fo);Gl=n(hc,"LI",{});var Lb=r(Gl);li=n(Lb,"A",{href:!0});var Qb=r(li);Gu=a(Qb,"Text classification task guide"),Qb.forEach(t),Lb.forEach(t),Ku=h(hc),Kl=n(hc,"LI",{});var Ib=r(Kl);di=n(Ib,"A",{href:!0});var Wb=r(di);Vu=a(Wb,"Masked language modeling task guide"),Wb.forEach(t),Ib.forEach(t),hc.forEach(t),xp=h(i),Ba=n(i,"H2",{class:!0});var uc=r(Ba);zo=n(uc,"A",{id:!0,class:!0,href:!0});var Hb=r(zo);Vl=n(Hb,"SPAN",{});var Ub=r(Vl);k(Pn.$$.fragment,Ub),Ub.forEach(t),Hb.forEach(t),Yu=h(uc),Yl=n(uc,"SPAN",{});var Rb=r(Yl);Ju=a(Rb,"TAPAS specific outputs"),Rb.forEach(t),uc.forEach(t),Cp=h(i),Ga=n(i,"DIV",{class:!0});var mc=r(Ga);k(Mn.$$.fragment,mc),Xu=h(mc),Sn=n(mc,"P",{});var fc=r(Sn);Zu=a(fc,"Output type of "),pi=n(fc,"A",{href:!0});var Bb=r(pi);em=a(Bb,"TapasForQuestionAnswering"),Bb.forEach(t),tm=a(fc,"."),fc.forEach(t),mc.forEach(t),Pp=h(i),Ka=n(i,"H2",{class:!0});var gc=r(Ka);xo=n(gc,"A",{id:!0,class:!0,href:!0});var Gb=r(xo);Jl=n(Gb,"SPAN",{});var Kb=r(Jl);k(On.$$.fragment,Kb),Kb.forEach(t),Gb.forEach(t),sm=h(gc),Xl=n(gc,"SPAN",{});var Vb=r(Xl);am=a(Vb,"TapasConfig"),Vb.forEach(t),gc.forEach(t),Mp=h(i),Xt=n(i,"DIV",{class:!0});var ba=r(Xt);k(Dn.$$.fragment,ba),om=h(ba),Va=n(ba,"P",{});var Bi=r(Va);nm=a(Bi,"This is the configuration class to store the configuration of a "),ci=n(Bi,"A",{href:!0});var Yb=r(ci);rm=a(Yb,"TapasModel"),Yb.forEach(t),im=a(Bi,`. 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
`),Nn=n(Bi,"A",{href:!0,rel:!0});var Jb=r(Nn);lm=a(Jb,"google/tapas-base-finetuned-sqa"),Jb.forEach(t),dm=a(Bi," architecture."),Bi.forEach(t),pm=h(ba),Ya=n(ba,"P",{});var Gi=r(Ya);cm=a(Gi,"Configuration objects inherit from "),Zl=n(Gi,"CODE",{});var Xb=r(Zl);hm=a(Xb,"PreTrainedConfig"),Xb.forEach(t),um=a(Gi,` and can be used to control the model outputs. Read the
documentation from `),hi=n(Gi,"A",{href:!0});var Zb=r(hi);mm=a(Zb,"PretrainedConfig"),Zb.forEach(t),fm=a(Gi," for more information."),Gi.forEach(t),gm=h(ba),Ln=n(ba,"P",{});var _c=r(Ln);_m=a(_c,`Hyperparameters additional to BERT are taken from run_task_main.py and hparam_utils.py of the original
implementation. Original implementation available at `),Qn=n(_c,"A",{href:!0,rel:!0});var ew=r(Qn);vm=a(ew,"https://github.com/google-research/tapas/tree/master"),ew.forEach(t),Tm=a(_c,"."),_c.forEach(t),bm=h(ba),k(Co.$$.fragment,ba),ba.forEach(t),Sp=h(i),Ja=n(i,"H2",{class:!0});var vc=r(Ja);Po=n(vc,"A",{id:!0,class:!0,href:!0});var tw=r(Po);ed=n(tw,"SPAN",{});var sw=r(ed);k(In.$$.fragment,sw),sw.forEach(t),tw.forEach(t),wm=h(vc),td=n(vc,"SPAN",{});var aw=r(td);ym=a(aw,"TapasTokenizer"),aw.forEach(t),vc.forEach(t),Op=h(i),ct=n(i,"DIV",{class:!0});var Ct=r(ct);k(Wn.$$.fragment,Ct),km=h(Ct),sd=n(Ct,"P",{});var ow=r(sd);jm=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),qm=h(Ct),at=n(Ct,"P",{});var ft=r(at);$m=a(ft,"This tokenizer inherits from "),ui=n(ft,"A",{href:!0});var nw=r(ui);Em=a(nw,"PreTrainedTokenizer"),nw.forEach(t),Am=a(ft,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods. `),mi=n(ft,"A",{href:!0});var rw=r(mi);Fm=a(rw,"TapasTokenizer"),rw.forEach(t),zm=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 iw=r(ad);xm=a(iw,"segment_ids"),iw.forEach(t),Cm=a(ft,`,
`),od=n(ft,"CODE",{});var lw=r(od);Pm=a(lw,"column_ids"),lw.forEach(t),Mm=a(ft,", "),nd=n(ft,"CODE",{});var dw=r(nd);Sm=a(dw,"row_ids"),dw.forEach(t),Om=a(ft,", "),rd=n(ft,"CODE",{});var pw=r(rd);Dm=a(pw,"prev_labels"),pw.forEach(t),Nm=a(ft,", "),id=n(ft,"CODE",{});var cw=r(id);Lm=a(cw,"column_ranks"),cw.forEach(t),Qm=a(ft,", "),ld=n(ft,"CODE",{});var hw=r(ld);Im=a(hw,"inv_column_ranks"),hw.forEach(t),Wm=a(ft," and "),dd=n(ft,"CODE",{});var uw=r(dd);Hm=a(uw,"numeric_relations"),uw.forEach(t),Um=a(ft,":"),ft.forEach(t),Rm=h(Ct),yt=n(Ct,"UL",{});var os=r(yt);pd=n(os,"LI",{});var mw=r(pd);Bm=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),Gm=h(os),cd=n(os,"LI",{});var fw=r(cd);Km=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),Vm=h(os),hd=n(os,"LI",{});var gw=r(hd);Ym=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),Jm=h(os),ud=n(os,"LI",{});var _w=r(ud);Xm=a(_w,`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).`),_w.forEach(t),Zm=h(os),md=n(os,"LI",{});var vw=r(md);ef=a(vw,`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.`),vw.forEach(t),tf=h(os),fd=n(os,"LI",{});var Tw=r(fd);sf=a(Tw,`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.`),Tw.forEach(t),af=h(os),gd=n(os,"LI",{});var bw=r(gd);of=a(bw,`numeric_relations: indicate numeric relations between the question and the tokens of the table. 0 for all
question tokens, special tokens and padding.`),bw.forEach(t),os.forEach(t),nf=h(Ct),fi=n(Ct,"P",{});var aT=r(fi);gi=n(aT,"A",{href:!0});var ww=r(gi);rf=a(ww,"TapasTokenizer"),ww.forEach(t),lf=a(aT,` runs end-to-end tokenization on a table and associated sentences: punctuation splitting and
wordpiece.`),aT.forEach(t),df=h(Ct),Mo=n(Ct,"DIV",{class:!0});var Tc=r(Mo);k(Hn.$$.fragment,Tc),pf=h(Tc),_d=n(Tc,"P",{});var yw=r(_d);cf=a(yw,"Main method to tokenize and prepare for the model one or several sequence(s) related to a table."),yw.forEach(t),Tc.forEach(t),hf=h(Ct),Ta=n(Ct,"DIV",{class:!0});var Ki=r(Ta);k(Un.$$.fragment,Ki),uf=h(Ki),Rn=n(Ki,"P",{});var bc=r(Rn);mf=a(bc,"Converts logits of "),_i=n(bc,"A",{href:!0});var kw=r(_i);ff=a(kw,"TapasForQuestionAnswering"),kw.forEach(t),gf=a(bc,` to actual predicted answer coordinates and optional
aggregation indices.`),bc.forEach(t),_f=h(Ki),Bn=n(Ki,"P",{});var wc=r(Bn);vf=a(wc,`The original implementation, on which this function is based, can be found
`),Gn=n(wc,"A",{href:!0,rel:!0});var jw=r(Gn);Tf=a(jw,"here"),jw.forEach(t),bf=a(wc,"."),wc.forEach(t),Ki.forEach(t),wf=h(Ct),vi=n(Ct,"DIV",{class:!0});var qw=r(vi);k(Kn.$$.fragment,qw),qw.forEach(t),Ct.forEach(t),Dp=h(i),Xa=n(i,"H2",{class:!0});var yc=r(Xa);So=n(yc,"A",{id:!0,class:!0,href:!0});var $w=r(So);vd=n($w,"SPAN",{});var Ew=r(vd);k(Vn.$$.fragment,Ew),Ew.forEach(t),$w.forEach(t),yf=h(yc),Td=n(yc,"SPAN",{});var Aw=r(Td);kf=a(Aw,"TapasModel"),Aw.forEach(t),yc.forEach(t),Np=h(i),kt=n(i,"DIV",{class:!0});var Os=r(kt);k(Yn.$$.fragment,Os),jf=h(Os),Jn=n(Os,"P",{});var kc=r(Jn);qf=a(kc,`The bare Tapas Model transformer outputting raw hidden-states without any specific head on top.
This model inherits from `),Ti=n(kc,"A",{href:!0});var Fw=r(Ti);$f=a(Fw,"PreTrainedModel"),Fw.forEach(t),Ef=a(kc,`. 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.)`),kc.forEach(t),Af=h(Os),Xn=n(Os,"P",{});var jc=r(Xn);Ff=a(jc,"This model is also a PyTorch "),Zn=n(jc,"A",{href:!0,rel:!0});var zw=r(Zn);zf=a(zw,"torch.nn.Module"),zw.forEach(t),xf=a(jc,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),jc.forEach(t),Cf=h(Os),er=n(Os,"P",{});var qc=r(er);Pf=a(qc,"This class is a small change compared to "),bi=n(qc,"A",{href:!0});var xw=r(bi);Mf=a(xw,"BertModel"),xw.forEach(t),Sf=a(qc,", taking into account the additional token type ids."),qc.forEach(t),Of=h(Os),tr=n(Os,"P",{});var $c=r(tr);Df=a($c,`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 `),sr=n($c,"A",{href:!0,rel:!0});var Cw=r(sr);Nf=a(Cw,`Attention is
all you need`),Cw.forEach(t),Lf=a($c,` by Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser and Illia Polosukhin.`),$c.forEach(t),Qf=h(Os),qs=n(Os,"DIV",{class:!0});var hn=r(qs);k(ar.$$.fragment,hn),If=h(hn),Za=n(hn,"P",{});var Vi=r(Za);Wf=a(Vi,"The "),wi=n(Vi,"A",{href:!0});var Pw=r(wi);Hf=a(Pw,"TapasModel"),Pw.forEach(t),Uf=a(Vi," forward method, overrides the "),bd=n(Vi,"CODE",{});var Mw=r(bd);Rf=a(Mw,"__call__"),Mw.forEach(t),Bf=a(Vi," special method."),Vi.forEach(t),Gf=h(hn),k(Oo.$$.fragment,hn),Kf=h(hn),k(Do.$$.fragment,hn),hn.forEach(t),Os.forEach(t),Lp=h(i),eo=n(i,"H2",{class:!0});var Ec=r(eo);No=n(Ec,"A",{id:!0,class:!0,href:!0});var Sw=r(No);wd=n(Sw,"SPAN",{});var Ow=r(wd);k(or.$$.fragment,Ow),Ow.forEach(t),Sw.forEach(t),Vf=h(Ec),yd=n(Ec,"SPAN",{});var Dw=r(yd);Yf=a(Dw,"TapasForMaskedLM"),Dw.forEach(t),Ec.forEach(t),Qp=h(i),vs=n(i,"DIV",{class:!0});var un=r(vs);k(nr.$$.fragment,un),Jf=h(un),to=n(un,"P",{});var Yi=r(to);Xf=a(Yi,"Tapas Model with a "),kd=n(Yi,"CODE",{});var Nw=r(kd);Zf=a(Nw,"language modeling"),Nw.forEach(t),eg=a(Yi,` head on top.
This model inherits from `),yi=n(Yi,"A",{href:!0});var Lw=r(yi);tg=a(Lw,"PreTrainedModel"),Lw.forEach(t),sg=a(Yi,`. 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.)`),Yi.forEach(t),ag=h(un),rr=n(un,"P",{});var Ac=r(rr);og=a(Ac,"This model is also a PyTorch "),ir=n(Ac,"A",{href:!0,rel:!0});var Qw=r(ir);ng=a(Qw,"torch.nn.Module"),Qw.forEach(t),rg=a(Ac,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ac.forEach(t),ig=h(un),$s=n(un,"DIV",{class:!0});var mn=r($s);k(lr.$$.fragment,mn),lg=h(mn),so=n(mn,"P",{});var Ji=r(so);dg=a(Ji,"The "),ki=n(Ji,"A",{href:!0});var Iw=r(ki);pg=a(Iw,"TapasForMaskedLM"),Iw.forEach(t),cg=a(Ji," forward method, overrides the "),jd=n(Ji,"CODE",{});var Ww=r(jd);hg=a(Ww,"__call__"),Ww.forEach(t),ug=a(Ji," special method."),Ji.forEach(t),mg=h(mn),k(Lo.$$.fragment,mn),fg=h(mn),k(Qo.$$.fragment,mn),mn.forEach(t),un.forEach(t),Ip=h(i),ao=n(i,"H2",{class:!0});var Fc=r(ao);Io=n(Fc,"A",{id:!0,class:!0,href:!0});var Hw=r(Io);qd=n(Hw,"SPAN",{});var Uw=r(qd);k(dr.$$.fragment,Uw),Uw.forEach(t),Hw.forEach(t),gg=h(Fc),$d=n(Fc,"SPAN",{});var Rw=r($d);_g=a(Rw,"TapasForSequenceClassification"),Rw.forEach(t),Fc.forEach(t),Wp=h(i),Zt=n(i,"DIV",{class:!0});var wa=r(Zt);k(pr.$$.fragment,wa),vg=h(wa),Ed=n(wa,"P",{});var Bw=r(Ed);Tg=a(Bw,`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).`),Bw.forEach(t),bg=h(wa),cr=n(wa,"P",{});var zc=r(cr);wg=a(zc,"This model inherits from "),ji=n(zc,"A",{href:!0});var Gw=r(ji);yg=a(Gw,"PreTrainedModel"),Gw.forEach(t),kg=a(zc,`. 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.)`),zc.forEach(t),jg=h(wa),hr=n(wa,"P",{});var xc=r(hr);qg=a(xc,"This model is also a PyTorch "),ur=n(xc,"A",{href:!0,rel:!0});var Kw=r(ur);$g=a(Kw,"torch.nn.Module"),Kw.forEach(t),Eg=a(xc,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),xc.forEach(t),Ag=h(wa),Es=n(wa,"DIV",{class:!0});var fn=r(Es);k(mr.$$.fragment,fn),Fg=h(fn),oo=n(fn,"P",{});var Xi=r(oo);zg=a(Xi,"The "),qi=n(Xi,"A",{href:!0});var Vw=r(qi);xg=a(Vw,"TapasForSequenceClassification"),Vw.forEach(t),Cg=a(Xi," forward method, overrides the "),Ad=n(Xi,"CODE",{});var Yw=r(Ad);Pg=a(Yw,"__call__"),Yw.forEach(t),Mg=a(Xi," special method."),Xi.forEach(t),Sg=h(fn),k(Wo.$$.fragment,fn),Og=h(fn),k(Ho.$$.fragment,fn),fn.forEach(t),wa.forEach(t),Hp=h(i),no=n(i,"H2",{class:!0});var Cc=r(no);Uo=n(Cc,"A",{id:!0,class:!0,href:!0});var Jw=r(Uo);Fd=n(Jw,"SPAN",{});var Xw=r(Fd);k(fr.$$.fragment,Xw),Xw.forEach(t),Jw.forEach(t),Dg=h(Cc),zd=n(Cc,"SPAN",{});var Zw=r(zd);Ng=a(Zw,"TapasForQuestionAnswering"),Zw.forEach(t),Cc.forEach(t),Up=h(i),es=n(i,"DIV",{class:!0});var ya=r(es);k(gr.$$.fragment,ya),Lg=h(ya),ro=n(ya,"P",{});var Zi=r(ro);Qg=a(Zi,`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 `),xd=n(Zi,"CODE",{});var ey=r(xd);Ig=a(ey,"logits"),ey.forEach(t),Wg=a(Zi," and optional "),Cd=n(Zi,"CODE",{});var ty=r(Cd);Hg=a(ty,"logits_aggregation"),ty.forEach(t),Ug=a(Zi,`), e.g. for
SQA, WTQ or WikiSQL-supervised tasks.`),Zi.forEach(t),Rg=h(ya),_r=n(ya,"P",{});var Pc=r(_r);Bg=a(Pc,"This model inherits from "),$i=n(Pc,"A",{href:!0});var sy=r($i);Gg=a(sy,"PreTrainedModel"),sy.forEach(t),Kg=a(Pc,`. 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.)`),Pc.forEach(t),Vg=h(ya),vr=n(ya,"P",{});var Mc=r(vr);Yg=a(Mc,"This model is also a PyTorch "),Tr=n(Mc,"A",{href:!0,rel:!0});var ay=r(Tr);Jg=a(ay,"torch.nn.Module"),ay.forEach(t),Xg=a(Mc,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Mc.forEach(t),Zg=h(ya),As=n(ya,"DIV",{class:!0});var gn=r(As);k(br.$$.fragment,gn),e_=h(gn),io=n(gn,"P",{});var el=r(io);t_=a(el,"The "),Ei=n(el,"A",{href:!0});var oy=r(Ei);s_=a(oy,"TapasForQuestionAnswering"),oy.forEach(t),a_=a(el," forward method, overrides the "),Pd=n(el,"CODE",{});var ny=r(Pd);o_=a(ny,"__call__"),ny.forEach(t),n_=a(el," special method."),el.forEach(t),r_=h(gn),k(Ro.$$.fragment,gn),i_=h(gn),k(Bo.$$.fragment,gn),gn.forEach(t),ya.forEach(t),Rp=h(i),lo=n(i,"H2",{class:!0});var Sc=r(lo);Go=n(Sc,"A",{id:!0,class:!0,href:!0});var ry=r(Go);Md=n(ry,"SPAN",{});var iy=r(Md);k(wr.$$.fragment,iy),iy.forEach(t),ry.forEach(t),l_=h(Sc),Sd=n(Sc,"SPAN",{});var ly=r(Sd);d_=a(ly,"TFTapasModel"),ly.forEach(t),Sc.forEach(t),Bp=h(i),jt=n(i,"DIV",{class:!0});var Ds=r(jt);k(yr.$$.fragment,Ds),p_=h(Ds),Od=n(Ds,"P",{});var dy=r(Od);c_=a(dy,"The bare Tapas Model transformer outputting raw hidden-states without any specific head on top."),dy.forEach(t),h_=h(Ds),kr=n(Ds,"P",{});var Oc=r(kr);u_=a(Oc,"This model inherits from "),Ai=n(Oc,"A",{href:!0});var py=r(Ai);m_=a(py,"TFPreTrainedModel"),py.forEach(t),f_=a(Oc,`. 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.)`),Oc.forEach(t),g_=h(Ds),jr=n(Ds,"P",{});var Dc=r(jr);__=a(Dc,"This model is also a "),qr=n(Dc,"A",{href:!0,rel:!0});var cy=r(qr);v_=a(cy,"tf.keras.Model"),cy.forEach(t),T_=a(Dc,` 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.`),Dc.forEach(t),b_=h(Ds),k(Ko.$$.fragment,Ds),w_=h(Ds),Fs=n(Ds,"DIV",{class:!0});var _n=r(Fs);k($r.$$.fragment,_n),y_=h(_n),po=n(_n,"P",{});var tl=r(po);k_=a(tl,"The "),Fi=n(tl,"A",{href:!0});var hy=r(Fi);j_=a(hy,"TFTapasModel"),hy.forEach(t),q_=a(tl," forward method, overrides the "),Dd=n(tl,"CODE",{});var uy=r(Dd);$_=a(uy,"__call__"),uy.forEach(t),E_=a(tl," special method."),tl.forEach(t),A_=h(_n),k(Vo.$$.fragment,_n),F_=h(_n),k(Yo.$$.fragment,_n),_n.forEach(t),Ds.forEach(t),Gp=h(i),co=n(i,"H2",{class:!0});var Nc=r(co);Jo=n(Nc,"A",{id:!0,class:!0,href:!0});var my=r(Jo);Nd=n(my,"SPAN",{});var fy=r(Nd);k(Er.$$.fragment,fy),fy.forEach(t),my.forEach(t),z_=h(Nc),Ld=n(Nc,"SPAN",{});var gy=r(Ld);x_=a(gy,"TFTapasForMaskedLM"),gy.forEach(t),Nc.forEach(t),Kp=h(i),qt=n(i,"DIV",{class:!0});var Ns=r(qt);k(Ar.$$.fragment,Ns),C_=h(Ns),Fr=n(Ns,"P",{});var Lc=r(Fr);P_=a(Lc,"Tapas Model with a "),Qd=n(Lc,"CODE",{});var _y=r(Qd);M_=a(_y,"language modeling"),_y.forEach(t),S_=a(Lc," head on top."),Lc.forEach(t),O_=h(Ns),zr=n(Ns,"P",{});var Qc=r(zr);D_=a(Qc,"This model inherits from "),zi=n(Qc,"A",{href:!0});var vy=r(zi);N_=a(vy,"TFPreTrainedModel"),vy.forEach(t),L_=a(Qc,`. 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.)`),Qc.forEach(t),Q_=h(Ns),xr=n(Ns,"P",{});var Ic=r(xr);I_=a(Ic,"This model is also a "),Cr=n(Ic,"A",{href:!0,rel:!0});var Ty=r(Cr);W_=a(Ty,"tf.keras.Model"),Ty.forEach(t),H_=a(Ic,` 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.`),Ic.forEach(t),U_=h(Ns),k(Xo.$$.fragment,Ns),R_=h(Ns),zs=n(Ns,"DIV",{class:!0});var vn=r(zs);k(Pr.$$.fragment,vn),B_=h(vn),ho=n(vn,"P",{});var sl=r(ho);G_=a(sl,"The "),xi=n(sl,"A",{href:!0});var by=r(xi);K_=a(by,"TFTapasForMaskedLM"),by.forEach(t),V_=a(sl," forward method, overrides the "),Id=n(sl,"CODE",{});var wy=r(Id);Y_=a(wy,"__call__"),wy.forEach(t),J_=a(sl," special method."),sl.forEach(t),X_=h(vn),k(Zo.$$.fragment,vn),Z_=h(vn),k(en.$$.fragment,vn),vn.forEach(t),Ns.forEach(t),Vp=h(i),uo=n(i,"H2",{class:!0});var Wc=r(uo);tn=n(Wc,"A",{id:!0,class:!0,href:!0});var yy=r(tn);Wd=n(yy,"SPAN",{});var ky=r(Wd);k(Mr.$$.fragment,ky),ky.forEach(t),yy.forEach(t),ev=h(Wc),Hd=n(Wc,"SPAN",{});var jy=r(Hd);tv=a(jy,"TFTapasForSequenceClassification"),jy.forEach(t),Wc.forEach(t),Yp=h(i),$t=n(i,"DIV",{class:!0});var Ls=r($t);k(Sr.$$.fragment,Ls),sv=h(Ls),Ud=n(Ls,"P",{});var qy=r(Ud);av=a(qy,`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).`),qy.forEach(t),ov=h(Ls),Or=n(Ls,"P",{});var Hc=r(Or);nv=a(Hc,"This model inherits from "),Ci=n(Hc,"A",{href:!0});var $y=r(Ci);rv=a($y,"TFPreTrainedModel"),$y.forEach(t),iv=a(Hc,`. 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.)`),Hc.forEach(t),lv=h(Ls),Dr=n(Ls,"P",{});var Uc=r(Dr);dv=a(Uc,"This model is also a "),Nr=n(Uc,"A",{href:!0,rel:!0});var Ey=r(Nr);pv=a(Ey,"tf.keras.Model"),Ey.forEach(t),cv=a(Uc,` 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.`),Uc.forEach(t),hv=h(Ls),k(sn.$$.fragment,Ls),uv=h(Ls),xs=n(Ls,"DIV",{class:!0});var Tn=r(xs);k(Lr.$$.fragment,Tn),mv=h(Tn),mo=n(Tn,"P",{});var al=r(mo);fv=a(al,"The "),Pi=n(al,"A",{href:!0});var Ay=r(Pi);gv=a(Ay,"TFTapasForSequenceClassification"),Ay.forEach(t),_v=a(al," forward method, overrides the "),Rd=n(al,"CODE",{});var Fy=r(Rd);vv=a(Fy,"__call__"),Fy.forEach(t),Tv=a(al," special method."),al.forEach(t),bv=h(Tn),k(an.$$.fragment,Tn),wv=h(Tn),k(on.$$.fragment,Tn),Tn.forEach(t),Ls.forEach(t),Jp=h(i),fo=n(i,"H2",{class:!0});var Rc=r(fo);nn=n(Rc,"A",{id:!0,class:!0,href:!0});var zy=r(nn);Bd=n(zy,"SPAN",{});var xy=r(Bd);k(Qr.$$.fragment,xy),xy.forEach(t),zy.forEach(t),yv=h(Rc),Gd=n(Rc,"SPAN",{});var Cy=r(Gd);kv=a(Cy,"TFTapasForQuestionAnswering"),Cy.forEach(t),Rc.forEach(t),Xp=h(i),Et=n(i,"DIV",{class:!0});var Qs=r(Et);k(Ir.$$.fragment,Qs),jv=h(Qs),go=n(Qs,"P",{});var ol=r(go);qv=a(ol,`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 `),Kd=n(ol,"CODE",{});var Py=r(Kd);$v=a(Py,"logits"),Py.forEach(t),Ev=a(ol," and optional "),Vd=n(ol,"CODE",{});var My=r(Vd);Av=a(My,"logits_aggregation"),My.forEach(t),Fv=a(ol,`), e.g. for
SQA, WTQ or WikiSQL-supervised tasks.`),ol.forEach(t),zv=h(Qs),Wr=n(Qs,"P",{});var Bc=r(Wr);xv=a(Bc,"This model inherits from "),Mi=n(Bc,"A",{href:!0});var Sy=r(Mi);Cv=a(Sy,"TFPreTrainedModel"),Sy.forEach(t),Pv=a(Bc,`. 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.)`),Bc.forEach(t),Mv=h(Qs),Hr=n(Qs,"P",{});var Gc=r(Hr);Sv=a(Gc,"This model is also a "),Ur=n(Gc,"A",{href:!0,rel:!0});var Oy=r(Ur);Ov=a(Oy,"tf.keras.Model"),Oy.forEach(t),Dv=a(Gc,` 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.`),Gc.forEach(t),Nv=h(Qs),k(rn.$$.fragment,Qs),Lv=h(Qs),Cs=n(Qs,"DIV",{class:!0});var bn=r(Cs);k(Rr.$$.fragment,bn),Qv=h(bn),_o=n(bn,"P",{});var nl=r(_o);Iv=a(nl,"The "),Si=n(nl,"A",{href:!0});var Dy=r(Si);Wv=a(Dy,"TFTapasForQuestionAnswering"),Dy.forEach(t),Hv=a(nl," forward method, overrides the "),Yd=n(nl,"CODE",{});var Ny=r(Yd);Uv=a(Ny,"__call__"),Ny.forEach(t),Rv=a(nl," special method."),nl.forEach(t),Bv=h(bn),k(ln.$$.fragment,bn),Gv=h(bn),k(dn.$$.fragment,bn),bn.forEach(t),Qs.forEach(t),this.h()},h(){m(l,"name","hf:doc:metadata"),m(l,"content",JSON.stringify(Fk)),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(G,"id","overview"),m(G,"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(G,"href","#overview"),m(N,"class","relative group"),m(W,"href","https://www.aclweb.org/anthology/2020.acl-main.398"),m(W,"rel","nofollow"),m(D,"href","https://www.microsoft.com/en-us/download/details.aspx?id=54253"),m(D,"rel","nofollow"),m(R,"href","https://github.com/ppasupat/WikiTableQuestions"),m(R,"rel","nofollow"),m(Fe,"href","https://github.com/salesforce/WikiSQL"),m(Fe,"rel","nofollow"),m(b,"href","https://github.com/wenhuchen/Table-Fact-Checking"),m(b,"rel","nofollow"),m(Te,"href","https://www.aclweb.org/anthology/2020.findings-emnlp.27/"),m(Te,"rel","nofollow"),Hy(Le.src,ot="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/tapas_architecture.png")||m(Le,"src",ot),m(Le,"alt","drawing"),m(Le,"width","600"),m(de,"href","https://ai.googleblog.com/2020/04/using-neural-networks-to-find-answers.html"),m(Re,"href","https://huggingface.co/nielsr"),m(Re,"rel","nofollow"),m(Ae,"href","https://huggingface.co/kamalkraj"),m(Ae,"rel","nofollow"),m(St,"href","https://github.com/google-research/tapas"),m(St,"rel","nofollow"),m(ss,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasConfig"),m(It,"href","https://huggingface.co/models?search=tapas"),m(It,"rel","nofollow"),m(Gt,"href","https://github.com/google-research/tapas%3E"),m(Gt,"rel","nofollow"),m(_t,"id","usage-finetuning"),m(_t,"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(_t,"href","#usage-finetuning"),m(Yt,"class","relative group"),m(ws,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering"),m(ks,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering"),m(yn,"href","https://github.com/google-research/tapas/issues/91#issuecomment-735719340"),m(yn,"rel","nofollow"),m(kn,"href","https://huggingface.co/models?search=tapas"),m(kn,"rel","nofollow"),m(jn,"href","https://www.microsoft.com/en-us/download/details.aspx?id=54253"),m(jn,"rel","nofollow"),m(qn,"href","https://github.com/google-research/tapas/issues/50#issuecomment-705465960"),m(qn,"rel","nofollow"),m($n,"href","https://github.com/NielsRogge/tapas_utils"),m($n,"rel","nofollow"),m(ri,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasTokenizer"),m(En,"href","https://github.com/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb"),m(En,"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($o,"id","usage-inference"),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","#usage-inference"),m(Ua,"class","relative group"),m(zn,"href","https://github.com/NielsRogge/Transformers-Tutorials/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb"),m(zn,"rel","nofollow"),m(xn,"href","https://github.com/kamalkraj/Tapas-Tutorial/blob/master/TAPAS/Fine_tuning_TapasForQuestionAnswering_on_SQA.ipynb"),m(xn,"rel","nofollow"),m(Ao,"id","documentation-resources"),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","#documentation-resources"),m(Ra,"class","relative group"),m(li,"href","../tasks/sequence_classification"),m(di,"href","../tasks/masked_language_modeling"),m(zo,"id","transformers.models.tapas.modeling_tapas.TableQuestionAnsweringOutput"),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.models.tapas.modeling_tapas.TableQuestionAnsweringOutput"),m(Ba,"class","relative group"),m(pi,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering"),m(Ga,"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.TapasConfig"),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.TapasConfig"),m(Ka,"class","relative group"),m(ci,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasModel"),m(Nn,"href","https://huggingface.co/google/tapas-base-finetuned-sqa"),m(Nn,"rel","nofollow"),m(hi,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),m(Qn,"href","https://github.com/google-research/tapas/tree/master"),m(Qn,"rel","nofollow"),m(Xt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Po,"id","transformers.TapasTokenizer"),m(Po,"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(Po,"href","#transformers.TapasTokenizer"),m(Ja,"class","relative group"),m(ui,"href","/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),m(mi,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasTokenizer"),m(gi,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasTokenizer"),m(Mo,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(_i,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering"),m(Gn,"href","https://github.com/google-research/tapas/blob/4908213eb4df7aa988573350278b44c4dbe3f71b/tapas/experiments/prediction_utils.py#L288"),m(Gn,"rel","nofollow"),m(Ta,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(vi,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ct,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(So,"id","transformers.TapasModel"),m(So,"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(So,"href","#transformers.TapasModel"),m(Xa,"class","relative group"),m(Ti,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),m(Zn,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(Zn,"rel","nofollow"),m(bi,"href","/docs/transformers/v4.29.0/en/model_doc/bert#transformers.BertModel"),m(sr,"href","https://arxiv.org/abs/1706.03762"),m(sr,"rel","nofollow"),m(wi,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasModel"),m(qs,"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(No,"id","transformers.TapasForMaskedLM"),m(No,"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(No,"href","#transformers.TapasForMaskedLM"),m(eo,"class","relative group"),m(yi,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),m(ir,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(ir,"rel","nofollow"),m(ki,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasForMaskedLM"),m($s,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(vs,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Io,"id","transformers.TapasForSequenceClassification"),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","#transformers.TapasForSequenceClassification"),m(ao,"class","relative group"),m(ji,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),m(ur,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(ur,"rel","nofollow"),m(qi,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasForSequenceClassification"),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(Zt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Uo,"id","transformers.TapasForQuestionAnswering"),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","#transformers.TapasForQuestionAnswering"),m(no,"class","relative group"),m($i,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),m(Tr,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),m(Tr,"rel","nofollow"),m(Ei,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TapasForQuestionAnswering"),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(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(Go,"id","transformers.TFTapasModel"),m(Go,"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(Go,"href","#transformers.TFTapasModel"),m(lo,"class","relative group"),m(Ai,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(qr,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(qr,"rel","nofollow"),m(Fi,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TFTapasModel"),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(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(Jo,"id","transformers.TFTapasForMaskedLM"),m(Jo,"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(Jo,"href","#transformers.TFTapasForMaskedLM"),m(co,"class","relative group"),m(zi,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(Cr,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(Cr,"rel","nofollow"),m(xi,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TFTapasForMaskedLM"),m(zs,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(qt,"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(Ci,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(Nr,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(Nr,"rel","nofollow"),m(Pi,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TFTapasForSequenceClassification"),m(xs,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m($t,"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(Mi,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.TFPreTrainedModel"),m(Ur,"href","https://www.tensorflow.org/api_docs/python/tf/keras/Model"),m(Ur,"rel","nofollow"),m(Si,"href","/docs/transformers/v4.29.0/en/model_doc/tapas#transformers.TFTapasForQuestionAnswering"),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(Et,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(i,_){e(document.head,l),u(i,v,_),u(i,d,_),e(d,f),e(f,T),j(p,T,null),e(d,g),e(d,A),e(A,F),u(i,H,_),u(i,N,_),e(N,G),e(G,ae),j(w,ae,null),e(N,B),e(N,X),e(X,S),u(i,U,_),u(i,O,_),e(O,C),e(O,W),e(W,Y),e(O,le),u(i,me,_),u(i,Z,_),e(Z,ge),u(i,ce,_),u(i,ee,_),e(ee,_e),e(_e,D),e(D,L),e(_e,I),e(ee,P),e(ee,K),e(K,R),e(R,we),e(K,ze),e(ee,he),e(ee,fe),e(fe,Fe),e(Fe,se),e(fe,ke),u(i,ve,_),u(i,Pe,_),e(Pe,Ce),u(i,je,_),u(i,Me,_),e(Me,$e),u(i,pe,_),u(i,Se,_),e(Se,ye),e(ye,J),u(i,qe,_),u(i,V,_),e(V,We),e(V,oe),e(oe,He),e(V,Ue),e(V,b),e(b,M),e(V,Ve),e(V,Te),e(Te,Ye),e(V,Je),u(i,Q,_),u(i,Le,_),u(i,Qe,_),u(i,Ie,_),e(Ie,Xe),e(Ie,de),e(de,Ee),e(Ie,Ze),u(i,xe,_),u(i,ne,_),e(ne,et),e(ne,Re),e(Re,re),e(ne,Be),e(ne,Ae),e(Ae,tt),e(ne,Mt),e(ne,St),e(St,Ws),e(ne,Ot),u(i,Ts,_),u(i,ts,_),e(ts,Dt),u(i,bs,_),u(i,ut,_),e(ut,Oe),e(Oe,Hs),e(Oe,Nt),e(Nt,ie),e(Oe,Tt),e(Oe,ss),e(ss,Us),e(Oe,Lt),e(Oe,ns),e(ns,Rs),e(Oe,Qt),e(Oe,It),e(It,Bs),e(Oe,Wt),e(Oe,rs),e(rs,Gs),e(Oe,Ht),e(Oe,is),e(is,Ks),e(Oe,Ut),e(ut,Vs),e(ut,st),e(st,Rt),e(st,ls),e(ls,Ys),e(st,Bt),e(st,ds),e(ds,Js),e(st,ps),e(st,lt),e(lt,cs),e(st,De),e(st,hs),e(hs,bt),e(st,Xs),e(st,Gt),e(Gt,Kt),e(st,Zs),e(ut,ea),e(ut,dt),e(dt,ta),e(dt,us),e(us,ms),e(dt,gt),e(dt,Vt),e(Vt,z),e(dt,te),e(ut,ka),e(ut,sa),e(sa,ja),u(i,ha,_),u(i,Yt,_),e(Yt,_t),e(_t,aa),j(wt,aa,null),e(Yt,qa),e(Yt,oa),e(oa,$a),u(i,ua,_),u(i,nt,_),e(nt,fs),e(nt,ws),e(ws,pt),e(nt,Ea),u(i,ma,_),u(i,ys,_),e(ys,na),e(na,gs),u(i,fa,_),u(i,be,_),e(be,Aa),e(be,ks),e(ks,Fa),e(be,za),u(i,ga,_),u(i,Ft,_),e(Ft,ra),e(ra,_s),e(Ft,xa),e(Ft,Ne),e(Ne,Ca),e(Ne,ia),e(ia,Pa),e(Ne,Ma),e(Ft,Sa),e(Ft,ue),e(ue,Oa),e(ue,la),e(la,Da),e(ue,Na),u(i,_a,_),u(i,js,_),e(js,La),u(i,va,_),u(i,Ge,_),e(Ge,da),e(da,Jt),e(Jt,pa),e(pa,rl),e(rl,Vc),e(Jt,Yc),e(Jt,il),e(il,ll),e(ll,Jc),e(Jt,Xc),e(Jt,dl),e(dl,pl),e(pl,Zc),e(Ge,eh),e(Ge,Qa),e(Qa,Ia),e(Ia,cl),e(cl,th),e(Ia,sh),e(Ia,hl),e(hl,ah),e(Ia,oh),e(Ia,ul),e(ul,nh),e(Qa,rh),e(Qa,Wa),e(Wa,ml),e(ml,ih),e(Wa,lh),e(Wa,fl),e(fl,dh),e(Wa,ph),e(Wa,gl),e(gl,ch),e(Qa,hh),e(Qa,Ha),e(Ha,_l),e(_l,uh),e(Ha,mh),e(Ha,vl),e(vl,fh),e(Ha,gh),e(Ha,Tl),e(Tl,_h),u(i,mp,_),j(bo,i,_),u(i,fp,_),u(i,wo,_),e(wo,vh),e(wo,yn),e(yn,Th),e(wo,bh),u(i,gp,_),u(i,yo,_),e(yo,wh),e(yo,kn),e(kn,yh),e(yo,kh),u(i,_p,_),u(i,Vr,_),e(Vr,bl),e(bl,jh),u(i,vp,_),u(i,ko,_),e(ko,qh),e(ko,jn),e(jn,$h),e(ko,Eh),u(i,Tp,_),u(i,rt,_),e(rt,Yr),e(Yr,wl),e(wl,Ah),e(Yr,Fh),e(rt,zh),e(rt,Jr),e(Jr,yl),e(yl,xh),e(Jr,Ch),e(rt,Ph),e(rt,Xr),e(Xr,kl),e(kl,Mh),e(Xr,Sh),e(rt,Oh),e(rt,Zr),e(Zr,jl),e(jl,Dh),e(Zr,Nh),e(rt,Lh),e(rt,ei),e(ei,ql),e(ql,Qh),e(ei,Ih),e(rt,Wh),e(rt,ti),e(ti,$l),e($l,Hh),e(ti,Uh),e(rt,Rh),e(rt,si),e(si,El),e(El,Bh),e(si,Gh),e(rt,Kh),e(rt,ai),e(ai,Al),e(Al,Vh),e(ai,Yh),e(rt,Jh),e(rt,oi),e(oi,Fl),e(Fl,Xh),e(oi,Zh),u(i,bp,_),u(i,zt,_),e(zt,eu),e(zt,qn),e(qn,tu),e(zt,su),e(zt,$n),e($n,au),e(zt,ou),e(zt,zl),e(zl,nu),e(zt,ru),e(zt,xl),e(xl,iu),e(zt,lu),e(zt,Cl),e(Cl,du),e(zt,pu),u(i,wp,_),u(i,ni,_),e(ni,Pl),e(Pl,cu),u(i,yp,_),j(jo,i,_),u(i,kp,_),u(i,Ke,_),e(Ke,hu),e(Ke,Ml),e(Ml,uu),e(Ke,mu),e(Ke,Sl),e(Sl,fu),e(Ke,gu),e(Ke,Ol),e(Ol,_u),e(Ke,vu),e(Ke,Dl),e(Dl,Tu),e(Ke,bu),e(Ke,Nl),e(Nl,wu),e(Ke,yu),e(Ke,Ll),e(Ll,ku),e(Ke,ju),e(Ke,ri),e(ri,qu),e(Ke,$u),e(Ke,En),e(En,Eu),e(Ke,Au),e(Ke,An),e(An,Fu),e(Ke,zu),u(i,jp,_),u(i,ii,_),e(ii,xu),u(i,qp,_),j(qo,i,_),u(i,$p,_),u(i,Ua,_),e(Ua,$o),e($o,Ql),j(Fn,Ql,null),e(Ua,Cu),e(Ua,Il),e(Il,Pu),u(i,Ep,_),j(Eo,i,_),u(i,Ap,_),u(i,xt,_),e(xt,Mu),e(xt,Wl),e(Wl,Su),e(xt,Ou),e(xt,Hl),e(Hl,Du),e(xt,Nu),e(xt,Ul),e(Ul,Lu),e(xt,Qu),e(xt,zn),e(zn,Iu),e(xt,Wu),e(xt,xn),e(xn,Hu),e(xt,Uu),u(i,Fp,_),u(i,Ra,_),e(Ra,Ao),e(Ao,Rl),j(Cn,Rl,null),e(Ra,Ru),e(Ra,Bl),e(Bl,Bu),u(i,zp,_),u(i,Fo,_),e(Fo,Gl),e(Gl,li),e(li,Gu),e(Fo,Ku),e(Fo,Kl),e(Kl,di),e(di,Vu),u(i,xp,_),u(i,Ba,_),e(Ba,zo),e(zo,Vl),j(Pn,Vl,null),e(Ba,Yu),e(Ba,Yl),e(Yl,Ju),u(i,Cp,_),u(i,Ga,_),j(Mn,Ga,null),e(Ga,Xu),e(Ga,Sn),e(Sn,Zu),e(Sn,pi),e(pi,em),e(Sn,tm),u(i,Pp,_),u(i,Ka,_),e(Ka,xo),e(xo,Jl),j(On,Jl,null),e(Ka,sm),e(Ka,Xl),e(Xl,am),u(i,Mp,_),u(i,Xt,_),j(Dn,Xt,null),e(Xt,om),e(Xt,Va),e(Va,nm),e(Va,ci),e(ci,rm),e(Va,im),e(Va,Nn),e(Nn,lm),e(Va,dm),e(Xt,pm),e(Xt,Ya),e(Ya,cm),e(Ya,Zl),e(Zl,hm),e(Ya,um),e(Ya,hi),e(hi,mm),e(Ya,fm),e(Xt,gm),e(Xt,Ln),e(Ln,_m),e(Ln,Qn),e(Qn,vm),e(Ln,Tm),e(Xt,bm),j(Co,Xt,null),u(i,Sp,_),u(i,Ja,_),e(Ja,Po),e(Po,ed),j(In,ed,null),e(Ja,wm),e(Ja,td),e(td,ym),u(i,Op,_),u(i,ct,_),j(Wn,ct,null),e(ct,km),e(ct,sd),e(sd,jm),e(ct,qm),e(ct,at),e(at,$m),e(at,ui),e(ui,Em),e(at,Am),e(at,mi),e(mi,Fm),e(at,zm),e(at,ad),e(ad,xm),e(at,Cm),e(at,od),e(od,Pm),e(at,Mm),e(at,nd),e(nd,Sm),e(at,Om),e(at,rd),e(rd,Dm),e(at,Nm),e(at,id),e(id,Lm),e(at,Qm),e(at,ld),e(ld,Im),e(at,Wm),e(at,dd),e(dd,Hm),e(at,Um),e(ct,Rm),e(ct,yt),e(yt,pd),e(pd,Bm),e(yt,Gm),e(yt,cd),e(cd,Km),e(yt,Vm),e(yt,hd),e(hd,Ym),e(yt,Jm),e(yt,ud),e(ud,Xm),e(yt,Zm),e(yt,md),e(md,ef),e(yt,tf),e(yt,fd),e(fd,sf),e(yt,af),e(yt,gd),e(gd,of),e(ct,nf),e(ct,fi),e(fi,gi),e(gi,rf),e(fi,lf),e(ct,df),e(ct,Mo),j(Hn,Mo,null),e(Mo,pf),e(Mo,_d),e(_d,cf),e(ct,hf),e(ct,Ta),j(Un,Ta,null),e(Ta,uf),e(Ta,Rn),e(Rn,mf),e(Rn,_i),e(_i,ff),e(Rn,gf),e(Ta,_f),e(Ta,Bn),e(Bn,vf),e(Bn,Gn),e(Gn,Tf),e(Bn,bf),e(ct,wf),e(ct,vi),j(Kn,vi,null),u(i,Dp,_),u(i,Xa,_),e(Xa,So),e(So,vd),j(Vn,vd,null),e(Xa,yf),e(Xa,Td),e(Td,kf),u(i,Np,_),u(i,kt,_),j(Yn,kt,null),e(kt,jf),e(kt,Jn),e(Jn,qf),e(Jn,Ti),e(Ti,$f),e(Jn,Ef),e(kt,Af),e(kt,Xn),e(Xn,Ff),e(Xn,Zn),e(Zn,zf),e(Xn,xf),e(kt,Cf),e(kt,er),e(er,Pf),e(er,bi),e(bi,Mf),e(er,Sf),e(kt,Of),e(kt,tr),e(tr,Df),e(tr,sr),e(sr,Nf),e(tr,Lf),e(kt,Qf),e(kt,qs),j(ar,qs,null),e(qs,If),e(qs,Za),e(Za,Wf),e(Za,wi),e(wi,Hf),e(Za,Uf),e(Za,bd),e(bd,Rf),e(Za,Bf),e(qs,Gf),j(Oo,qs,null),e(qs,Kf),j(Do,qs,null),u(i,Lp,_),u(i,eo,_),e(eo,No),e(No,wd),j(or,wd,null),e(eo,Vf),e(eo,yd),e(yd,Yf),u(i,Qp,_),u(i,vs,_),j(nr,vs,null),e(vs,Jf),e(vs,to),e(to,Xf),e(to,kd),e(kd,Zf),e(to,eg),e(to,yi),e(yi,tg),e(to,sg),e(vs,ag),e(vs,rr),e(rr,og),e(rr,ir),e(ir,ng),e(rr,rg),e(vs,ig),e(vs,$s),j(lr,$s,null),e($s,lg),e($s,so),e(so,dg),e(so,ki),e(ki,pg),e(so,cg),e(so,jd),e(jd,hg),e(so,ug),e($s,mg),j(Lo,$s,null),e($s,fg),j(Qo,$s,null),u(i,Ip,_),u(i,ao,_),e(ao,Io),e(Io,qd),j(dr,qd,null),e(ao,gg),e(ao,$d),e($d,_g),u(i,Wp,_),u(i,Zt,_),j(pr,Zt,null),e(Zt,vg),e(Zt,Ed),e(Ed,Tg),e(Zt,bg),e(Zt,cr),e(cr,wg),e(cr,ji),e(ji,yg),e(cr,kg),e(Zt,jg),e(Zt,hr),e(hr,qg),e(hr,ur),e(ur,$g),e(hr,Eg),e(Zt,Ag),e(Zt,Es),j(mr,Es,null),e(Es,Fg),e(Es,oo),e(oo,zg),e(oo,qi),e(qi,xg),e(oo,Cg),e(oo,Ad),e(Ad,Pg),e(oo,Mg),e(Es,Sg),j(Wo,Es,null),e(Es,Og),j(Ho,Es,null),u(i,Hp,_),u(i,no,_),e(no,Uo),e(Uo,Fd),j(fr,Fd,null),e(no,Dg),e(no,zd),e(zd,Ng),u(i,Up,_),u(i,es,_),j(gr,es,null),e(es,Lg),e(es,ro),e(ro,Qg),e(ro,xd),e(xd,Ig),e(ro,Wg),e(ro,Cd),e(Cd,Hg),e(ro,Ug),e(es,Rg),e(es,_r),e(_r,Bg),e(_r,$i),e($i,Gg),e(_r,Kg),e(es,Vg),e(es,vr),e(vr,Yg),e(vr,Tr),e(Tr,Jg),e(vr,Xg),e(es,Zg),e(es,As),j(br,As,null),e(As,e_),e(As,io),e(io,t_),e(io,Ei),e(Ei,s_),e(io,a_),e(io,Pd),e(Pd,o_),e(io,n_),e(As,r_),j(Ro,As,null),e(As,i_),j(Bo,As,null),u(i,Rp,_),u(i,lo,_),e(lo,Go),e(Go,Md),j(wr,Md,null),e(lo,l_),e(lo,Sd),e(Sd,d_),u(i,Bp,_),u(i,jt,_),j(yr,jt,null),e(jt,p_),e(jt,Od),e(Od,c_),e(jt,h_),e(jt,kr),e(kr,u_),e(kr,Ai),e(Ai,m_),e(kr,f_),e(jt,g_),e(jt,jr),e(jr,__),e(jr,qr),e(qr,v_),e(jr,T_),e(jt,b_),j(Ko,jt,null),e(jt,w_),e(jt,Fs),j($r,Fs,null),e(Fs,y_),e(Fs,po),e(po,k_),e(po,Fi),e(Fi,j_),e(po,q_),e(po,Dd),e(Dd,$_),e(po,E_),e(Fs,A_),j(Vo,Fs,null),e(Fs,F_),j(Yo,Fs,null),u(i,Gp,_),u(i,co,_),e(co,Jo),e(Jo,Nd),j(Er,Nd,null),e(co,z_),e(co,Ld),e(Ld,x_),u(i,Kp,_),u(i,qt,_),j(Ar,qt,null),e(qt,C_),e(qt,Fr),e(Fr,P_),e(Fr,Qd),e(Qd,M_),e(Fr,S_),e(qt,O_),e(qt,zr),e(zr,D_),e(zr,zi),e(zi,N_),e(zr,L_),e(qt,Q_),e(qt,xr),e(xr,I_),e(xr,Cr),e(Cr,W_),e(xr,H_),e(qt,U_),j(Xo,qt,null),e(qt,R_),e(qt,zs),j(Pr,zs,null),e(zs,B_),e(zs,ho),e(ho,G_),e(ho,xi),e(xi,K_),e(ho,V_),e(ho,Id),e(Id,Y_),e(ho,J_),e(zs,X_),j(Zo,zs,null),e(zs,Z_),j(en,zs,null),u(i,Vp,_),u(i,uo,_),e(uo,tn),e(tn,Wd),j(Mr,Wd,null),e(uo,ev),e(uo,Hd),e(Hd,tv),u(i,Yp,_),u(i,$t,_),j(Sr,$t,null),e($t,sv),e($t,Ud),e(Ud,av),e($t,ov),e($t,Or),e(Or,nv),e(Or,Ci),e(Ci,rv),e(Or,iv),e($t,lv),e($t,Dr),e(Dr,dv),e(Dr,Nr),e(Nr,pv),e(Dr,cv),e($t,hv),j(sn,$t,null),e($t,uv),e($t,xs),j(Lr,xs,null),e(xs,mv),e(xs,mo),e(mo,fv),e(mo,Pi),e(Pi,gv),e(mo,_v),e(mo,Rd),e(Rd,vv),e(mo,Tv),e(xs,bv),j(an,xs,null),e(xs,wv),j(on,xs,null),u(i,Jp,_),u(i,fo,_),e(fo,nn),e(nn,Bd),j(Qr,Bd,null),e(fo,yv),e(fo,Gd),e(Gd,kv),u(i,Xp,_),u(i,Et,_),j(Ir,Et,null),e(Et,jv),e(Et,go),e(go,qv),e(go,Kd),e(Kd,$v),e(go,Ev),e(go,Vd),e(Vd,Av),e(go,Fv),e(Et,zv),e(Et,Wr),e(Wr,xv),e(Wr,Mi),e(Mi,Cv),e(Wr,Pv),e(Et,Mv),e(Et,Hr),e(Hr,Sv),e(Hr,Ur),e(Ur,Ov),e(Hr,Dv),e(Et,Nv),j(rn,Et,null),e(Et,Lv),e(Et,Cs),j(Rr,Cs,null),e(Cs,Qv),e(Cs,_o),e(_o,Iv),e(_o,Si),e(Si,Wv),e(_o,Hv),e(_o,Yd),e(Yd,Uv),e(_o,Rv),e(Cs,Bv),j(ln,Cs,null),e(Cs,Gv),j(dn,Cs,null),Zp=!0},p(i,[_]){const Br={};_&2&&(Br.$$scope={dirty:_,ctx:i}),bo.$set(Br);const Jd={};_&2&&(Jd.$$scope={dirty:_,ctx:i}),jo.$set(Jd);const Xd={};_&2&&(Xd.$$scope={dirty:_,ctx:i}),qo.$set(Xd);const Zd={};_&2&&(Zd.$$scope={dirty:_,ctx:i}),Eo.$set(Zd);const Gr={};_&2&&(Gr.$$scope={dirty:_,ctx:i}),Co.$set(Gr);const ep={};_&2&&(ep.$$scope={dirty:_,ctx:i}),Oo.$set(ep);const tp={};_&2&&(tp.$$scope={dirty:_,ctx:i}),Do.$set(tp);const sp={};_&2&&(sp.$$scope={dirty:_,ctx:i}),Lo.$set(sp);const Kr={};_&2&&(Kr.$$scope={dirty:_,ctx:i}),Qo.$set(Kr);const ap={};_&2&&(ap.$$scope={dirty:_,ctx:i}),Wo.$set(ap);const op={};_&2&&(op.$$scope={dirty:_,ctx:i}),Ho.$set(op);const vo={};_&2&&(vo.$$scope={dirty:_,ctx:i}),Ro.$set(vo);const Oi={};_&2&&(Oi.$$scope={dirty:_,ctx:i}),Bo.$set(Oi);const np={};_&2&&(np.$$scope={dirty:_,ctx:i}),Ko.$set(np);const Di={};_&2&&(Di.$$scope={dirty:_,ctx:i}),Vo.$set(Di);const rp={};_&2&&(rp.$$scope={dirty:_,ctx:i}),Yo.$set(rp);const Ni={};_&2&&(Ni.$$scope={dirty:_,ctx:i}),Xo.$set(Ni);const ip={};_&2&&(ip.$$scope={dirty:_,ctx:i}),Zo.$set(ip);const lp={};_&2&&(lp.$$scope={dirty:_,ctx:i}),en.$set(lp);const dp={};_&2&&(dp.$$scope={dirty:_,ctx:i}),sn.$set(dp);const pp={};_&2&&(pp.$$scope={dirty:_,ctx:i}),an.$set(pp);const cp={};_&2&&(cp.$$scope={dirty:_,ctx:i}),on.$set(cp);const ca={};_&2&&(ca.$$scope={dirty:_,ctx:i}),rn.$set(ca);const hp={};_&2&&(hp.$$scope={dirty:_,ctx:i}),ln.$set(hp);const up={};_&2&&(up.$$scope={dirty:_,ctx:i}),dn.$set(up)},i(i){Zp||(q(p.$$.fragment,i),q(w.$$.fragment,i),q(wt.$$.fragment,i),q(bo.$$.fragment,i),q(jo.$$.fragment,i),q(qo.$$.fragment,i),q(Fn.$$.fragment,i),q(Eo.$$.fragment,i),q(Cn.$$.fragment,i),q(Pn.$$.fragment,i),q(Mn.$$.fragment,i),q(On.$$.fragment,i),q(Dn.$$.fragment,i),q(Co.$$.fragment,i),q(In.$$.fragment,i),q(Wn.$$.fragment,i),q(Hn.$$.fragment,i),q(Un.$$.fragment,i),q(Kn.$$.fragment,i),q(Vn.$$.fragment,i),q(Yn.$$.fragment,i),q(ar.$$.fragment,i),q(Oo.$$.fragment,i),q(Do.$$.fragment,i),q(or.$$.fragment,i),q(nr.$$.fragment,i),q(lr.$$.fragment,i),q(Lo.$$.fragment,i),q(Qo.$$.fragment,i),q(dr.$$.fragment,i),q(pr.$$.fragment,i),q(mr.$$.fragment,i),q(Wo.$$.fragment,i),q(Ho.$$.fragment,i),q(fr.$$.fragment,i),q(gr.$$.fragment,i),q(br.$$.fragment,i),q(Ro.$$.fragment,i),q(Bo.$$.fragment,i),q(wr.$$.fragment,i),q(yr.$$.fragment,i),q(Ko.$$.fragment,i),q($r.$$.fragment,i),q(Vo.$$.fragment,i),q(Yo.$$.fragment,i),q(Er.$$.fragment,i),q(Ar.$$.fragment,i),q(Xo.$$.fragment,i),q(Pr.$$.fragment,i),q(Zo.$$.fragment,i),q(en.$$.fragment,i),q(Mr.$$.fragment,i),q(Sr.$$.fragment,i),q(sn.$$.fragment,i),q(Lr.$$.fragment,i),q(an.$$.fragment,i),q(on.$$.fragment,i),q(Qr.$$.fragment,i),q(Ir.$$.fragment,i),q(rn.$$.fragment,i),q(Rr.$$.fragment,i),q(ln.$$.fragment,i),q(dn.$$.fragment,i),Zp=!0)},o(i){$(p.$$.fragment,i),$(w.$$.fragment,i),$(wt.$$.fragment,i),$(bo.$$.fragment,i),$(jo.$$.fragment,i),$(qo.$$.fragment,i),$(Fn.$$.fragment,i),$(Eo.$$.fragment,i),$(Cn.$$.fragment,i),$(Pn.$$.fragment,i),$(Mn.$$.fragment,i),$(On.$$.fragment,i),$(Dn.$$.fragment,i),$(Co.$$.fragment,i),$(In.$$.fragment,i),$(Wn.$$.fragment,i),$(Hn.$$.fragment,i),$(Un.$$.fragment,i),$(Kn.$$.fragment,i),$(Vn.$$.fragment,i),$(Yn.$$.fragment,i),$(ar.$$.fragment,i),$(Oo.$$.fragment,i),$(Do.$$.fragment,i),$(or.$$.fragment,i),$(nr.$$.fragment,i),$(lr.$$.fragment,i),$(Lo.$$.fragment,i),$(Qo.$$.fragment,i),$(dr.$$.fragment,i),$(pr.$$.fragment,i),$(mr.$$.fragment,i),$(Wo.$$.fragment,i),$(Ho.$$.fragment,i),$(fr.$$.fragment,i),$(gr.$$.fragment,i),$(br.$$.fragment,i),$(Ro.$$.fragment,i),$(Bo.$$.fragment,i),$(wr.$$.fragment,i),$(yr.$$.fragment,i),$(Ko.$$.fragment,i),$($r.$$.fragment,i),$(Vo.$$.fragment,i),$(Yo.$$.fragment,i),$(Er.$$.fragment,i),$(Ar.$$.fragment,i),$(Xo.$$.fragment,i),$(Pr.$$.fragment,i),$(Zo.$$.fragment,i),$(en.$$.fragment,i),$(Mr.$$.fragment,i),$(Sr.$$.fragment,i),$(sn.$$.fragment,i),$(Lr.$$.fragment,i),$(an.$$.fragment,i),$(on.$$.fragment,i),$(Qr.$$.fragment,i),$(Ir.$$.fragment,i),$(rn.$$.fragment,i),$(Rr.$$.fragment,i),$(ln.$$.fragment,i),$(dn.$$.fragment,i),Zp=!1},d(i){t(l),i&&t(v),i&&t(d),E(p),i&&t(H),i&&t(N),E(w),i&&t(U),i&&t(O),i&&t(me),i&&t(Z),i&&t(ce),i&&t(ee),i&&t(ve),i&&t(Pe),i&&t(je),i&&t(Me),i&&t(pe),i&&t(Se),i&&t(qe),i&&t(V),i&&t(Q),i&&t(Le),i&&t(Qe),i&&t(Ie),i&&t(xe),i&&t(ne),i&&t(Ts),i&&t(ts),i&&t(bs),i&&t(ut),i&&t(ha),i&&t(Yt),E(wt),i&&t(ua),i&&t(nt),i&&t(ma),i&&t(ys),i&&t(fa),i&&t(be),i&&t(ga),i&&t(Ft),i&&t(_a),i&&t(js),i&&t(va),i&&t(Ge),i&&t(mp),E(bo,i),i&&t(fp),i&&t(wo),i&&t(gp),i&&t(yo),i&&t(_p),i&&t(Vr),i&&t(vp),i&&t(ko),i&&t(Tp),i&&t(rt),i&&t(bp),i&&t(zt),i&&t(wp),i&&t(ni),i&&t(yp),E(jo,i),i&&t(kp),i&&t(Ke),i&&t(jp),i&&t(ii),i&&t(qp),E(qo,i),i&&t($p),i&&t(Ua),E(Fn),i&&t(Ep),E(Eo,i),i&&t(Ap),i&&t(xt),i&&t(Fp),i&&t(Ra),E(Cn),i&&t(zp),i&&t(Fo),i&&t(xp),i&&t(Ba),E(Pn),i&&t(Cp),i&&t(Ga),E(Mn),i&&t(Pp),i&&t(Ka),E(On),i&&t(Mp),i&&t(Xt),E(Dn),E(Co),i&&t(Sp),i&&t(Ja),E(In),i&&t(Op),i&&t(ct),E(Wn),E(Hn),E(Un),E(Kn),i&&t(Dp),i&&t(Xa),E(Vn),i&&t(Np),i&&t(kt),E(Yn),E(ar),E(Oo),E(Do),i&&t(Lp),i&&t(eo),E(or),i&&t(Qp),i&&t(vs),E(nr),E(lr),E(Lo),E(Qo),i&&t(Ip),i&&t(ao),E(dr),i&&t(Wp),i&&t(Zt),E(pr),E(mr),E(Wo),E(Ho),i&&t(Hp),i&&t(no),E(fr),i&&t(Up),i&&t(es),E(gr),E(br),E(Ro),E(Bo),i&&t(Rp),i&&t(lo),E(wr),i&&t(Bp),i&&t(jt),E(yr),E(Ko),E($r),E(Vo),E(Yo),i&&t(Gp),i&&t(co),E(Er),i&&t(Kp),i&&t(qt),E(Ar),E(Xo),E(Pr),E(Zo),E(en),i&&t(Vp),i&&t(uo),E(Mr),i&&t(Yp),i&&t($t),E(Sr),E(sn),E(Lr),E(an),E(on),i&&t(Jp),i&&t(fo),E(Qr),i&&t(Xp),i&&t(Et),E(Ir),E(rn),E(Rr),E(ln),E(dn)}}}const Fk={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 zk(x){return Uy(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Nk extends Ly{constructor(l){super();Qy(this,l,zk,Ak,Iy,{})}}export{Nk as default,Fk as metadata};
