This repository contains code to pre-train ELECTRA, including small ELECTRA models on a single GPU. It also supports fine-tuning ELECTRA on downstream tasks including classification tasks (e.g,. [GLUE](https://gluebenchmark.com/)), QA tasks (e.g., [SQuAD](https://rajpurkar.github.io/SQuAD-explorer/)), and sequence tagging tasks (e.g., [text chunking](https://www.clips.uantwerpen.be/conll2000/chunking/)).


## How to use the generator in `transformers`


```python
from transformers import pipeline

fill_mask = pipeline(
	"fill-mask",
	model="google/electra-small-generator",
	tokenizer="google/electra-small-generator"
)

print(
	fill_mask(f"HuggingFace is creating a {nlp.tokenizer.mask_token} that the community uses to solve NLP tasks.")
)

```


model name: electra-small-generator


model author: google


task: fill-mask


tags: pytorch, tf, jax, electra, fill-mask, en, transformers, license:apache-2.0, autonlp_compatible, infinity_compatible


## language: en
license: apache-2.0


# realm-orqa-nq-reader


## Model description


The REALM checkpoint finetuned with Natural Question(NQ) dataset, converted from the TF checkpoint provided by Google Language.


The original paper, code, and checkpoints can be found [here](https://github.com/google-research/language/tree/master/language/realm).


## Usage


```python
from transformers import RealmReader

reader = RealmReader.from_pretrained("qqaatw/realm-orqa-nq-reader")
```


model name: realm-orqa-nq-reader


tags: pytorch, realm, en, transformers, license:apache-2.0


language: multilingual
license: apache-2.0
datasets:


- bookcorpus
- wikipedia


# CANINE-c (CANINE pre-trained with autoregressive character loss)


Pretrained CANINE model on 104 languages using a masked language modeling (MLM) objective. It was introduced in the paper [CANINE: Pre-training an Efficient Tokenization-Free Encoder for Language Representation](https://arxiv.org/abs/2103.06874) and first released in [this repository](https://github.com/google-research/language/tree/master/language/canine).


What's special about CANINE is that it doesn't require an explicit tokenizer (such as WordPiece or SentencePiece) as other models like BERT and RoBERTa. Instead, it directly operates at a character level: each character is turned into its [Unicode code point](https://en.wikipedia.org/wiki/Code_point#:~:text=For%20Unicode%2C%20the%20particular%20sequence,forming%20a%20self%2Dsynchronizing%20code.).


This means that input processing is trivial and can typically be accomplished as:


```
input_ids = [ord(char) for char in text]
```


The ord() function is part of Python, and turns each character into its Unicode code point.


Disclaimer: The team releasing CANINE did not write a model card for this model so this model card has been written by the Hugging Face team.


CANINE is a transformers model pretrained on a large corpus of multilingual data in a self-supervised fashion, similar to BERT. This means it was pretrained on the raw texts only, with no humans labelling them in any way (which is why it can use lots of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, it was pretrained with two objectives:


* Masked language modeling (MLM): one randomly masks part of the inputs, which the model needs to predict. This model (CANINE-c) is trained with an autoregressive character loss. One masks several character spans within each sequence, which the model then autoregressively predicts.
* Next sentence prediction (NSP): the model concatenates two sentences as inputs during pretraining. Sometimes they correspond to sentences that were next to each other in the original text, sometimes not. The model then has to predict if the two sentences were following each other or not.


This way, the model learns an inner representation of multiple languages that can then be used to extract features useful for downstream tasks: if you have a dataset of labeled sentences for instance, you can train a standard classifier using the features produced by the CANINE model as inputs.


## Intended uses & limitations


You can use the raw model for either masked language modeling or next sentence prediction, but it's mostly intended to be fine-tuned on a downstream task. See the [model hub](https://huggingface.co/models?filter=canine) to look for fine-tuned versions on a task that interests you.


Note that this model is primarily aimed at being fine-tuned on tasks that use the whole sentence (potentially masked) to make decisions, such as sequence classification, token classification or question answering. For tasks such as text generation you should look at models like GPT2.


### How to use


Here is how to use this model:


```python
from transformers import CanineTokenizer, CanineModel

model = CanineModel.from_pretrained('google/canine-c')
tokenizer = CanineTokenizer.from_pretrained('google/canine-c')

inputs = ["Life is like a box of chocolates.", "You never know what you gonna get."]
encoding = tokenizer(inputs, padding="longest", truncation=True, return_tensors="pt")

outputs = model(**encoding) # forward pass
pooled_output = outputs.pooler_output
sequence_output = outputs.last_hidden_state
```


## Training data


The CANINE model was pretrained on on the multilingual Wikipedia data of [mBERT](https://github.com/google-research/bert/blob/master/multilingual.md), which includes 104 languages.


### BibTeX entry and citation info


```bibtex
@article{DBLP:journals/corr/abs-2103-06874,
  author    = {Jonathan H. Clark and
               Dan Garrette and
               Iulia Turc and
               John Wieting},
  title     = {{CANINE:} Pre-training an Efficient Tokenization-Free Encoder for
               Language Representation},
  journal   = {CoRR},
  volume    = {abs/2103.06874},
  year      = {2021},
  url       = {https://arxiv.org/abs/2103.06874},
  archivePrefix = {arXiv},
  eprint    = {2103.06874},
  timestamp = {Tue, 16 Mar 2021 11:26:59 +0100},
  biburl    = {https://dblp.org/rec/journals/corr/abs-2103-06874.bib},
  bibsource = {dblp computer science bibliography, https://dblp.org}
}
```


model name: canine-c


model author: google


task: feature-extraction


tags: pytorch, canine, feature-extraction, multilingual, dataset:bookcorpus, dataset:wikipedia, arxiv:2103.06874, transformers, license:apache-2.0


thumbnail: https://huggingface.co/front/thumbnails/google.png


## license: apache-2.0


# BERT Miniatures


This is the set of 24 BERT models referenced in [Well-Read Students Learn Better: On the Importance of Pre-training Compact Models](https://arxiv.org/abs/1908.08962) (English only, uncased, trained with WordPiece masking).


We have shown that the standard BERT recipe (including model architecture and training objective) is effective on a wide range of model sizes, beyond BERT-Base and BERT-Large. The smaller BERT models are intended for environments with restricted computational resources. They can be fine-tuned in the same manner as the original BERT models. However, they are most effective in the context of knowledge distillation, where the fine-tuning labels are produced by a larger and more accurate teacher.


Our goal is to enable research in institutions with fewer computational resources and encourage the community to seek directions of innovation alternative to increasing model capacity.


You can download the 24 BERT miniatures either from the [official BERT Github page](https://github.com/google-research/bert/), or via HuggingFace from the links below:


|   |H=128|H=256|H=512|H=768|
|---|:---:|:---:|:---:|:---:|
| **L=2**  |[**2/128 (BERT-Tiny)**](https://huggingface.co/google/bert_uncased_L-2_H-128_A-2)|[2/256](https://huggingface.co/google/bert_uncased_L-2_H-256_A-4)|[2/512](https://huggingface.co/google/bert_uncased_L-2_H-512_A-8)|[2/768](https://huggingface.co/google/bert_uncased_L-2_H-768_A-12)|
| **L=4**  |[4/128](https://huggingface.co/google/bert_uncased_L-4_H-128_A-2)|[**4/256 (BERT-Mini)**](https://huggingface.co/google/bert_uncased_L-4_H-256_A-4)|[**4/512 (BERT-Small)**](https://huggingface.co/google/bert_uncased_L-4_H-512_A-8)|[4/768](https://huggingface.co/google/bert_uncased_L-4_H-768_A-12)|
| **L=6**  |[6/128](https://huggingface.co/google/bert_uncased_L-6_H-128_A-2)|[6/256](https://huggingface.co/google/bert_uncased_L-6_H-256_A-4)|[6/512](https://huggingface.co/google/bert_uncased_L-6_H-512_A-8)|[6/768](https://huggingface.co/google/bert_uncased_L-6_H-768_A-12)|
| **L=8**  |[8/128](https://huggingface.co/google/bert_uncased_L-8_H-128_A-2)|[8/256](https://huggingface.co/google/bert_uncased_L-8_H-256_A-4)|[**8/512 (BERT-Medium)**](https://huggingface.co/google/bert_uncased_L-8_H-512_A-8)|[8/768](https://huggingface.co/google/bert_uncased_L-8_H-768_A-12)|
| **L=10** |[10/128](https://huggingface.co/google/bert_uncased_L-10_H-128_A-2)|[10/256](https://huggingface.co/google/bert_uncased_L-10_H-256_A-4)|[10/512](https://huggingface.co/google/bert_uncased_L-10_H-512_A-8)|[10/768](https://huggingface.co/google/bert_uncased_L-10_H-768_A-12)|
| **L=12** |[12/128](https://huggingface.co/google/bert_uncased_L-12_H-128_A-2)|[12/256](https://huggingface.co/google/bert_uncased_L-12_H-256_A-4)|[12/512](https://huggingface.co/google/bert_uncased_L-12_H-512_A-8)|[**12/768 (BERT-Base)**](https://huggingface.co/google/bert_uncased_L-12_H-768_A-12)|


Note that the BERT-Base model in this release is included for completeness only; it was re-trained under the same regime as the original model.


Here are the corresponding GLUE scores on the test set:


For each task, we selected the best fine-tuning hyperparameters from the lists below, and trained for 4 epochs:


- batch sizes: 8, 16, 32, 64, 128
- learning rates: 3e-4, 1e-4, 5e-5, 3e-5


If you use these models, please cite the following paper:


```
@article{turc2019,
  title={Well-Read Students Learn Better: On the Importance of Pre-training Compact Models},
  author={Turc, Iulia and Chang, Ming-Wei and Lee, Kenton and Toutanova, Kristina},
  journal={arXiv preprint arXiv:1908.08962v2 },
  year={2019}
}
```


model name: bert_uncased_L-6_H-128_A-2


model author: google


tags: pytorch, jax, bert, arxiv:1908.08962, transformers, license:apache-2.0, infinity_compatible


model name: bert_uncased_L-10_H-256_A-4


language: en
datasets:


- c4
- wikipedia


## license: apache-2.0


[Google's T5](https://ai.googleblog.com/2020/02/exploring-transfer-learning-with-t5.html) for **Closed Book Question Answering**.


The model was pre-trained using T5's denoising objective on [C4](https://huggingface.co/datasets/c4) and subsequently additionally pre-trained using [REALM](https://arxiv.org/pdf/2002.08909.pdf)'s salient span masking objective on [Wikipedia](https://huggingface.co/datasets/wikipedia).


**Note**: This model should be fine-tuned on a question answering downstream task before it is useable for closed book question answering.


Other Community Checkpoints: [here](https://huggingface.co/models?search=ssm)


Paper: [How Much Knowledge Can You Pack
Into the Parameters of a Language Model?](https://arxiv.org/abs/1910.10683.pdf)


Authors: *Adam Roberts, Colin Raffel, Noam Shazeer*


## Abstract


It has recently been observed that neural language models trained on unstructured text can implicitly store and retrieve knowledge using natural language queries. In this short paper, we measure the practical utility of this approach by fine-tuning pre-trained models to answer questions without access to any external context or knowledge. We show that this approach scales with model size and performs competitively with open-domain systems that explicitly retrieve answers from an external knowledge source when answering questions. To facilitate reproducibility and future work, we release our code and trained models at https://goo.gle/t5-cbqa.


![model image](https://raw.githubusercontent.com/patrickvonplaten/scientific_images/master/how_much_know_ledge_image.png)


model name: t5-large-ssm


task: text2text-generation


tags: pytorch, tf, jax, t5, text2text-generation, en, dataset:c4, dataset:wikipedia, arxiv:2002.08909, arxiv:1910.10683, transformers, license:apache-2.0, autonlp_compatible


language: en
tags:


- multiberts
- multiberts-seed_2
- multiberts-seed_2-step_1800k
license: apache-2.0


# MultiBERTs, Intermediate Checkpoint - Seed 2, Step 1800k


MultiBERTs is a collection of checkpoints and a statistical library to support
robust research on BERT. We provide 25 BERT-base models trained with
similar hyper-parameters as
[the original BERT model](https://github.com/google-research/bert) but
with different random seeds, which causes variations in the initial weights and order of
training instances. The aim is to distinguish findings that apply to a specific
artifact (i.e., a particular instance of the model) from those that apply to the
more general procedure.


We also provide 140 intermediate checkpoints captured
during the course of pre-training (we saved 28 checkpoints for the first 5 runs).


The models were originally released through
[http://goo.gle/multiberts](http://goo.gle/multiberts). We describe them in our
paper
[The MultiBERTs: BERT Reproductions for Robustness Analysis](https://arxiv.org/abs/2106.16163).


This is model #2, captured at step 1800k (max: 2000k, i.e., 2M steps).


## Model Description


This model was captured during a reproduction of
[BERT-base uncased](https://github.com/google-research/bert), for English: it
is a Transformers model pretrained on a large corpus of English data, using the
Masked Language Modelling (MLM) and the Next Sentence Prediction (NSP)
objectives.


The intended uses, limitations, training data and training procedure for the fully trained model are similar
to [BERT-base uncased](https://github.com/google-research/bert). Two major
differences with the original model:


* We pre-trained the MultiBERTs models for 2 million steps using sequence
length 512 (instead of 1 million steps using sequence length 128 then 512).
* We used an alternative version of Wikipedia and Books Corpus, initially
collected for [Turc et al., 2019](https://arxiv.org/abs/1908.08962).


This is a best-effort reproduction, and so it is probable that differences with
the original model have gone unnoticed. The performance of MultiBERTs on GLUE after full training is oftentimes comparable to that of original
BERT, but we found significant differences on the dev set of SQuAD (MultiBERTs outperforms original BERT).
See our [technical report](https://arxiv.org/abs/2106.16163) for more details.


### How to use


Using code from
[BERT-base uncased](https://huggingface.co/bert-base-uncased), here is an example based on
Tensorflow:


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_2-step_1800k')
model = TFBertModel.from_pretrained("google/multiberts-seed_2-step_1800k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


PyTorch version:


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_2-step_1800k')
model = BertModel.from_pretrained("google/multiberts-seed_2-step_1800k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


## Citation info


```bibtex
@article{sellam2021multiberts,
  title={The MultiBERTs: BERT Reproductions for Robustness Analysis},
  author={Thibault Sellam and Steve Yadlowsky and Jason Wei and Naomi Saphra and Alexander D'Amour and Tal Linzen and Jasmijn Bastings and Iulia Turc and Jacob Eisenstein and Dipanjan Das and Ian Tenney and Ellie Pavlick},
  journal={arXiv preprint arXiv:2106.16163},
  year={2021}
}
```


model name: multiberts-seed_2-step_1800k


model author: google


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_2, multiberts-seed_2-step_1800k, license:apache-2.0, infinity_compatible


language: en
tags:


- multiberts
- multiberts-seed_2
- multiberts-seed_2-step_1700k
license: apache-2.0


# MultiBERTs, Intermediate Checkpoint - Seed 2, Step 1700k


This is model #2, captured at step 1700k (max: 2000k, i.e., 2M steps).


## Model Description


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_2-step_1700k')
model = TFBertModel.from_pretrained("google/multiberts-seed_2-step_1700k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_2-step_1700k')
model = BertModel.from_pretrained("google/multiberts-seed_2-step_1700k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


model name: multiberts-seed_2-step_1700k


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_2, multiberts-seed_2-step_1700k, license:apache-2.0, infinity_compatible


- tapas
- table-question-answering
license: apache-2.0
datasets:
- msr_sqa


# TAPAS base model fine-tuned on Sequential Question Answering (SQA)


This model has 2 versions which can be used. The default version corresponds to the `tapas_sqa_inter_masklm_base_reset` checkpoint of the [original Github repository](https://github.com/google-research/tapas).
This model was pre-trained on MLM and an additional step which the authors call intermediate pre-training, and then fine-tuned on [SQA](https://www.microsoft.com/en-us/download/details.aspx?id=54253). It uses relative position embeddings (i.e. resetting the position index at every cell of the table).


The other (non-default) version which can be used is:


- `no_reset`, which corresponds to `tapas_sqa_inter_masklm_base` (intermediate pre-training, absolute position embeddings).


Disclaimer: The team releasing TAPAS did not write a model card for this model so this model card has been written by
the Hugging Face team and contributors.


## Results on SQA - Dev Accuracy


Size     |  Reset  | Dev Accuracy | Link
-------- | --------| -------- | ----
LARGE | noreset | 0.7223 | [tapas-large-finetuned-sqa (absolute pos embeddings)](https://huggingface.co/google/tapas-large-finetuned-sqa/tree/no_reset)
LARGE | reset | 0.7289 | [tapas-large-finetuned-sqa](https://huggingface.co/google/tapas-large-finetuned-sqa/tree/main)
**BASE** | **noreset** | **0.6737** | [tapas-base-finetuned-sqa (absolute pos embeddings)](https://huggingface.co/google/tapas-base-finetuned-sqa/tree/no_reset)
**BASE** | **reset** | **0.6874** | [tapas-base-finetuned-sqa](https://huggingface.co/google/tapas-base-finetuned-sqa/tree/main)
MEDIUM | noreset | 0.6464 | [tapas-medium-finetuned-sqa (absolute pos embeddings)](https://huggingface.co/google/tapas-medium-finetuned-sqa/tree/no_reset)
MEDIUM | reset | 0.6561 | [tapas-medium-finetuned-sqa](https://huggingface.co/google/tapas-medium-finetuned-sqa/tree/main)
SMALL | noreset | 0.5876 | [tapas-small-finetuned-sqa (absolute pos embeddings)](https://huggingface.co/google/tapas-small-finetuned-sqa/tree/no_reset)
SMALL | reset | 0.6155 | [tapas-small-finetuned-sqa](https://huggingface.co/google/tapas-small-finetuned-sqa/tree/main)
MINI | noreset | 0.4574 | [tapas-mini-finetuned-sqa (absolute pos embeddings)](https://huggingface.co/google/tapas-mini-finetuned-sqa/tree/no_reset)
MINI | reset | 0.5148 | [tapas-mini-finetuned-sqa](https://huggingface.co/google/tapas-mini-finetuned-sqa/tree/main))
TINY | noreset | 0.2004 | [tapas-tiny-finetuned-sqa (absolute pos embeddings)](https://huggingface.co/google/tapas-tiny-finetuned-sqa/tree/no_reset)
TINY | reset | 0.2375 | [tapas-tiny-finetuned-sqa](https://huggingface.co/google/tapas-tiny-finetuned-sqa/tree/main)


## Model description


TAPAS is a BERT-like transformers model pretrained on a large corpus of English data from Wikipedia in a self-supervised fashion.
This means it was pretrained on the raw tables and associated texts only, with no humans labelling them in any way (which is why it
can use lots of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, it
was pretrained with two objectives:


- Masked language modeling (MLM): taking a (flattened) table and associated context, the model randomly masks 15% of the words in
the input, then runs the entire (partially masked) sequence through the model. The model then has to predict the masked words.
This is different from traditional recurrent neural networks (RNNs) that usually see the words one after the other,
or from autoregressive models like GPT which internally mask the future tokens. It allows the model to learn a bidirectional
representation of a table and associated text.
- Intermediate pre-training: to encourage numerical reasoning on tables, the authors additionally pre-trained the model by creating
a balanced dataset of millions of syntactically created training examples. Here, the model must predict (classify) whether a sentence
is supported or refuted by the contents of a table. The training examples are created based on synthetic as well as counterfactual statements.


This way, the model learns an inner representation of the English language used in tables and associated texts, which can then be used
to extract features useful for downstream tasks such as answering questions about a table, or determining whether a sentence is entailed
or refuted by the contents of a table. Fine-tuning is done by adding a cell selection head on top of the pre-trained model, and then jointly
train this randomly initialized classification head with the base model on SQA.


## Intended uses & limitations


You can use this model for answering questions related to a table in a conversational set-up.


For code examples, we refer to the documentation of TAPAS on the HuggingFace website.


## Training procedure


### Preprocessing


The texts are lowercased and tokenized using WordPiece and a vocabulary size of 30,000. The inputs of the model are
then of the form:


```
[CLS] Question [SEP] Flattened table [SEP]
```


### Fine-tuning


The model was fine-tuned on 32 Cloud TPU v3 cores for 200,000 steps with maximum sequence length 512 and batch size of 128.
In this setup, fine-tuning takes around 20 hours. The optimizer used is Adam with a learning rate of 1.25e-5, and a warmup ratio
of 0.2. An inductive bias is added such that the model only selects cells of the same column. This is reflected by the
`select_one_column` parameter of `TapasConfig`. See also table 12 of the [original paper](https://arxiv.org/abs/2004.02349).


### BibTeX entry and citation info


```bibtex
@misc{herzig2020tapas,
      title={TAPAS: Weakly Supervised Table Parsing via Pre-training},
      author={Jonathan Herzig and Paweł Krzysztof Nowak and Thomas Müller and Francesco Piccinno and Julian Martin Eisenschlos},
      year={2020},
      eprint={2004.02349},
      archivePrefix={arXiv},
      primaryClass={cs.IR}
}
```


```bibtex
@misc{eisenschlos2020understanding,
      title={Understanding tables with intermediate pre-training},
      author={Julian Martin Eisenschlos and Syrine Krichene and Thomas Müller},
      year={2020},
      eprint={2010.00571},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}
```


```bibtex
@InProceedings{iyyer2017search-based,
author = {Iyyer, Mohit and Yih, Scott Wen-tau and Chang, Ming-Wei},
title = {Search-based Neural Structured Learning for Sequential Question Answering},
booktitle = {Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics},
year = {2017},
month = {July},
abstract = {Recent work in semantic parsing for question answering has focused on long and complicated questions, many of which would seem unnatural if asked in a normal conversation between two humans. In an effort to explore a conversational QA setting, we present a more realistic task: answering sequences of simple but inter-related questions. We collect a dataset of 6,066 question sequences that inquire about semi-structured tables from Wikipedia, with 17,553 question-answer pairs in total. To solve this sequential question answering task, we propose a novel dynamic neural semantic parsing framework trained using a weakly supervised reward-guided search. Our model effectively leverages the sequential context to outperform state-of-the-art QA systems that are designed to answer highly complex questions.},
publisher = {Association for Computational Linguistics},
url = {https://www.microsoft.com/en-us/research/publication/search-based-neural-structured-learning-sequential-question-answering/},
}
```


model name: tapas-base-finetuned-sqa


model author: google


task: table-question-answering


tags: pytorch, tf, tapas, table-question-answering, en, dataset:msr_sqa, arxiv:2004.02349, arxiv:2010.00571, transformers, license:apache-2.0


language: en
tags:


- multiberts
- multiberts-seed_0
- multiberts-seed_0-step_200k
license: apache-2.0


# MultiBERTs, Intermediate Checkpoint - Seed 0, Step 200k


MultiBERTs is a collection of checkpoints and a statistical library to support
robust research on BERT. We provide 25 BERT-base models trained with
similar hyper-parameters as
[the original BERT model](https://github.com/google-research/bert) but
with different random seeds, which causes variations in the initial weights and order of
training instances. The aim is to distinguish findings that apply to a specific
artifact (i.e., a particular instance of the model) from those that apply to the
more general procedure.


We also provide 140 intermediate checkpoints captured
during the course of pre-training (we saved 28 checkpoints for the first 5 runs).


The models were originally released through
[http://goo.gle/multiberts](http://goo.gle/multiberts). We describe them in our
paper
[The MultiBERTs: BERT Reproductions for Robustness Analysis](https://arxiv.org/abs/2106.16163).


This is model #0, captured at step 200k (max: 2000k, i.e., 2M steps).


## Model Description


This model was captured during a reproduction of
[BERT-base uncased](https://github.com/google-research/bert), for English: it
is a Transformers model pretrained on a large corpus of English data, using the
Masked Language Modelling (MLM) and the Next Sentence Prediction (NSP)
objectives.


The intended uses, limitations, training data and training procedure for the fully trained model are similar
to [BERT-base uncased](https://github.com/google-research/bert). Two major
differences with the original model:


* We pre-trained the MultiBERTs models for 2 million steps using sequence
length 512 (instead of 1 million steps using sequence length 128 then 512).
* We used an alternative version of Wikipedia and Books Corpus, initially
collected for [Turc et al., 2019](https://arxiv.org/abs/1908.08962).


This is a best-effort reproduction, and so it is probable that differences with
the original model have gone unnoticed. The performance of MultiBERTs on GLUE after full training is oftentimes comparable to that of original
BERT, but we found significant differences on the dev set of SQuAD (MultiBERTs outperforms original BERT).
See our [technical report](https://arxiv.org/abs/2106.16163) for more details.


### How to use


Using code from
[BERT-base uncased](https://huggingface.co/bert-base-uncased), here is an example based on
Tensorflow:


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_0-step_200k')
model = TFBertModel.from_pretrained("google/multiberts-seed_0-step_200k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


PyTorch version:


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_0-step_200k')
model = BertModel.from_pretrained("google/multiberts-seed_0-step_200k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


## Citation info


```bibtex
@article{sellam2021multiberts,
  title={The MultiBERTs: BERT Reproductions for Robustness Analysis},
  author={Thibault Sellam and Steve Yadlowsky and Jason Wei and Naomi Saphra and Alexander D'Amour and Tal Linzen and Jasmijn Bastings and Iulia Turc and Jacob Eisenstein and Dipanjan Das and Ian Tenney and Ellie Pavlick},
  journal={arXiv preprint arXiv:2106.16163},
  year={2021}
}
```


model name: multiberts-seed_0-step_200k


model author: google


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_0, multiberts-seed_0-step_200k, license:apache-2.0, infinity_compatible


language: en
tags:


- multiberts
- multiberts-seed_1
- multiberts-seed_1-step_900k
license: apache-2.0


# MultiBERTs, Intermediate Checkpoint - Seed 1, Step 900k


This is model #1, captured at step 900k (max: 2000k, i.e., 2M steps).


## Model Description


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_1-step_900k')
model = TFBertModel.from_pretrained("google/multiberts-seed_1-step_900k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_1-step_900k')
model = BertModel.from_pretrained("google/multiberts-seed_1-step_900k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


model name: multiberts-seed_1-step_900k


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_1, multiberts-seed_1-step_900k, license:apache-2.0, infinity_compatible


- tapas
- TapasModel
license: apache-2.0


# TAPAS tiny model


This model has 2 versions which can be used. The latest version, which is the default one, corresponds to the `tapas_inter_masklm_tiny_reset` checkpoint of the [original Github repository](https://github.com/google-research/tapas).
This model was pre-trained on MLM and an additional step which the authors call intermediate pre-training. It uses relative position embeddings by default (i.e. resetting the position index at every cell of the table).


The other (non-default) version which can be used is the one with absolute position embeddings:


- `revision="no_reset"`, which corresponds to `tapas_inter_masklm_tiny`


Disclaimer: The team releasing TAPAS did not write a model card for this model so this model card has been written by
the Hugging Face team and contributors.


## Model description


TAPAS is a BERT-like transformers model pretrained on a large corpus of English data from Wikipedia in a self-supervised fashion.
This means it was pretrained on the raw tables and associated texts only, with no humans labelling them in any way (which is why it
can use lots of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, it
was pretrained with two objectives:


- Masked language modeling (MLM): taking a (flattened) table and associated context, the model randomly masks 15% of the words in
the input, then runs the entire (partially masked) sequence through the model. The model then has to predict the masked words.
This is different from traditional recurrent neural networks (RNNs) that usually see the words one after the other,
or from autoregressive models like GPT which internally mask the future tokens. It allows the model to learn a bidirectional
representation of a table and associated text.
- Intermediate pre-training: to encourage numerical reasoning on tables, the authors additionally pre-trained the model by creating
a balanced dataset of millions of syntactically created training examples. Here, the model must predict (classify) whether a sentence
is supported or refuted by the contents of a table. The training examples are created based on synthetic as well as counterfactual statements.


This way, the model learns an inner representation of the English language used in tables and associated texts, which can then be used
to extract features useful for downstream tasks such as answering questions about a table, or determining whether a sentence is entailed
or refuted by the contents of a table. Fine-tuning is done by adding one or more classification heads on top of the pre-trained model, and then
jointly train these randomly initialized classification heads with the base model on a downstream task.


## Intended uses & limitations


You can use the raw model for getting hidden representatons about table-question pairs, but it's mostly intended to be fine-tuned on a downstream task such as question answering or sequence classification. See the [model hub](https://huggingface.co/models?filter=tapas) to look for fine-tuned versions on a task that interests you.


## Training procedure


### Preprocessing


The texts are lowercased and tokenized using WordPiece and a vocabulary size of 30,000. The inputs of the model are
then of the form:


```
[CLS] Sentence [SEP] Flattened table [SEP]
```


### Pre-training


The model was pre-trained on 32 Cloud TPU v3 cores for 1,000,000 steps with maximum sequence length 512 and batch size of 512.
In this setup, pre-training on MLM only takes around 3 days. Aditionally, the model has been further pre-trained on a second task (table entailment). See the original TAPAS [paper](https://www.aclweb.org/anthology/2020.acl-main.398/) and the [follow-up paper](https://www.aclweb.org/anthology/2020.findings-emnlp.27/) for more details.


The optimizer used is Adam with a learning rate of 5e-5, and a warmup
ratio of 0.01.


### BibTeX entry and citation info


```bibtex
@misc{herzig2020tapas,
      title={TAPAS: Weakly Supervised Table Parsing via Pre-training},
      author={Jonathan Herzig and PaweÅ‚ Krzysztof Nowak and Thomas MÃ¼ller and Francesco Piccinno and Julian Martin Eisenschlos},
      year={2020},
      eprint={2004.02349},
      archivePrefix={arXiv},
      primaryClass={cs.IR}
}
```


```bibtex
@misc{eisenschlos2020understanding,
      title={Understanding tables with intermediate pre-training},
      author={Julian Martin Eisenschlos and Syrine Krichene and Thomas MÃ¼ller},
      year={2020},
      eprint={2010.00571},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}
```


model name: tapas-tiny


model author: google


task: feature-extraction


tags: pytorch, tf, tapas, feature-extraction, en, arxiv:2004.02349, arxiv:2010.00571, transformers, TapasModel, license:apache-2.0


language: en
tags:


- multiberts
- multiberts-seed_0
- multiberts-seed_0-step_1300k
license: apache-2.0


# MultiBERTs, Intermediate Checkpoint - Seed 0, Step 1300k


MultiBERTs is a collection of checkpoints and a statistical library to support
robust research on BERT. We provide 25 BERT-base models trained with
similar hyper-parameters as
[the original BERT model](https://github.com/google-research/bert) but
with different random seeds, which causes variations in the initial weights and order of
training instances. The aim is to distinguish findings that apply to a specific
artifact (i.e., a particular instance of the model) from those that apply to the
more general procedure.


We also provide 140 intermediate checkpoints captured
during the course of pre-training (we saved 28 checkpoints for the first 5 runs).


The models were originally released through
[http://goo.gle/multiberts](http://goo.gle/multiberts). We describe them in our
paper
[The MultiBERTs: BERT Reproductions for Robustness Analysis](https://arxiv.org/abs/2106.16163).


This is model #0, captured at step 1300k (max: 2000k, i.e., 2M steps).


## Model Description


This model was captured during a reproduction of
[BERT-base uncased](https://github.com/google-research/bert), for English: it
is a Transformers model pretrained on a large corpus of English data, using the
Masked Language Modelling (MLM) and the Next Sentence Prediction (NSP)
objectives.


The intended uses, limitations, training data and training procedure for the fully trained model are similar
to [BERT-base uncased](https://github.com/google-research/bert). Two major
differences with the original model:


* We pre-trained the MultiBERTs models for 2 million steps using sequence
length 512 (instead of 1 million steps using sequence length 128 then 512).
* We used an alternative version of Wikipedia and Books Corpus, initially
collected for [Turc et al., 2019](https://arxiv.org/abs/1908.08962).


This is a best-effort reproduction, and so it is probable that differences with
the original model have gone unnoticed. The performance of MultiBERTs on GLUE after full training is oftentimes comparable to that of original
BERT, but we found significant differences on the dev set of SQuAD (MultiBERTs outperforms original BERT).
See our [technical report](https://arxiv.org/abs/2106.16163) for more details.


### How to use


Using code from
[BERT-base uncased](https://huggingface.co/bert-base-uncased), here is an example based on
Tensorflow:


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_0-step_1300k')
model = TFBertModel.from_pretrained("google/multiberts-seed_0-step_1300k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


PyTorch version:


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_0-step_1300k')
model = BertModel.from_pretrained("google/multiberts-seed_0-step_1300k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


## Citation info


```bibtex
@article{sellam2021multiberts,
  title={The MultiBERTs: BERT Reproductions for Robustness Analysis},
  author={Thibault Sellam and Steve Yadlowsky and Jason Wei and Naomi Saphra and Alexander D'Amour and Tal Linzen and Jasmijn Bastings and Iulia Turc and Jacob Eisenstein and Dipanjan Das and Ian Tenney and Ellie Pavlick},
  journal={arXiv preprint arXiv:2106.16163},
  year={2021}
}
```


model name: multiberts-seed_0-step_1300k


model author: google


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_0, multiberts-seed_0-step_1300k, license:apache-2.0, infinity_compatible


language: en
tags:


- multiberts
- multiberts-seed_2
- multiberts-seed_2-step_1200k
license: apache-2.0


# MultiBERTs, Intermediate Checkpoint - Seed 2, Step 1200k


This is model #2, captured at step 1200k (max: 2000k, i.e., 2M steps).


## Model Description


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_2-step_1200k')
model = TFBertModel.from_pretrained("google/multiberts-seed_2-step_1200k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_2-step_1200k')
model = BertModel.from_pretrained("google/multiberts-seed_2-step_1200k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


model name: multiberts-seed_2-step_1200k


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_2, multiberts-seed_2-step_1200k, license:apache-2.0, infinity_compatible


- multiberts
- multiberts-seed_1
- multiberts-seed_1-step_120k
license: apache-2.0


# MultiBERTs, Intermediate Checkpoint - Seed 1, Step 120k


MultiBERTs is a collection of checkpoints and a statistical library to support
robust research on BERT. We provide 25 BERT-base models trained with
similar hyper-parameters as
[the original BERT model](https://github.com/google-research/bert) but
with different random seeds, which causes variations in the initial weights and order of
training instances. The aim is to distinguish findings that apply to a specific
artifact (i.e., a particular instance of the model) from those that apply to the
more general procedure.


We also provide 140 intermediate checkpoints captured
during the course of pre-training (we saved 28 checkpoints for the first 5 runs).


The models were originally released through
[http://goo.gle/multiberts](http://goo.gle/multiberts). We describe them in our
paper
[The MultiBERTs: BERT Reproductions for Robustness Analysis](https://arxiv.org/abs/2106.16163).


This is model #1, captured at step 120k (max: 2000k, i.e., 2M steps).


This model was captured during a reproduction of
[BERT-base uncased](https://github.com/google-research/bert), for English: it
is a Transformers model pretrained on a large corpus of English data, using the
Masked Language Modelling (MLM) and the Next Sentence Prediction (NSP)
objectives.


The intended uses, limitations, training data and training procedure for the fully trained model are similar
to [BERT-base uncased](https://github.com/google-research/bert). Two major
differences with the original model:


* We pre-trained the MultiBERTs models for 2 million steps using sequence
length 512 (instead of 1 million steps using sequence length 128 then 512).
* We used an alternative version of Wikipedia and Books Corpus, initially
collected for [Turc et al., 2019](https://arxiv.org/abs/1908.08962).


This is a best-effort reproduction, and so it is probable that differences with
the original model have gone unnoticed. The performance of MultiBERTs on GLUE after full training is oftentimes comparable to that of original
BERT, but we found significant differences on the dev set of SQuAD (MultiBERTs outperforms original BERT).
See our [technical report](https://arxiv.org/abs/2106.16163) for more details.


### How to use


Using code from
[BERT-base uncased](https://huggingface.co/bert-base-uncased), here is an example based on
Tensorflow:


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_1-step_120k')
model = TFBertModel.from_pretrained("google/multiberts-seed_1-step_120k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


PyTorch version:


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_1-step_120k')
model = BertModel.from_pretrained("google/multiberts-seed_1-step_120k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


## Citation info


```bibtex
@article{sellam2021multiberts,
  title={The MultiBERTs: BERT Reproductions for Robustness Analysis},
  author={Thibault Sellam and Steve Yadlowsky and Jason Wei and Naomi Saphra and Alexander D'Amour and Tal Linzen and Jasmijn Bastings and Iulia Turc and Jacob Eisenstein and Dipanjan Das and Ian Tenney and Ellie Pavlick},
  journal={arXiv preprint arXiv:2106.16163},
  year={2021}
}
```


model name: multiberts-seed_1-step_120k


model author: google


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_1, multiberts-seed_1-step_120k, license:apache-2.0, infinity_compatible


language: en
tags:


- multiberts
- multiberts-seed_3
- multiberts-seed_3-step_160k
license: apache-2.0


# MultiBERTs, Intermediate Checkpoint - Seed 3, Step 160k


This is model #3, captured at step 160k (max: 2000k, i.e., 2M steps).


## Model Description


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_3-step_160k')
model = TFBertModel.from_pretrained("google/multiberts-seed_3-step_160k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_3-step_160k')
model = BertModel.from_pretrained("google/multiberts-seed_3-step_160k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


model name: multiberts-seed_3-step_160k


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_3, multiberts-seed_3-step_160k, license:apache-2.0, infinity_compatible


- multiberts
- multiberts-seed_4
- multiberts-seed_4-step_1000k
license: apache-2.0


# MultiBERTs, Intermediate Checkpoint - Seed 4, Step 1000k


MultiBERTs is a collection of checkpoints and a statistical library to support
robust research on BERT. We provide 25 BERT-base models trained with
similar hyper-parameters as
[the original BERT model](https://github.com/google-research/bert) but
with different random seeds, which causes variations in the initial weights and order of
training instances. The aim is to distinguish findings that apply to a specific
artifact (i.e., a particular instance of the model) from those that apply to the
more general procedure.


We also provide 140 intermediate checkpoints captured
during the course of pre-training (we saved 28 checkpoints for the first 5 runs).


The models were originally released through
[http://goo.gle/multiberts](http://goo.gle/multiberts). We describe them in our
paper
[The MultiBERTs: BERT Reproductions for Robustness Analysis](https://arxiv.org/abs/2106.16163).


This is model #4, captured at step 1000k (max: 2000k, i.e., 2M steps).


This model was captured during a reproduction of
[BERT-base uncased](https://github.com/google-research/bert), for English: it
is a Transformers model pretrained on a large corpus of English data, using the
Masked Language Modelling (MLM) and the Next Sentence Prediction (NSP)
objectives.


The intended uses, limitations, training data and training procedure for the fully trained model are similar
to [BERT-base uncased](https://github.com/google-research/bert). Two major
differences with the original model:


* We pre-trained the MultiBERTs models for 2 million steps using sequence
length 512 (instead of 1 million steps using sequence length 128 then 512).
* We used an alternative version of Wikipedia and Books Corpus, initially
collected for [Turc et al., 2019](https://arxiv.org/abs/1908.08962).


This is a best-effort reproduction, and so it is probable that differences with
the original model have gone unnoticed. The performance of MultiBERTs on GLUE after full training is oftentimes comparable to that of original
BERT, but we found significant differences on the dev set of SQuAD (MultiBERTs outperforms original BERT).
See our [technical report](https://arxiv.org/abs/2106.16163) for more details.


### How to use


Using code from
[BERT-base uncased](https://huggingface.co/bert-base-uncased), here is an example based on
Tensorflow:


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_4-step_1000k')
model = TFBertModel.from_pretrained("google/multiberts-seed_4-step_1000k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


PyTorch version:


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_4-step_1000k')
model = BertModel.from_pretrained("google/multiberts-seed_4-step_1000k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


## Citation info


```bibtex
@article{sellam2021multiberts,
  title={The MultiBERTs: BERT Reproductions for Robustness Analysis},
  author={Thibault Sellam and Steve Yadlowsky and Jason Wei and Naomi Saphra and Alexander D'Amour and Tal Linzen and Jasmijn Bastings and Iulia Turc and Jacob Eisenstein and Dipanjan Das and Ian Tenney and Ellie Pavlick},
  journal={arXiv preprint arXiv:2106.16163},
  year={2021}
}
```


model name: multiberts-seed_4-step_1000k


model author: google


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_4, multiberts-seed_4-step_1000k, license:apache-2.0, infinity_compatible


language: en
tags:


- multiberts
- multiberts-seed_4
- multiberts-seed_4-step_1100k
license: apache-2.0


# MultiBERTs, Intermediate Checkpoint - Seed 4, Step 1100k


This is model #4, captured at step 1100k (max: 2000k, i.e., 2M steps).


## Model Description


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_4-step_1100k')
model = TFBertModel.from_pretrained("google/multiberts-seed_4-step_1100k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_4-step_1100k')
model = BertModel.from_pretrained("google/multiberts-seed_4-step_1100k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


model name: multiberts-seed_4-step_1100k


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_4, multiberts-seed_4-step_1100k, license:apache-2.0, infinity_compatible


- tapas
license: apache-2.0
datasets:
- msr_sqa


# TAPAS small model fine-tuned on Sequential Question Answering (SQA)


This model has 2 versions which can be used. The default version corresponds to the `tapas_sqa_inter_masklm_small_reset` checkpoint of the [original Github repository](https://github.com/google-research/tapas).
This model was pre-trained on MLM and an additional step which the authors call intermediate pre-training, and then fine-tuned on [SQA](https://www.microsoft.com/en-us/download/details.aspx?id=54253). It uses relative position embeddings (i.e. resetting the position index at every cell of the table).


The other (non-default) version which can be used is:


- `no_reset`, which corresponds to `tapas_sqa_inter_masklm_small` (intermediate pre-training, absolute position embeddings).


Disclaimer: The team releasing TAPAS did not write a model card for this model so this model card has been written by
the Hugging Face team and contributors.


## Results on SQA - Dev Accuracy


Size     |  Reset  | Dev Accuracy | Link
-------- | --------| -------- | ----
LARGE | noreset | 0.7223 | [tapas-large-finetuned-sqa (absolute pos embeddings)](https://huggingface.co/google/tapas-large-finetuned-sqa/tree/no_reset)
LARGE | reset | 0.7289 | [tapas-large-finetuned-sqa](https://huggingface.co/google/tapas-large-finetuned-sqa/tree/main)
BASE | noreset | 0.6737 | [tapas-base-finetuned-sqa (absolute pos embeddings)](https://huggingface.co/google/tapas-base-finetuned-sqa/tree/no_reset)
BASE | reset | 0.6874 | [tapas-base-finetuned-sqa](https://huggingface.co/google/tapas-base-finetuned-sqa/tree/main)
MEDIUM | noreset | 0.6464 | [tapas-medium-finetuned-sqa (absolute pos embeddings)](https://huggingface.co/google/tapas-medium-finetuned-sqa/tree/no_reset)
MEDIUM | reset | 0.6561 | [tapas-medium-finetuned-sqa](https://huggingface.co/google/tapas-medium-finetuned-sqa/tree/main)
**SMALL** | **noreset** | **0.5876** | [tapas-small-finetuned-sqa (absolute pos embeddings)](https://huggingface.co/google/tapas-small-finetuned-sqa/tree/no_reset)
**SMALL** | **reset** | **0.6155** | [tapas-small-finetuned-sqa](https://huggingface.co/google/tapas-small-finetuned-sqa/tree/main)
MINI | noreset | 0.4574 | [tapas-mini-finetuned-sqa (absolute pos embeddings)](https://huggingface.co/google/tapas-mini-finetuned-sqa/tree/no_reset)
MINI | reset | 0.5148 | [tapas-mini-finetuned-sqa](https://huggingface.co/google/tapas-mini-finetuned-sqa/tree/main))
TINY | noreset | 0.2004 | [tapas-tiny-finetuned-sqa (absolute pos embeddings)](https://huggingface.co/google/tapas-tiny-finetuned-sqa/tree/no_reset)
TINY | reset | 0.2375 | [tapas-tiny-finetuned-sqa](https://huggingface.co/google/tapas-tiny-finetuned-sqa/tree/main)


## Model description


TAPAS is a BERT-like transformers model pretrained on a large corpus of English data from Wikipedia in a self-supervised fashion.
This means it was pretrained on the raw tables and associated texts only, with no humans labelling them in any way (which is why it
can use lots of publicly available data) with an automatic process to generate inputs and labels from those texts. More precisely, it
was pretrained with two objectives:


- Masked language modeling (MLM): taking a (flattened) table and associated context, the model randomly masks 15% of the words in
the input, then runs the entire (partially masked) sequence through the model. The model then has to predict the masked words.
This is different from traditional recurrent neural networks (RNNs) that usually see the words one after the other,
or from autoregressive models like GPT which internally mask the future tokens. It allows the model to learn a bidirectional
representation of a table and associated text.
- Intermediate pre-training: to encourage numerical reasoning on tables, the authors additionally pre-trained the model by creating
a balanced dataset of millions of syntactically created training examples. Here, the model must predict (classify) whether a sentence
is supported or refuted by the contents of a table. The training examples are created based on synthetic as well as counterfactual statements.


This way, the model learns an inner representation of the English language used in tables and associated texts, which can then be used
to extract features useful for downstream tasks such as answering questions about a table, or determining whether a sentence is entailed
or refuted by the contents of a table. Fine-tuning is done by adding a cell selection head on top of the pre-trained model, and then jointly
train this randomly initialized classification head with the base model on SQA.


## Intended uses & limitations


You can use this model for answering questions related to a table in a conversational set-up.


For code examples, we refer to the documentation of TAPAS on the HuggingFace website.


## Training procedure


### Preprocessing


The texts are lowercased and tokenized using WordPiece and a vocabulary size of 30,000. The inputs of the model are
then of the form:


```
[CLS] Question [SEP] Flattened table [SEP]
```


### Fine-tuning


The model was fine-tuned on 32 Cloud TPU v3 cores for 200,000 steps with maximum sequence length 512 and batch size of 128.
In this setup, fine-tuning takes around 20 hours. The optimizer used is Adam with a learning rate of 1.25e-5, and a warmup ratio
of 0.2. An inductive bias is added such that the model only selects cells of the same column. This is reflected by the
`select_one_column` parameter of `TapasConfig`. See also table 12 of the [original paper](https://arxiv.org/abs/2004.02349).


### BibTeX entry and citation info


```bibtex
@misc{herzig2020tapas,
      title={TAPAS: Weakly Supervised Table Parsing via Pre-training},
      author={Jonathan Herzig and Paweł Krzysztof Nowak and Thomas Müller and Francesco Piccinno and Julian Martin Eisenschlos},
      year={2020},
      eprint={2004.02349},
      archivePrefix={arXiv},
      primaryClass={cs.IR}
}
```


```bibtex
@misc{eisenschlos2020understanding,
      title={Understanding tables with intermediate pre-training},
      author={Julian Martin Eisenschlos and Syrine Krichene and Thomas Müller},
      year={2020},
      eprint={2010.00571},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}
```


```bibtex
@InProceedings{iyyer2017search-based,
author = {Iyyer, Mohit and Yih, Scott Wen-tau and Chang, Ming-Wei},
title = {Search-based Neural Structured Learning for Sequential Question Answering},
booktitle = {Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics},
year = {2017},
month = {July},
abstract = {Recent work in semantic parsing for question answering has focused on long and complicated questions, many of which would seem unnatural if asked in a normal conversation between two humans. In an effort to explore a conversational QA setting, we present a more realistic task: answering sequences of simple but inter-related questions. We collect a dataset of 6,066 question sequences that inquire about semi-structured tables from Wikipedia, with 17,553 question-answer pairs in total. To solve this sequential question answering task, we propose a novel dynamic neural semantic parsing framework trained using a weakly supervised reward-guided search. Our model effectively leverages the sequential context to outperform state-of-the-art QA systems that are designed to answer highly complex questions.},
publisher = {Association for Computational Linguistics},
url = {https://www.microsoft.com/en-us/research/publication/search-based-neural-structured-learning-sequential-question-answering/},
}
```


model name: tapas-small-finetuned-sqa


model author: google


task: table-question-answering


tags: pytorch, tf, tapas, table-question-answering, en, dataset:msr_sqa, arxiv:2004.02349, arxiv:2010.00571, transformers, license:apache-2.0


language: en
tags:


- multiberts
- multiberts-seed_0
- multiberts-seed_0-step_400k
license: apache-2.0


# MultiBERTs, Intermediate Checkpoint - Seed 0, Step 400k


MultiBERTs is a collection of checkpoints and a statistical library to support
robust research on BERT. We provide 25 BERT-base models trained with
similar hyper-parameters as
[the original BERT model](https://github.com/google-research/bert) but
with different random seeds, which causes variations in the initial weights and order of
training instances. The aim is to distinguish findings that apply to a specific
artifact (i.e., a particular instance of the model) from those that apply to the
more general procedure.


We also provide 140 intermediate checkpoints captured
during the course of pre-training (we saved 28 checkpoints for the first 5 runs).


The models were originally released through
[http://goo.gle/multiberts](http://goo.gle/multiberts). We describe them in our
paper
[The MultiBERTs: BERT Reproductions for Robustness Analysis](https://arxiv.org/abs/2106.16163).


This is model #0, captured at step 400k (max: 2000k, i.e., 2M steps).


## Model Description


This model was captured during a reproduction of
[BERT-base uncased](https://github.com/google-research/bert), for English: it
is a Transformers model pretrained on a large corpus of English data, using the
Masked Language Modelling (MLM) and the Next Sentence Prediction (NSP)
objectives.


The intended uses, limitations, training data and training procedure for the fully trained model are similar
to [BERT-base uncased](https://github.com/google-research/bert). Two major
differences with the original model:


* We pre-trained the MultiBERTs models for 2 million steps using sequence
length 512 (instead of 1 million steps using sequence length 128 then 512).
* We used an alternative version of Wikipedia and Books Corpus, initially
collected for [Turc et al., 2019](https://arxiv.org/abs/1908.08962).


This is a best-effort reproduction, and so it is probable that differences with
the original model have gone unnoticed. The performance of MultiBERTs on GLUE after full training is oftentimes comparable to that of original
BERT, but we found significant differences on the dev set of SQuAD (MultiBERTs outperforms original BERT).
See our [technical report](https://arxiv.org/abs/2106.16163) for more details.


### How to use


Using code from
[BERT-base uncased](https://huggingface.co/bert-base-uncased), here is an example based on
Tensorflow:


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_0-step_400k')
model = TFBertModel.from_pretrained("google/multiberts-seed_0-step_400k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


PyTorch version:


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_0-step_400k')
model = BertModel.from_pretrained("google/multiberts-seed_0-step_400k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


## Citation info


```bibtex
@article{sellam2021multiberts,
  title={The MultiBERTs: BERT Reproductions for Robustness Analysis},
  author={Thibault Sellam and Steve Yadlowsky and Jason Wei and Naomi Saphra and Alexander D'Amour and Tal Linzen and Jasmijn Bastings and Iulia Turc and Jacob Eisenstein and Dipanjan Das and Ian Tenney and Ellie Pavlick},
  journal={arXiv preprint arXiv:2106.16163},
  year={2021}
}
```


model name: multiberts-seed_0-step_400k


model author: google


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_0, multiberts-seed_0-step_400k, license:apache-2.0, infinity_compatible


language: en
datasets:


- c4
- wikipedia
- natural_questions


pipeline_tag: text2text-generation


## license: apache-2.0


[Google's T5](https://ai.googleblog.com/2020/02/exploring-transfer-learning-with-t5.html) for **Closed Book Question Answering**.


The model was pre-trained using T5's denoising objective on [C4](https://huggingface.co/datasets/c4), subsequently additionally pre-trained using [REALM](https://arxiv.org/pdf/2002.08909.pdf)'s salient span masking objective on [Wikipedia](https://huggingface.co/datasets/wikipedia), and finally fine-tuned on [Natural Questions (NQ)](https://huggingface.co/datasets/natural_questions).


**Note**: The model was fine-tuned on 100% of the train splits of [Natural Questions (NQ)](https://huggingface.co/datasets/natural_questions) for 10k steps.


Other community Checkpoints: [here](https://huggingface.co/models?search=ssm)


Paper: [How Much Knowledge Can You Pack
Into the Parameters of a Language Model?](https://arxiv.org/abs/1910.10683.pdf)


Authors: *Adam Roberts, Colin Raffel, Noam Shazeer*


## Results on Natural Questions - Test Set


|Id | link | Exact Match  |
|---|---|---|
|T5-small|https://huggingface.co/google/t5-small-ssm-nq|25.5|
|**T5-large**|**https://huggingface.co/google/t5-large-ssm-nq**|**30.4**|
|T5-xl|https://huggingface.co/google/t5-xl-ssm-nq|35.6|
|T5-xxl|https://huggingface.co/google/t5-xxl-ssm-nq|37.9|
|T5-3b|https://huggingface.co/google/t5-3b-ssm-nq|33.2|
|T5-11b|https://huggingface.co/google/t5-11b-ssm-nq|36.6|


## Usage


The model can be used as follows for **closed book question answering**:


```python
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

t5_qa_model = AutoModelForSeq2SeqLM.from_pretrained("google/t5-large-ssm-nq")
t5_tok = AutoTokenizer.from_pretrained("google/t5-large-ssm-nq")

input_ids = t5_tok("When was Franklin D. Roosevelt born?", return_tensors="pt").input_ids
gen_output = t5_qa_model.generate(input_ids)[0]

print(t5_tok.decode(gen_output, skip_special_tokens=True))

# should give "December 26, 1892" => close, but not correct.
```


## Abstract


It has recently been observed that neural language models trained on unstructured text can implicitly store and retrieve knowledge using natural language queries. In this short paper, we measure the practical utility of this approach by fine-tuning pre-trained models to answer questions without access to any external context or knowledge. We show that this approach scales with model size and performs competitively with open-domain systems that explicitly retrieve answers from an external knowledge source when answering questions. To facilitate reproducibility and future work, we release our code and trained models at https://goo.gle/t5-cbqa.


![model image](https://raw.githubusercontent.com/patrickvonplaten/scientific_images/master/how_much_know_ledge_image.png)


model name: t5-large-ssm-nq


model author: google


task: text2text-generation


tags: pytorch, tf, jax, t5, text2text-generation, en, dataset:c4, dataset:wikipedia, dataset:natural_questions, arxiv:2002.08909, arxiv:1910.10683, transformers, license:apache-2.0, autonlp_compatible


language: en
tags:


- multiberts
- multiberts-seed_4
- multiberts-seed_4-step_1900k
license: apache-2.0


# MultiBERTs, Intermediate Checkpoint - Seed 4, Step 1900k


MultiBERTs is a collection of checkpoints and a statistical library to support
robust research on BERT. We provide 25 BERT-base models trained with
similar hyper-parameters as
[the original BERT model](https://github.com/google-research/bert) but
with different random seeds, which causes variations in the initial weights and order of
training instances. The aim is to distinguish findings that apply to a specific
artifact (i.e., a particular instance of the model) from those that apply to the
more general procedure.


We also provide 140 intermediate checkpoints captured
during the course of pre-training (we saved 28 checkpoints for the first 5 runs).


The models were originally released through
[http://goo.gle/multiberts](http://goo.gle/multiberts). We describe them in our
paper
[The MultiBERTs: BERT Reproductions for Robustness Analysis](https://arxiv.org/abs/2106.16163).


This is model #4, captured at step 1900k (max: 2000k, i.e., 2M steps).


## Model Description


This model was captured during a reproduction of
[BERT-base uncased](https://github.com/google-research/bert), for English: it
is a Transformers model pretrained on a large corpus of English data, using the
Masked Language Modelling (MLM) and the Next Sentence Prediction (NSP)
objectives.


The intended uses, limitations, training data and training procedure for the fully trained model are similar
to [BERT-base uncased](https://github.com/google-research/bert). Two major
differences with the original model:


* We pre-trained the MultiBERTs models for 2 million steps using sequence
length 512 (instead of 1 million steps using sequence length 128 then 512).
* We used an alternative version of Wikipedia and Books Corpus, initially
collected for [Turc et al., 2019](https://arxiv.org/abs/1908.08962).


This is a best-effort reproduction, and so it is probable that differences with
the original model have gone unnoticed. The performance of MultiBERTs on GLUE after full training is oftentimes comparable to that of original
BERT, but we found significant differences on the dev set of SQuAD (MultiBERTs outperforms original BERT).
See our [technical report](https://arxiv.org/abs/2106.16163) for more details.


### How to use


Using code from
[BERT-base uncased](https://huggingface.co/bert-base-uncased), here is an example based on
Tensorflow:


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_4-step_1900k')
model = TFBertModel.from_pretrained("google/multiberts-seed_4-step_1900k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


PyTorch version:


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_4-step_1900k')
model = BertModel.from_pretrained("google/multiberts-seed_4-step_1900k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


## Citation info


```bibtex
@article{sellam2021multiberts,
  title={The MultiBERTs: BERT Reproductions for Robustness Analysis},
  author={Thibault Sellam and Steve Yadlowsky and Jason Wei and Naomi Saphra and Alexander D'Amour and Tal Linzen and Jasmijn Bastings and Iulia Turc and Jacob Eisenstein and Dipanjan Das and Ian Tenney and Ellie Pavlick},
  journal={arXiv preprint arXiv:2106.16163},
  year={2021}
}
```


model name: multiberts-seed_4-step_1900k


model author: google


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_4, multiberts-seed_4-step_1900k, license:apache-2.0, infinity_compatible


language: en
tags:


- multiberts
- multiberts-seed_2
- multiberts-seed_2-step_0k
license: apache-2.0


# MultiBERTs, Intermediate Checkpoint - Seed 2, Step 0k


This is model #2, captured at step 0k (max: 2000k, i.e., 2M steps).


## Model Description


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_2-step_0k')
model = TFBertModel.from_pretrained("google/multiberts-seed_2-step_0k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_2-step_0k')
model = BertModel.from_pretrained("google/multiberts-seed_2-step_0k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


model name: multiberts-seed_2-step_0k


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_2, multiberts-seed_2-step_0k, license:apache-2.0, infinity_compatible


- multiberts
- multiberts-seed_1
license: apache-2.0


# MultiBERTs - Seed 1


MultiBERTs is a collection of checkpoints and a statistical library to support
robust research on BERT. We provide 25 BERT-base models trained with
similar hyper-parameters as
[the original BERT model](https://github.com/google-research/bert) but
with different random seeds, which causes variations in the initial weights and order of
training instances. The aim is to distinguish findings that apply to a specific
artifact (i.e., a particular instance of the model) from those that apply to the
more general procedure.


We also provide 140 intermediate checkpoints captured
during the course of pre-training (we saved 28 checkpoints for the first 5 runs).


The models were originally released through
[http://goo.gle/multiberts](http://goo.gle/multiberts). We describe them in our
paper
[The MultiBERTs: BERT Reproductions for Robustness Analysis](https://arxiv.org/abs/2106.16163).


This is model #1.


This model is a reproduction of
[BERT-base uncased](https://github.com/google-research/bert), for English: it
is a Transformers model pretrained on a large corpus of English data, using the
Masked Language Modelling (MLM) and the Next Sentence Prediction (NSP)
objectives.


The intended uses, limitations, training data and training procedure are similar
to [BERT-base uncased](https://github.com/google-research/bert). Two major
differences with the original model:


* We pre-trained the MultiBERTs models for 2 million steps using sequence
length 512 (instead of 1 million steps using sequence length 128 then 512).
* We used an alternative version of Wikipedia and Books Corpus, initially
collected for [Turc et al., 2019](https://arxiv.org/abs/1908.08962).


This is a best-effort reproduction, and so it is probable that differences with
the original model have gone unnoticed. The performance of MultiBERTs on GLUE is oftentimes comparable to that of original
BERT, but we found significant differences on the dev set of SQuAD (MultiBERTs outperforms original BERT).
See our [technical report](https://arxiv.org/abs/2106.16163) for more details.


### How to use


Using code from
[BERT-base uncased](https://huggingface.co/bert-base-uncased), here is an example based on
Tensorflow:


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_1')
model = TFBertModel.from_pretrained("google/multiberts-seed_1")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


PyTorch version:


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_1')
model = BertModel.from_pretrained("google/multiberts-seed_1")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


## Citation info


```bibtex
@article{sellam2021multiberts,
  title={The MultiBERTs: BERT Reproductions for Robustness Analysis},
  author={Thibault Sellam and Steve Yadlowsky and Jason Wei and Naomi Saphra and Alexander D'Amour and Tal Linzen and Jasmijn Bastings and Iulia Turc and Jacob Eisenstein and Dipanjan Das and Ian Tenney and Ellie Pavlick},
  journal={arXiv preprint arXiv:2106.16163},
  year={2021}
}
```


model name: multiberts-seed_1


model author: google


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_1, license:apache-2.0, infinity_compatible


language: en
tags:


- multiberts
- multiberts-seed_18
license: apache-2.0


# MultiBERTs - Seed 18


This is model #18.


## Model Description


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_18')
model = TFBertModel.from_pretrained("google/multiberts-seed_18")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_18')
model = BertModel.from_pretrained("google/multiberts-seed_18")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


model name: multiberts-seed_18


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_18, license:apache-2.0, infinity_compatible


This model corresponds to **tapas_masklm_small_reset** of the [original repository](https://github.com/google-research/tapas).


Here's how you can use it:


```python
from transformers import TapasTokenizer, TapasForMaskedLM
import pandas as pd
import torch

tokenizer = TapasTokenizer.from_pretrained("google/tapas-small-masklm")
model = TapasForMaskedLM.from_pretrained("google/tapas-small-masklm")

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)
query = "How many movies has Leonardo [MASK] Caprio played in?"

# prepare inputs
inputs = tokenizer(table=table, queries=query, padding="max_length", return_tensors="pt")

# forward pass
outputs = model(**inputs)

# return top 5 values and predictions
masked_index = torch.nonzero(inputs.input_ids.squeeze() == tokenizer.mask_token_id, as_tuple=False)
logits = outputs.logits[0, masked_index.item(), :]
probs = logits.softmax(dim=0)
values, predictions = probs.topk(5)

for value, pred in zip(values, predictions):
  print(f"{tokenizer.decode([pred])} with confidence {value}")
```


model name: tapas-small-masklm


task: fill-mask


tags: pytorch, tf, tapas, fill-mask, transformers, autonlp_compatible


license: apache-2.0
tags:


- vision
- image-classification
datasets:
- imagenet
- imagenet-21k
widget:
- src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/tiger.jpg
example_title: Tiger
- src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/teapot.jpg
example_title: Teapot
- src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/palace.jpg
example_title: Palace


# Vision Transformer (base-sized model)


Vision Transformer (ViT) model pre-trained on ImageNet-21k (14 million images, 21,843 classes) at resolution 224x224, and fine-tuned on ImageNet 2012 (1 million images, 1,000 classes) at resolution 224x224. It was introduced in the paper [An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale](https://arxiv.org/abs/2010.11929) by Dosovitskiy et al. and first released in [this repository](https://github.com/google-research/vision_transformer). However, the weights were converted from the [timm repository](https://github.com/rwightman/pytorch-image-models) by Ross Wightman, who already converted the weights from JAX to PyTorch. Credits go to him.


Disclaimer: The team releasing ViT did not write a model card for this model so this model card has been written by the Hugging Face team.


## Model description


The Vision Transformer (ViT) is a transformer encoder model (BERT-like) pretrained on a large collection of images in a supervised fashion, namely ImageNet-21k, at a resolution of 224x224 pixels. Next, the model was fine-tuned on ImageNet (also referred to as ILSVRC2012), a dataset comprising 1 million images and 1,000 classes, also at resolution 224x224.


Images are presented to the model as a sequence of fixed-size patches (resolution 16x16), which are linearly embedded. One also adds a [CLS] token to the beginning of a sequence to use it for classification tasks. One also adds absolute position embeddings before feeding the sequence to the layers of the Transformer encoder.


By pre-training the model, it learns an inner representation of images that can then be used to extract features useful for downstream tasks: if you have a dataset of labeled images for instance, you can train a standard classifier by placing a linear layer on top of the pre-trained encoder. One typically places a linear layer on top of the [CLS] token, as the last hidden state of this token can be seen as a representation of an entire image.


## Intended uses & limitations


You can use the raw model for image classification. See the [model hub](https://huggingface.co/models?search=google/vit) to look for
fine-tuned versions on a task that interests you.


### How to use


Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:


```python
from transformers import ViTFeatureExtractor, ViTForImageClassification
from PIL import Image
import requests

url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
image = Image.open(requests.get(url, stream=True).raw)

feature_extractor = ViTFeatureExtractor.from_pretrained('google/vit-base-patch16-224')
model = ViTForImageClassification.from_pretrained('google/vit-base-patch16-224')

inputs = feature_extractor(images=image, return_tensors="pt")
outputs = model(**inputs)
logits = outputs.logits
# model predicts one of the 1000 ImageNet classes
predicted_class_idx = logits.argmax(-1).item()
print("Predicted class:", model.config.id2label[predicted_class_idx])
```


For more code examples, we refer to the [documentation](https://huggingface.co/transformers/model_doc/vit.html#).


## Training data


The ViT model was pretrained on [ImageNet-21k](http://www.image-net.org/), a dataset consisting of 14 million images and 21k classes, and fine-tuned on [ImageNet](http://www.image-net.org/challenges/LSVRC/2012/), a dataset consisting of 1 million images and 1k classes.


## Training procedure


### Preprocessing


The exact details of preprocessing of images during training/validation can be found [here](https://github.com/google-research/vision_transformer/blob/master/vit_jax/input_pipeline.py).


Images are resized/rescaled to the same resolution (224x224) and normalized across the RGB channels with mean (0.5, 0.5, 0.5) and standard deviation (0.5, 0.5, 0.5).


### Pretraining


The model was trained on TPUv3 hardware (8 cores). All model variants are trained with a batch size of 4096 and learning rate warmup of 10k steps. For ImageNet, the authors found it beneficial to additionally apply gradient clipping at global norm 1. Training resolution is 224.


## Evaluation results


For evaluation results on several image classification benchmarks, we refer to tables 2 and 5 of the original paper. Note that for fine-tuning, the best results are obtained with a higher resolution (384x384). Of course, increasing the model size will result in better performance.


### BibTeX entry and citation info


```bibtex
@misc{wu2020visual,
      title={Visual Transformers: Token-based Image Representation and Processing for Computer Vision},
      author={Bichen Wu and Chenfeng Xu and Xiaoliang Dai and Alvin Wan and Peizhao Zhang and Zhicheng Yan and Masayoshi Tomizuka and Joseph Gonzalez and Kurt Keutzer and Peter Vajda},
      year={2020},
      eprint={2006.03677},
      archivePrefix={arXiv},
      primaryClass={cs.CV}
}
```


```bibtex
@inproceedings{deng2009imagenet,
  title={Imagenet: A large-scale hierarchical image database},
  author={Deng, Jia and Dong, Wei and Socher, Richard and Li, Li-Jia and Li, Kai and Fei-Fei, Li},
  booktitle={2009 IEEE conference on computer vision and pattern recognition},
  pages={248--255},
  year={2009},
  organization={Ieee}
}
```


model name: vit-base-patch16-224


model author: google


task: image-classification


tags: pytorch, tf, jax, vit, image-classification, dataset:imagenet, dataset:imagenet-21k, arxiv:2010.11929, arxiv:2006.03677, transformers, license:apache-2.0, vision


language: en
tags:


- multiberts
- multiberts-seed_0
- multiberts-seed_0-step_1700k
license: apache-2.0


# MultiBERTs, Intermediate Checkpoint - Seed 0, Step 1700k


MultiBERTs is a collection of checkpoints and a statistical library to support
robust research on BERT. We provide 25 BERT-base models trained with
similar hyper-parameters as
[the original BERT model](https://github.com/google-research/bert) but
with different random seeds, which causes variations in the initial weights and order of
training instances. The aim is to distinguish findings that apply to a specific
artifact (i.e., a particular instance of the model) from those that apply to the
more general procedure.


We also provide 140 intermediate checkpoints captured
during the course of pre-training (we saved 28 checkpoints for the first 5 runs).


The models were originally released through
[http://goo.gle/multiberts](http://goo.gle/multiberts). We describe them in our
paper
[The MultiBERTs: BERT Reproductions for Robustness Analysis](https://arxiv.org/abs/2106.16163).


This is model #0, captured at step 1700k (max: 2000k, i.e., 2M steps).


## Model Description


This model was captured during a reproduction of
[BERT-base uncased](https://github.com/google-research/bert), for English: it
is a Transformers model pretrained on a large corpus of English data, using the
Masked Language Modelling (MLM) and the Next Sentence Prediction (NSP)
objectives.


The intended uses, limitations, training data and training procedure for the fully trained model are similar
to [BERT-base uncased](https://github.com/google-research/bert). Two major
differences with the original model:


* We pre-trained the MultiBERTs models for 2 million steps using sequence
length 512 (instead of 1 million steps using sequence length 128 then 512).
* We used an alternative version of Wikipedia and Books Corpus, initially
collected for [Turc et al., 2019](https://arxiv.org/abs/1908.08962).


This is a best-effort reproduction, and so it is probable that differences with
the original model have gone unnoticed. The performance of MultiBERTs on GLUE after full training is oftentimes comparable to that of original
BERT, but we found significant differences on the dev set of SQuAD (MultiBERTs outperforms original BERT).
See our [technical report](https://arxiv.org/abs/2106.16163) for more details.


### How to use


Using code from
[BERT-base uncased](https://huggingface.co/bert-base-uncased), here is an example based on
Tensorflow:


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_0-step_1700k')
model = TFBertModel.from_pretrained("google/multiberts-seed_0-step_1700k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


PyTorch version:


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_0-step_1700k')
model = BertModel.from_pretrained("google/multiberts-seed_0-step_1700k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


## Citation info


```bibtex
@article{sellam2021multiberts,
  title={The MultiBERTs: BERT Reproductions for Robustness Analysis},
  author={Thibault Sellam and Steve Yadlowsky and Jason Wei and Naomi Saphra and Alexander D'Amour and Tal Linzen and Jasmijn Bastings and Iulia Turc and Jacob Eisenstein and Dipanjan Das and Ian Tenney and Ellie Pavlick},
  journal={arXiv preprint arXiv:2106.16163},
  year={2021}
}
```


model name: multiberts-seed_0-step_1700k


model author: google


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_0, multiberts-seed_0-step_1700k, license:apache-2.0, infinity_compatible


language: en
tags:


- multiberts
- multiberts-seed_4
- multiberts-seed_4-step_300k
license: apache-2.0


# MultiBERTs, Intermediate Checkpoint - Seed 4, Step 300k


This is model #4, captured at step 300k (max: 2000k, i.e., 2M steps).


## Model Description


```
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_4-step_300k')
model = TFBertModel.from_pretrained("google/multiberts-seed_4-step_300k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```


```
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('google/multiberts-seed_4-step_300k')
model = BertModel.from_pretrained("google/multiberts-seed_4-step_300k")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```


model name: multiberts-seed_4-step_300k


tags: pytorch, tf, bert, pretraining, en, arxiv:2106.16163, arxiv:1908.08962, transformers, multiberts, multiberts-seed_4, multiberts-seed_4-step_300k, license:apache-2.0, infinity_compatible


tags:


- conversational


#Harry Potter DialoGPT Model


model name: DialoGPT-small-harrypotter


model author: augustojaba


task: conversational


tags: pytorch, gpt2, text-generation, transformers, conversational


license: apache-2.0
datasets:


- billsum
tags:
- summarization
- t5
widget:
- text: "The people of the State of California do enact as
follows: SECTION 1. The Legislature hereby finds
and declares as follows: (a) Many areas of the
state are disproportionately impacted by drought
because they are heavily dependent or completely
reliant on groundwater from basins that are in
overdraft and in which the water table declines
year after year or from basins that are
contaminated. (b) There are a number of state
grant and loan programs that provide financial
assistance to communities to address drinking
water and wastewater needs. Unfortunately, there
is no program in place to provide similar
assistance to individual homeowners who are
reliant on their own groundwater wells and who may
not be able to afford conventional private loans
to undertake vital water supply, water quality,
and wastewater improvements. (c) The program
created by this act is intended to bridge that gap
by providing low-interest loans, grants, or both,
to individual homeowners to undertake actions
necessary to provide safer, cleaner, and more
reliable drinking water and wastewater treatment.
These actions may include, but are not limited to,
digging deeper wells, improving existing wells and
related equipment, addressing drinking water
contaminants in the homeowner’s water, or
connecting to a local water or wastewater system. SEC. 2. Chapter 6.6 (commencing with Section


13486. is added to Division 7 of the Water Code,
to read: CHAPTER  6.6. Water and Wastewater Loan
and Grant Program 13486. (a) The board shall
establish a program in accordance with this
chapter to provide low-interest loans and grants
to local agencies for low-interest loans and
grants to eligible applicants for any of the
following purposes:"
example_title: "Water use"


- text: "The people of the State of California do enact as
follows:   SECTION 1. Section 2196 of the
Elections Code is amended to read: 2196. (a) (1)
Notwithstanding any other provision of law, a
person who is qualified to register to vote and
who has a valid California driver’s license or
state identification card may submit an affidavit
of voter registration electronically on the
Internet Web site of the Secretary of State. (2)
An affidavit submitted pursuant to this section is
effective upon receipt of the affidavit by the
Secretary of State if the affidavit is received on
or before the last day to register for an election
to be held in the precinct of the person
submitting the affidavit. (3) The affiant shall
affirmatively attest to the truth of the
information provided in the affidavit. (4) For
voter registration purposes, the applicant shall
affirmatively assent to the use of his or her
signature from his or her driver’s license or
state identification card. (5) For each electronic
affidavit, the Secretary of State shall obtain an
electronic copy of the applicant’s signature from
his or her driver’s license or state
identification card directly from the Department
of Motor Vehicles. (6) The Secretary of State
shall require a person who submits an affidavit
pursuant to this section to submit all of the
following: (A) The number from his or her
California driver’s license or state
identification card. (B) His or her date of birth.
(C) The last four digits of his or her social
security number. (D) Any other information the
Secretary of State deems necessary to establish
the identity of the affiant. (7) Upon submission
of an affidavit pursuant to this section, the
electronic voter registration system shall provide
for immediate verification of both of the
following:"
example_title: "Election"
metrics:
- rouge
model-index:
- name: t5-small-finetuned-billsum-ca_test
results:
  - task:
name: Sequence-to-sequence Language Modeling
type: text2text-generation
dataset:
name: billsum
type: billsum
args: default
metrics:
    - name: Rouge1
type: rouge
value: 12.6315


<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->


# t5-small-finetuned-billsum-ca_test


This model is a fine-tuned version of [t5-small](https://huggingface.co/t5-small) on the billsum dataset.
It achieves the following results on the evaluation set:


- Loss: 2.3376
- Rouge1: 12.6315
- Rouge2: 6.9839
- Rougel: 10.9983
- Rougelsum: 11.9383
- Gen Len: 19.0


## Model description


More information needed


## Intended uses & limitations


## Training and evaluation data


## Training procedure


### Training hyperparameters


The following hyperparameters were used during training:


- learning_rate: 2e-05
- train_batch_size: 2
- eval_batch_size: 2
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- num_epochs: 4
- mixed_precision_training: Native AMP


### Training results


| Training Loss | Epoch | Step | Validation Loss | Rouge1  | Rouge2 | Rougel  | Rougelsum | Gen Len |
|:-------------:|:-----:|:----:|:---------------:|:-------:|:------:|:-------:|:---------:|:-------:|
| No log        | 1.0   | 495  | 2.4805          | 9.9389  | 4.1239 | 8.3979  | 9.1599    | 19.0    |
| 3.1564        | 2.0   | 990  | 2.3833          | 12.1026 | 6.5196 | 10.5123 | 11.4527   | 19.0    |
| 2.66          | 3.0   | 1485 | 2.3496          | 12.5389 | 6.8686 | 10.8798 | 11.8636   | 19.0    |
| 2.5671        | 4.0   | 1980 | 2.3376          | 12.6315 | 6.9839 | 10.9983 | 11.9383   | 19.0    |


### Framework versions


- Transformers 4.12.2
- Pytorch 1.9.0+cu111
- Datasets 1.14.0
- Tokenizers 0.10.3


model name: t5-small-finetuned-billsum-ca_test


model author: stevhliu


task: summarization


tags: pytorch, tensorboard, t5, text2text-generation, dataset:billsum, transformers, license:apache-2.0, summarization, model-index, autonlp_compatible


language: "en"
thumbnail: "https://raw.githubusercontent.com/stevhliu/satsuma/master/images/astroGPT-thumbnail.png"
widget:


- text: "Jan 18, 2020"
- text: "Feb 14, 2020"
- text: "Jul 04, 2020"


# astroGPT 🪐


## Model description


This is a GPT-2 model fine-tuned on Western zodiac signs. For more information about GPT-2, take a look at 🤗 Hugging Face's GPT-2 [model card](https://huggingface.co/gpt2). You can use astroGPT to generate a daily horoscope by entering the current date.


## How to use


To use this model, simply enter the current date like so `Mon DD, YEAR`:


```python
from transformers import AutoTokenizer, AutoModelWithLMHead

tokenizer = AutoTokenizer.from_pretrained("stevhliu/astroGPT")
model = AutoModelWithLMHead.from_pretrained("stevhliu/astroGPT")

input_ids = tokenizer.encode('Sep 03, 2020', return_tensors='pt').to('cuda')

sample_output = model.generate(input_ids,
                               do_sample=True,
                               max_length=75,
                               top_k=20,
                               top_p=0.97)

print(sample_output)
```


## Limitations and bias


astroGPT inherits the same biases that affect GPT-2 as a result of training on a lot of non-neutral content on the internet. The model does not currently support zodiac sign-specific generation and only returns a general horoscope. While the generated text may occasionally mention a specific zodiac sign, this is  due to how the horoscopes were originally written by it's human authors.


## Data


The data was scraped from [Horoscope.com](https://www.horoscope.com/us/index.aspx) and trained on 4.7MB of text. The text was collected from four categories (daily, love, wellness, career) and span from 09/01/19 to 08/01/2020. The archives only store horoscopes dating a year back from the current date.


## Training and results


The text was tokenized using the fast GPT-2 BPE [tokenizer](https://huggingface.co/transformers/model_doc/gpt2.html#gpt2tokenizerfast). It has a vocabulary size of 50,257 and sequence length of 1024 tokens. The model was trained with on one of Google Colaboratory's GPU's for approximately 2.5 hrs with [fastai's](https://docs.fast.ai/) learning rate finder, discriminative learning rates and 1cycle policy. See table below for a quick summary of the training procedure and results.


| dataset size  | epochs | lr                | training time | train_loss | valid_loss | perplexity |
|:-------------:|:------:|:-----------------:|:-------------:|:----------:|:----------:|:----------:|
| 5.9MB         |32      | slice(1e-7,1e-5)  | 2.5 hrs       | 2.657170   | 2.642387   | 14.046692	|


model name: astroGPT


model author: stevhliu


task: text-generation


tags: pytorch, tf, jax, gpt2, text-generation, en, transformers


一个测试Paddle 服务器模型的项目


model name: paddle_detection


model author: atu


tags:


language: en
tags:


- bart
- seq2seq
- summarization
license: apache-2.0
datasets:
- samsum
widget:
- text: |
Hannah: Hey, do you have Betty's number?
Amanda: Lemme check
Amanda: Sorry, can't find it.
Amanda: Ask Larry
Amanda: He called her last time we were at the park together
Hannah: I don't know him well
Amanda: Don't be shy, he's very nice
Hannah: If you say so..
Hannah: I'd rather you texted him
Amanda: Just text him 🙂
Hannah: Urgh.. Alright
Hannah: Bye
Amanda: Bye bye
model-index:
- name: bart-large-xsum-samsum
results:
  - task:
name: Abstractive Text Summarization
type: abstractive-text-summarization
dataset:
name: "SAMSum Corpus: A Human-annotated Dialogue Dataset for Abstractive Summarization"
type: samsum
metrics:
    - name: Validation ROGUE-1
type: rogue-1
value: 54.3921
    - name: Validation ROGUE-2
type: rogue-2
value: 29.8078
    - name: Validation ROGUE-L
type: rogue-l
value: 45.1543
    - name: Test ROGUE-1
type: rogue-1
value: 53.3059
    - name: Test ROGUE-2
type: rogue-2
value: 28.355
    - name: Test ROGUE-L
type: rogue-l
value: 44.0953


## `bart-large-xsum-samsum`


This model was obtained by fine-tuning `facebook/bart-large-xsum` on [Samsum](https://huggingface.co/datasets/samsum) dataset.


## Usage


```python
from transformers import pipeline
summarizer = pipeline("summarization", model="knkarthick/bart-large-xsum-samsum")
conversation = '''Hannah: Hey, do you have Betty's number?
Amanda: Lemme check
Amanda: Sorry, can't find it.
Amanda: Ask Larry
Amanda: He called her last time we were at the park together
Hannah: I don't know him well
Amanda: Don't be shy, he's very nice
Hannah: If you say so..
Hannah: I'd rather you texted him
Amanda: Just text him 🙂
Hannah: Urgh.. Alright
Hannah: Bye
Amanda: Bye bye
'''
summarizer(conversation)
```


model name: meeting-summary-samsum


model author: knkarthick


task: summarization


tags: pytorch, bart, text2text-generation, en, dataset:samsum, transformers, seq2seq, summarization, license:apache-2.0, model-index, autonlp_compatible


model name: bart-large-xsum-samsum