modelId stringlengths 4 111 | lastModified stringlengths 24 24 | tags sequence | pipeline_tag stringlengths 5 30 ⌀ | author stringlengths 2 34 ⌀ | config null | securityStatus null | id stringlengths 4 111 | likes int64 0 9.53k | downloads int64 2 73.6M | library_name stringlengths 2 84 ⌀ | created timestamp[us] | card stringlengths 101 901k | card_len int64 101 901k | embeddings sequence |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jonatasgrosman/wav2vec2-large-xlsr-53-english | 2023-03-25T10:56:55.000Z | [
"transformers",
"pytorch",
"jax",
"safetensors",
"wav2vec2",
"automatic-speech-recognition",
"audio",
"en",
"hf-asr-leaderboard",
"mozilla-foundation/common_voice_6_0",
"robust-speech-event",
"speech",
"xlsr-fine-tuning-week",
"dataset:common_voice",
"dataset:mozilla-foundation/common_voice_6_0",
"license:apache-2.0",
"model-index",
"endpoints_compatible",
"has_space",
"region:us"
] | automatic-speech-recognition | jonatasgrosman | null | null | jonatasgrosman/wav2vec2-large-xlsr-53-english | 299 | 73,582,776 | transformers | 2022-03-02T23:29:05 | ---
language: en
datasets:
- common_voice
- mozilla-foundation/common_voice_6_0
metrics:
- wer
- cer
tags:
- audio
- automatic-speech-recognition
- en
- hf-asr-leaderboard
- mozilla-foundation/common_voice_6_0
- robust-speech-event
- speech
- xlsr-fine-tuning-week
license: apache-2.0
model-index:
- name: XLSR Wav2Vec2 English by Jonatas Grosman
results:
- task:
name: Automatic Speech Recognition
type: automatic-speech-recognition
dataset:
name: Common Voice en
type: common_voice
args: en
metrics:
- name: Test WER
type: wer
value: 19.06
- name: Test CER
type: cer
value: 7.69
- name: Test WER (+LM)
type: wer
value: 14.81
- name: Test CER (+LM)
type: cer
value: 6.84
- task:
name: Automatic Speech Recognition
type: automatic-speech-recognition
dataset:
name: Robust Speech Event - Dev Data
type: speech-recognition-community-v2/dev_data
args: en
metrics:
- name: Dev WER
type: wer
value: 27.72
- name: Dev CER
type: cer
value: 11.65
- name: Dev WER (+LM)
type: wer
value: 20.85
- name: Dev CER (+LM)
type: cer
value: 11.01
---
# Fine-tuned XLSR-53 large model for speech recognition in English
Fine-tuned [facebook/wav2vec2-large-xlsr-53](https://huggingface.co/facebook/wav2vec2-large-xlsr-53) on English using the train and validation splits of [Common Voice 6.1](https://huggingface.co/datasets/common_voice).
When using this model, make sure that your speech input is sampled at 16kHz.
This model has been fine-tuned thanks to the GPU credits generously given by the [OVHcloud](https://www.ovhcloud.com/en/public-cloud/ai-training/) :)
The script used for training can be found here: https://github.com/jonatasgrosman/wav2vec2-sprint
## Usage
The model can be used directly (without a language model) as follows...
Using the [HuggingSound](https://github.com/jonatasgrosman/huggingsound) library:
```python
from huggingsound import SpeechRecognitionModel
model = SpeechRecognitionModel("jonatasgrosman/wav2vec2-large-xlsr-53-english")
audio_paths = ["/path/to/file.mp3", "/path/to/another_file.wav"]
transcriptions = model.transcribe(audio_paths)
```
Writing your own inference script:
```python
import torch
import librosa
from datasets import load_dataset
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
LANG_ID = "en"
MODEL_ID = "jonatasgrosman/wav2vec2-large-xlsr-53-english"
SAMPLES = 10
test_dataset = load_dataset("common_voice", LANG_ID, split=f"test[:{SAMPLES}]")
processor = Wav2Vec2Processor.from_pretrained(MODEL_ID)
model = Wav2Vec2ForCTC.from_pretrained(MODEL_ID)
# Preprocessing the datasets.
# We need to read the audio files as arrays
def speech_file_to_array_fn(batch):
speech_array, sampling_rate = librosa.load(batch["path"], sr=16_000)
batch["speech"] = speech_array
batch["sentence"] = batch["sentence"].upper()
return batch
test_dataset = test_dataset.map(speech_file_to_array_fn)
inputs = processor(test_dataset["speech"], sampling_rate=16_000, return_tensors="pt", padding=True)
with torch.no_grad():
logits = model(inputs.input_values, attention_mask=inputs.attention_mask).logits
predicted_ids = torch.argmax(logits, dim=-1)
predicted_sentences = processor.batch_decode(predicted_ids)
for i, predicted_sentence in enumerate(predicted_sentences):
print("-" * 100)
print("Reference:", test_dataset[i]["sentence"])
print("Prediction:", predicted_sentence)
```
| Reference | Prediction |
| ------------- | ------------- |
| "SHE'LL BE ALL RIGHT." | SHE'LL BE ALL RIGHT |
| SIX | SIX |
| "ALL'S WELL THAT ENDS WELL." | ALL AS WELL THAT ENDS WELL |
| DO YOU MEAN IT? | DO YOU MEAN IT |
| THE NEW PATCH IS LESS INVASIVE THAN THE OLD ONE, BUT STILL CAUSES REGRESSIONS. | THE NEW PATCH IS LESS INVASIVE THAN THE OLD ONE BUT STILL CAUSES REGRESSION |
| HOW IS MOZILLA GOING TO HANDLE AMBIGUITIES LIKE QUEUE AND CUE? | HOW IS MOSLILLAR GOING TO HANDLE ANDBEWOOTH HIS LIKE Q AND Q |
| "I GUESS YOU MUST THINK I'M KINDA BATTY." | RUSTIAN WASTIN PAN ONTE BATTLY |
| NO ONE NEAR THE REMOTE MACHINE YOU COULD RING? | NO ONE NEAR THE REMOTE MACHINE YOU COULD RING |
| SAUCE FOR THE GOOSE IS SAUCE FOR THE GANDER. | SAUCE FOR THE GUICE IS SAUCE FOR THE GONDER |
| GROVES STARTED WRITING SONGS WHEN SHE WAS FOUR YEARS OLD. | GRAFS STARTED WRITING SONGS WHEN SHE WAS FOUR YEARS OLD |
## Evaluation
1. To evaluate on `mozilla-foundation/common_voice_6_0` with split `test`
```bash
python eval.py --model_id jonatasgrosman/wav2vec2-large-xlsr-53-english --dataset mozilla-foundation/common_voice_6_0 --config en --split test
```
2. To evaluate on `speech-recognition-community-v2/dev_data`
```bash
python eval.py --model_id jonatasgrosman/wav2vec2-large-xlsr-53-english --dataset speech-recognition-community-v2/dev_data --config en --split validation --chunk_length_s 5.0 --stride_length_s 1.0
```
## Citation
If you want to cite this model you can use this:
```bibtex
@misc{grosman2021xlsr53-large-english,
title={Fine-tuned {XLSR}-53 large model for speech recognition in {E}nglish},
author={Grosman, Jonatas},
howpublished={\url{https://huggingface.co/jonatasgrosman/wav2vec2-large-xlsr-53-english}},
year={2021}
}
``` | 5,327 | [
[
-0.0232391357421875,
-0.048248291015625,
0.011932373046875,
0.0168914794921875,
-0.0070037841796875,
-0.018402099609375,
-0.0272369384765625,
-0.052276611328125,
0.0106964111328125,
0.0249176025390625,
-0.05072021484375,
-0.0323486328125,
-0.031036376953125,
0.0012102127075195312,
-0.0285491943359375,
0.07763671875,
0.0163421630859375,
0.017425537109375,
-0.00754547119140625,
-0.006565093994140625,
-0.021759033203125,
-0.02606201171875,
-0.06048583984375,
-0.0256805419921875,
0.03424072265625,
0.02032470703125,
0.0196685791015625,
0.033050537109375,
0.02716064453125,
0.027069091796875,
-0.0276031494140625,
0.0025653839111328125,
-0.024139404296875,
-0.0016345977783203125,
0.007354736328125,
-0.031951904296875,
-0.0297088623046875,
0.01027679443359375,
0.05401611328125,
0.037872314453125,
-0.016357421875,
0.020294189453125,
-0.0013217926025390625,
0.0313720703125,
-0.0205230712890625,
0.0110015869140625,
-0.045928955078125,
-0.0134429931640625,
-0.00983428955078125,
0.00962066650390625,
-0.033050537109375,
-0.01473236083984375,
0.0159149169921875,
-0.037109375,
0.0140380859375,
-0.002685546875,
0.0712890625,
0.0142822265625,
-0.0118408203125,
-0.0248260498046875,
-0.04937744140625,
0.071533203125,
-0.06884765625,
0.03265380859375,
0.04058837890625,
0.015838623046875,
-0.011505126953125,
-0.0697021484375,
-0.046234130859375,
-0.021392822265625,
0.0101470947265625,
0.013641357421875,
-0.03662109375,
-0.003452301025390625,
0.0328369140625,
0.0155487060546875,
-0.05511474609375,
0.005191802978515625,
-0.0634765625,
-0.0360107421875,
0.051513671875,
-0.0095977783203125,
0.0123291015625,
-0.01413726806640625,
-0.01385498046875,
-0.03070068359375,
-0.0240478515625,
0.0270538330078125,
0.03411865234375,
0.03680419921875,
-0.038787841796875,
0.036895751953125,
-0.00533294677734375,
0.054168701171875,
0.0008001327514648438,
-0.032012939453125,
0.061248779296875,
-0.0191802978515625,
-0.020111083984375,
0.01041412353515625,
0.0784912109375,
0.01055145263671875,
0.026702880859375,
-0.0015735626220703125,
-0.01201629638671875,
0.0167236328125,
-0.0148162841796875,
-0.050445556640625,
-0.022491455078125,
0.035125732421875,
-0.0194091796875,
-0.01412200927734375,
-0.004093170166015625,
-0.0411376953125,
-0.004451751708984375,
-0.014373779296875,
0.0457763671875,
-0.045166015625,
-0.01233673095703125,
0.01708984375,
-0.0222320556640625,
0.00567626953125,
0.00006115436553955078,
-0.06524658203125,
0.017669677734375,
0.034912109375,
0.0631103515625,
0.01406097412109375,
-0.027923583984375,
-0.046417236328125,
-0.01551055908203125,
-0.00804901123046875,
0.0445556640625,
-0.0269927978515625,
-0.01468658447265625,
-0.01485443115234375,
0.0088653564453125,
-0.0169525146484375,
-0.03948974609375,
0.050689697265625,
-0.008148193359375,
0.0325927734375,
-0.00408172607421875,
-0.039520263671875,
-0.01055908203125,
-0.01161956787109375,
-0.048583984375,
0.08026123046875,
-0.0036144256591796875,
-0.058929443359375,
0.000850677490234375,
-0.04632568359375,
-0.040435791015625,
-0.022857666015625,
0.0009927749633789062,
-0.03338623046875,
-0.013153076171875,
0.016693115234375,
0.035980224609375,
-0.0218963623046875,
0.007442474365234375,
-0.0261993408203125,
-0.02069091796875,
0.0341796875,
-0.0275421142578125,
0.08648681640625,
0.021087646484375,
-0.027191162109375,
-0.00568389892578125,
-0.06988525390625,
0.0125274658203125,
0.003711700439453125,
-0.0289459228515625,
-0.0037593841552734375,
0.0013513565063476562,
0.0246429443359375,
0.006633758544921875,
0.01395416259765625,
-0.046478271484375,
0.00011360645294189453,
-0.04779052734375,
0.0615234375,
0.032806396484375,
-0.0120849609375,
0.0159149169921875,
-0.03546142578125,
0.0284881591796875,
-0.003993988037109375,
0.0016613006591796875,
-0.01019287109375,
-0.036102294921875,
-0.055267333984375,
-0.0250244140625,
0.033905029296875,
0.043304443359375,
-0.0241241455078125,
0.049957275390625,
-0.0090789794921875,
-0.06988525390625,
-0.060821533203125,
-0.00720977783203125,
0.032196044921875,
0.037017822265625,
0.045257568359375,
0.0005002021789550781,
-0.0709228515625,
-0.0615234375,
0.0009107589721679688,
-0.0190277099609375,
-0.0005807876586914062,
0.026336669921875,
0.041656494140625,
-0.0294189453125,
0.06011962890625,
-0.0325927734375,
-0.019989013671875,
-0.0235748291015625,
0.01218414306640625,
0.028900146484375,
0.052764892578125,
0.036468505859375,
-0.050994873046875,
-0.0210723876953125,
-0.0125885009765625,
-0.0276947021484375,
-0.01203155517578125,
-0.00384521484375,
0.000827789306640625,
0.01910400390625,
0.030303955078125,
-0.052093505859375,
0.01220703125,
0.0399169921875,
-0.0183563232421875,
0.043548583984375,
0.0029964447021484375,
-0.002162933349609375,
-0.0919189453125,
0.0068359375,
0.0131072998046875,
-0.013519287109375,
-0.045318603515625,
-0.0220184326171875,
-0.0102081298828125,
0.007518768310546875,
-0.03375244140625,
0.034393310546875,
-0.031829833984375,
-0.00817108154296875,
0.0010538101196289062,
0.0164642333984375,
-0.00279998779296875,
0.03173828125,
0.0007076263427734375,
0.053192138671875,
0.056427001953125,
-0.036834716796875,
0.043304443359375,
0.023895263671875,
-0.04217529296875,
0.00878143310546875,
-0.06829833984375,
0.0231170654296875,
0.0094757080078125,
0.01904296875,
-0.08154296875,
-0.01102447509765625,
0.014923095703125,
-0.06524658203125,
0.0175323486328125,
0.00186920166015625,
-0.0268402099609375,
-0.0401611328125,
-0.00927734375,
0.01399993896484375,
0.055511474609375,
-0.0283660888671875,
0.03704833984375,
0.041229248046875,
-0.0166473388671875,
-0.04913330078125,
-0.065185546875,
-0.017791748046875,
-0.0149688720703125,
-0.057373046875,
0.0176239013671875,
-0.01727294921875,
-0.01462554931640625,
-0.01503753662109375,
-0.006404876708984375,
-0.006916046142578125,
-0.006649017333984375,
0.0191802978515625,
0.0180816650390625,
-0.0204010009765625,
0.00046634674072265625,
-0.0059661865234375,
0.003772735595703125,
0.00707244873046875,
-0.012298583984375,
0.049468994140625,
-0.01363372802734375,
-0.00246429443359375,
-0.039337158203125,
0.0123291015625,
0.04632568359375,
-0.0259552001953125,
0.03070068359375,
0.06634521484375,
-0.03240966796875,
-0.0013265609741210938,
-0.04541015625,
-0.007633209228515625,
-0.033599853515625,
0.05072021484375,
-0.01416015625,
-0.053985595703125,
0.0460205078125,
0.0225677490234375,
0.0029582977294921875,
0.044219970703125,
0.037017822265625,
-0.01617431640625,
0.07275390625,
0.0275421142578125,
-0.018951416015625,
0.03802490234375,
-0.03826904296875,
-0.0044708251953125,
-0.06390380859375,
-0.025146484375,
-0.060150146484375,
-0.01419830322265625,
-0.0281524658203125,
-0.02923583984375,
0.0109405517578125,
0.0011224746704101562,
-0.0156097412109375,
0.0379638671875,
-0.040008544921875,
0.025054931640625,
0.044952392578125,
0.009429931640625,
-0.006420135498046875,
0.00997161865234375,
-0.0157318115234375,
0.001918792724609375,
-0.04266357421875,
-0.029083251953125,
0.07171630859375,
0.041748046875,
0.054962158203125,
-0.001953125,
0.045257568359375,
0.005207061767578125,
-0.0205535888671875,
-0.06243896484375,
0.0413818359375,
-0.01971435546875,
-0.047271728515625,
-0.033172607421875,
-0.02862548828125,
-0.06768798828125,
0.00757598876953125,
-0.0178985595703125,
-0.07843017578125,
0.010223388671875,
0.0064239501953125,
-0.037200927734375,
0.00627899169921875,
-0.060455322265625,
0.059295654296875,
-0.006160736083984375,
-0.01001739501953125,
-0.0123748779296875,
-0.053009033203125,
0.0172271728515625,
-0.0015649795532226562,
0.0134124755859375,
-0.006023406982421875,
0.0276031494140625,
0.09747314453125,
-0.0196075439453125,
0.061981201171875,
-0.01183319091796875,
0.00756072998046875,
0.0294036865234375,
-0.0284423828125,
0.033447265625,
-0.0148162841796875,
-0.0203399658203125,
0.01904296875,
0.02734375,
-0.006900787353515625,
-0.02728271484375,
0.047607421875,
-0.07666015625,
-0.026123046875,
-0.03704833984375,
-0.043731689453125,
-0.01377105712890625,
0.01212310791015625,
0.04852294921875,
0.054443359375,
-0.01410675048828125,
0.039398193359375,
0.040069580078125,
-0.01410675048828125,
0.033477783203125,
0.033721923828125,
-0.0111541748046875,
-0.05181884765625,
0.050689697265625,
0.02154541015625,
0.019683837890625,
0.019317626953125,
0.0231170654296875,
-0.03521728515625,
-0.035247802734375,
-0.01505279541015625,
0.0269927978515625,
-0.046234130859375,
-0.011932373046875,
-0.05364990234375,
-0.0272369384765625,
-0.062286376953125,
0.0144500732421875,
-0.01983642578125,
-0.0302886962890625,
-0.043426513671875,
-0.004970550537109375,
0.043243408203125,
0.041290283203125,
-0.017425537109375,
0.0230560302734375,
-0.04962158203125,
0.0240325927734375,
0.00722503662109375,
-0.0003571510314941406,
-0.0038738250732421875,
-0.073486328125,
-0.032928466796875,
0.0221710205078125,
-0.0133514404296875,
-0.0653076171875,
0.03448486328125,
0.0194854736328125,
0.04290771484375,
0.0244140625,
0.0013580322265625,
0.0611572265625,
-0.0374755859375,
0.06207275390625,
0.0239715576171875,
-0.0794677734375,
0.05364990234375,
-0.0189056396484375,
0.0197601318359375,
0.025177001953125,
0.0213470458984375,
-0.04681396484375,
-0.0292510986328125,
-0.052093505859375,
-0.06353759765625,
0.0693359375,
0.0156097412109375,
0.0090484619140625,
0.004901885986328125,
0.0158843994140625,
-0.00836181640625,
0.0018253326416015625,
-0.06536865234375,
-0.0389404296875,
-0.0166015625,
-0.0235748291015625,
-0.0234222412109375,
-0.0178985595703125,
-0.00569915771484375,
-0.042388916015625,
0.07537841796875,
0.0109100341796875,
0.03253173828125,
0.02215576171875,
0.00321197509765625,
-0.0037593841552734375,
0.0231781005859375,
0.052215576171875,
0.0234832763671875,
-0.0277099609375,
-0.0021839141845703125,
0.016876220703125,
-0.054595947265625,
0.00923919677734375,
0.022308349609375,
-0.0026454925537109375,
0.00846099853515625,
0.045013427734375,
0.08831787109375,
0.01119232177734375,
-0.043609619140625,
0.0276641845703125,
0.00170135498046875,
-0.02728271484375,
-0.051300048828125,
0.0180511474609375,
0.02386474609375,
0.0269927978515625,
0.0301666259765625,
0.01032257080078125,
-0.0001742839813232422,
-0.038360595703125,
0.01354217529296875,
0.0225372314453125,
-0.028228759765625,
-0.0211639404296875,
0.04376220703125,
0.007904052734375,
-0.029571533203125,
0.039398193359375,
-0.001068115234375,
-0.032989501953125,
0.059417724609375,
0.05474853515625,
0.0640869140625,
-0.02459716796875,
0.00023102760314941406,
0.04547119140625,
0.029144287109375,
-0.01861572265625,
0.03558349609375,
0.007137298583984375,
-0.05938720703125,
-0.017822265625,
-0.045501708984375,
-0.01433563232421875,
0.0357666015625,
-0.06427001953125,
0.0283660888671875,
-0.0221710205078125,
-0.01959228515625,
0.030303955078125,
0.0089874267578125,
-0.0418701171875,
0.0247650146484375,
0.016693115234375,
0.08837890625,
-0.07305908203125,
0.07745361328125,
0.0411376953125,
-0.036041259765625,
-0.091552734375,
-0.0047607421875,
-0.01177978515625,
-0.048492431640625,
0.03485107421875,
0.0183563232421875,
-0.007518768310546875,
0.004299163818359375,
-0.048858642578125,
-0.07330322265625,
0.09014892578125,
0.032470703125,
-0.06781005859375,
0.0009822845458984375,
-0.0098114013671875,
0.037689208984375,
-0.0258026123046875,
0.03070068359375,
0.0517578125,
0.035003662109375,
0.0109100341796875,
-0.0797119140625,
-0.0129241943359375,
-0.0301055908203125,
-0.018310546875,
-0.01503753662109375,
-0.042694091796875,
0.0810546875,
-0.029876708984375,
-0.0035247802734375,
0.024200439453125,
0.05926513671875,
0.0269927978515625,
0.0211029052734375,
0.048248291015625,
0.043792724609375,
0.07965087890625,
-0.009368896484375,
0.05828857421875,
-0.0099639892578125,
0.035980224609375,
0.0877685546875,
-0.0155487060546875,
0.08929443359375,
0.02655029296875,
-0.027191162109375,
0.037689208984375,
0.048065185546875,
-0.0207672119140625,
0.0474853515625,
0.0087127685546875,
-0.01093292236328125,
-0.00966644287109375,
0.00421142578125,
-0.049896240234375,
0.052215576171875,
0.016021728515625,
-0.032928466796875,
0.0169677734375,
0.0141754150390625,
0.01244354248046875,
-0.01629638671875,
-0.01202392578125,
0.043365478515625,
0.0113525390625,
-0.045135498046875,
0.061370849609375,
-0.00012505054473876953,
0.0634765625,
-0.054840087890625,
0.01251983642578125,
0.00910186767578125,
0.0194854736328125,
-0.022735595703125,
-0.048675537109375,
0.0100860595703125,
0.01141357421875,
-0.031036376953125,
0.01108551025390625,
0.03521728515625,
-0.052703857421875,
-0.051177978515625,
0.03509521484375,
0.0089874267578125,
0.0316162109375,
0.0045318603515625,
-0.06463623046875,
0.019989013671875,
0.0224151611328125,
-0.0256500244140625,
0.00789642333984375,
0.02178955078125,
0.0245819091796875,
0.045013427734375,
0.053924560546875,
0.0236358642578125,
-0.0022068023681640625,
0.01038360595703125,
0.047943115234375,
-0.044830322265625,
-0.0452880859375,
-0.051849365234375,
0.037017822265625,
0.0016489028930664062,
-0.0297088623046875,
0.048828125,
0.051513671875,
0.06414794921875,
-0.00406646728515625,
0.07269287109375,
-0.01039886474609375,
0.06689453125,
-0.048980712890625,
0.0595703125,
-0.04351806640625,
0.00888824462890625,
-0.0303497314453125,
-0.048828125,
-0.00823211669921875,
0.07562255859375,
-0.0275115966796875,
0.0139923095703125,
0.049468994140625,
0.08197021484375,
-0.0029659271240234375,
-0.00429534912109375,
0.023284912109375,
0.038818359375,
0.01140594482421875,
0.048797607421875,
0.048492431640625,
-0.0526123046875,
0.0587158203125,
-0.029693603515625,
-0.0041656494140625,
-0.0083160400390625,
-0.048828125,
-0.06402587890625,
-0.06585693359375,
-0.033477783203125,
-0.0504150390625,
-0.004238128662109375,
0.08892822265625,
0.05474853515625,
-0.07012939453125,
-0.02728271484375,
0.0123291015625,
-0.007030487060546875,
-0.024749755859375,
-0.0155181884765625,
0.032196044921875,
0.003971099853515625,
-0.062286376953125,
0.0357666015625,
-0.01360321044921875,
0.0194244384765625,
-0.01198577880859375,
-0.0185089111328125,
-0.0199127197265625,
0.0031490325927734375,
0.0225830078125,
0.0310821533203125,
-0.0648193359375,
-0.0156402587890625,
0.002849578857421875,
-0.017120361328125,
0.003269195556640625,
0.02142333984375,
-0.0498046875,
0.01898193359375,
0.041107177734375,
0.01381683349609375,
0.038360595703125,
-0.021453857421875,
0.0231170654296875,
-0.038604736328125,
0.019866943359375,
0.019622802734375,
0.049896240234375,
0.031280517578125,
-0.0168304443359375,
0.026275634765625,
0.0200347900390625,
-0.04388427734375,
-0.078125,
-0.00795745849609375,
-0.09588623046875,
-0.0059051513671875,
0.10540771484375,
-0.0121307373046875,
-0.01995849609375,
0.0050811767578125,
-0.0293731689453125,
0.043426513671875,
-0.0394287109375,
0.0341796875,
0.049285888671875,
-0.0013437271118164062,
-0.007171630859375,
-0.0394287109375,
0.03118896484375,
0.0240325927734375,
-0.040740966796875,
0.004924774169921875,
0.03472900390625,
0.03826904296875,
0.0234375,
0.05462646484375,
0.0017671585083007812,
0.028167724609375,
0.005115509033203125,
0.02239990234375,
-0.010162353515625,
-0.0200042724609375,
-0.04315185546875,
-0.004688262939453125,
-0.0098876953125,
-0.03350830078125
]
] |
timm/mobilenetv3_large_100.ra_in1k | 2023-04-27T22:49:21.000Z | [
"timm",
"pytorch",
"safetensors",
"image-classification",
"dataset:imagenet-1k",
"arxiv:2110.00476",
"arxiv:1905.02244",
"license:apache-2.0",
"region:us",
"has_space"
] | image-classification | timm | null | null | timm/mobilenetv3_large_100.ra_in1k | 9 | 61,880,982 | timm | 2022-12-16T05:38:07 | ---
tags:
- image-classification
- timm
library_name: timm
license: apache-2.0
datasets:
- imagenet-1k
---
# Model card for mobilenetv3_large_100.ra_in1k
A MobileNet-v3 image classification model. Trained on ImageNet-1k in `timm` using recipe template described below.
Recipe details:
* RandAugment `RA` recipe. Inspired by and evolved from EfficientNet RandAugment recipes. Published as `B` recipe in [ResNet Strikes Back](https://arxiv.org/abs/2110.00476).
* RMSProp (TF 1.0 behaviour) optimizer, EMA weight averaging
* Step (exponential decay w/ staircase) LR schedule with warmup
## Model Details
- **Model Type:** Image classification / feature backbone
- **Model Stats:**
- Params (M): 5.5
- GMACs: 0.2
- Activations (M): 4.4
- Image size: 224 x 224
- **Papers:**
- Searching for MobileNetV3: https://arxiv.org/abs/1905.02244
- ResNet strikes back: An improved training procedure in timm: https://arxiv.org/abs/2110.00476
- **Dataset:** ImageNet-1k
- **Original:** https://github.com/huggingface/pytorch-image-models
## Model Usage
### Image Classification
```python
from urllib.request import urlopen
from PIL import Image
import timm
img = Image.open(urlopen(
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))
model = timm.create_model('mobilenetv3_large_100.ra_in1k', pretrained=True)
model = model.eval()
# get model specific transforms (normalization, resize)
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)
output = model(transforms(img).unsqueeze(0)) # unsqueeze single image into batch of 1
top5_probabilities, top5_class_indices = torch.topk(output.softmax(dim=1) * 100, k=5)
```
### Feature Map Extraction
```python
from urllib.request import urlopen
from PIL import Image
import timm
img = Image.open(urlopen(
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))
model = timm.create_model(
'mobilenetv3_large_100.ra_in1k',
pretrained=True,
features_only=True,
)
model = model.eval()
# get model specific transforms (normalization, resize)
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)
output = model(transforms(img).unsqueeze(0)) # unsqueeze single image into batch of 1
for o in output:
# print shape of each feature map in output
# e.g.:
# torch.Size([1, 16, 112, 112])
# torch.Size([1, 24, 56, 56])
# torch.Size([1, 40, 28, 28])
# torch.Size([1, 112, 14, 14])
# torch.Size([1, 960, 7, 7])
print(o.shape)
```
### Image Embeddings
```python
from urllib.request import urlopen
from PIL import Image
import timm
img = Image.open(urlopen(
'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
))
model = timm.create_model(
'mobilenetv3_large_100.ra_in1k',
pretrained=True,
num_classes=0, # remove classifier nn.Linear
)
model = model.eval()
# get model specific transforms (normalization, resize)
data_config = timm.data.resolve_model_data_config(model)
transforms = timm.data.create_transform(**data_config, is_training=False)
output = model(transforms(img).unsqueeze(0)) # output is (batch_size, num_features) shaped tensor
# or equivalently (without needing to set num_classes=0)
output = model.forward_features(transforms(img).unsqueeze(0))
# output is unpooled, a (1, 960, 7, 7) shaped tensor
output = model.forward_head(output, pre_logits=True)
# output is a (1, num_features) shaped tensor
```
## Model Comparison
Explore the dataset and runtime metrics of this model in timm [model results](https://github.com/huggingface/pytorch-image-models/tree/main/results).
## Citation
```bibtex
@inproceedings{howard2019searching,
title={Searching for mobilenetv3},
author={Howard, Andrew and Sandler, Mark and Chu, Grace and Chen, Liang-Chieh and Chen, Bo and Tan, Mingxing and Wang, Weijun and Zhu, Yukun and Pang, Ruoming and Vasudevan, Vijay and others},
booktitle={Proceedings of the IEEE/CVF international conference on computer vision},
pages={1314--1324},
year={2019}
}
```
```bibtex
@misc{rw2019timm,
author = {Ross Wightman},
title = {PyTorch Image Models},
year = {2019},
publisher = {GitHub},
journal = {GitHub repository},
doi = {10.5281/zenodo.4414861},
howpublished = {\url{https://github.com/huggingface/pytorch-image-models}}
}
```
```bibtex
@inproceedings{wightman2021resnet,
title={ResNet strikes back: An improved training procedure in timm},
author={Wightman, Ross and Touvron, Hugo and Jegou, Herve},
booktitle={NeurIPS 2021 Workshop on ImageNet: Past, Present, and Future}
}
```
| 4,793 | [
[
-0.0309295654296875,
-0.0209808349609375,
-0.004390716552734375,
0.006359100341796875,
-0.0230865478515625,
-0.0299835205078125,
-0.00531005859375,
-0.0260467529296875,
0.0279998779296875,
0.035003662109375,
-0.02734375,
-0.054229736328125,
-0.0435791015625,
-0.0071258544921875,
-0.00962066650390625,
0.0599365234375,
-0.00848388671875,
-0.00580596923828125,
-0.0081329345703125,
-0.048980712890625,
-0.0174102783203125,
-0.0248260498046875,
-0.066650390625,
-0.0352783203125,
0.036407470703125,
0.0258026123046875,
0.0423583984375,
0.05010986328125,
0.04693603515625,
0.03173828125,
-0.0027332305908203125,
0.010040283203125,
-0.006763458251953125,
-0.013885498046875,
0.0306396484375,
-0.051177978515625,
-0.0323486328125,
0.02398681640625,
0.045989990234375,
0.017181396484375,
0.0005712509155273438,
0.0325927734375,
0.003284454345703125,
0.053680419921875,
-0.0270233154296875,
-0.0017337799072265625,
-0.035614013671875,
0.01486968994140625,
-0.01163482666015625,
-0.002689361572265625,
-0.0200653076171875,
-0.033447265625,
0.00841522216796875,
-0.03204345703125,
0.029052734375,
0.0007772445678710938,
0.09967041015625,
0.01220703125,
-0.01251220703125,
0.001819610595703125,
-0.0191802978515625,
0.05828857421875,
-0.054412841796875,
0.015869140625,
0.03021240234375,
0.0176239013671875,
-0.005908966064453125,
-0.07733154296875,
-0.04608154296875,
-0.01360321044921875,
1.7881393432617188e-7,
-0.0015926361083984375,
-0.01580810546875,
-0.007415771484375,
0.01898193359375,
0.0183868408203125,
-0.03216552734375,
0.00780487060546875,
-0.0386962890625,
-0.01555633544921875,
0.044464111328125,
0.0037364959716796875,
0.0299224853515625,
-0.02374267578125,
-0.0312347412109375,
-0.0281829833984375,
-0.03570556640625,
0.0237579345703125,
0.0179595947265625,
0.01557159423828125,
-0.048370361328125,
0.037078857421875,
0.004085540771484375,
0.051055908203125,
-0.0019521713256835938,
-0.0316162109375,
0.053466796875,
-0.00482940673828125,
-0.0302276611328125,
-0.006069183349609375,
0.08587646484375,
0.04132080078125,
0.011932373046875,
0.01425933837890625,
-0.007038116455078125,
-0.03466796875,
-0.0014934539794921875,
-0.087158203125,
-0.019012451171875,
0.025726318359375,
-0.06427001953125,
-0.03521728515625,
0.015960693359375,
-0.037445068359375,
-0.016571044921875,
0.0043182373046875,
0.033294677734375,
-0.03143310546875,
-0.0311279296875,
0.00396728515625,
-0.009735107421875,
0.0271148681640625,
0.01038360595703125,
-0.04315185546875,
0.0098724365234375,
0.0162506103515625,
0.09588623046875,
0.0102386474609375,
-0.03436279296875,
-0.019134521484375,
-0.0279541015625,
-0.016082763671875,
0.030120849609375,
-0.00742340087890625,
-0.01183319091796875,
-0.0246429443359375,
0.0247955322265625,
-0.019775390625,
-0.059844970703125,
0.02667236328125,
-0.0228271484375,
0.01392364501953125,
-0.00037384033203125,
-0.0021038055419921875,
-0.046112060546875,
0.0219879150390625,
-0.039093017578125,
0.10247802734375,
0.020355224609375,
-0.0675048828125,
0.02093505859375,
-0.04229736328125,
-0.0139923095703125,
-0.0281219482421875,
0.00036835670471191406,
-0.080078125,
-0.01224517822265625,
0.0189056396484375,
0.0635986328125,
-0.028778076171875,
-0.005321502685546875,
-0.0447998046875,
-0.02374267578125,
0.0230255126953125,
0.010040283203125,
0.07843017578125,
0.0183563232421875,
-0.0396728515625,
0.0159149169921875,
-0.046905517578125,
0.01441192626953125,
0.035980224609375,
-0.017730712890625,
-0.00907135009765625,
-0.033538818359375,
0.0078582763671875,
0.0281524658203125,
0.000034689903259277344,
-0.041229248046875,
0.015655517578125,
-0.01244354248046875,
0.041748046875,
0.031524658203125,
-0.0095977783203125,
0.0289154052734375,
-0.033905029296875,
0.02130126953125,
0.0208892822265625,
0.0208740234375,
-0.00830078125,
-0.042938232421875,
-0.058563232421875,
-0.0330810546875,
0.028717041015625,
0.03497314453125,
-0.04315185546875,
0.02490234375,
-0.01522064208984375,
-0.062286376953125,
-0.033416748046875,
0.00592041015625,
0.03338623046875,
0.03973388671875,
0.0225982666015625,
-0.037200927734375,
-0.046112060546875,
-0.06793212890625,
-0.00392913818359375,
0.003307342529296875,
0.0008764266967773438,
0.033843994140625,
0.05303955078125,
-0.01282501220703125,
0.051116943359375,
-0.0214080810546875,
-0.0213470458984375,
-0.0184783935546875,
0.00646209716796875,
0.0299224853515625,
0.060791015625,
0.060211181640625,
-0.061920166015625,
-0.03460693359375,
-0.0017242431640625,
-0.071533203125,
0.014556884765625,
-0.00820159912109375,
-0.005542755126953125,
0.0199127197265625,
0.019744873046875,
-0.04681396484375,
0.047760009765625,
0.0181732177734375,
-0.0119476318359375,
0.02764892578125,
-0.00506591796875,
0.02117919921875,
-0.09490966796875,
0.0096282958984375,
0.03509521484375,
-0.01081085205078125,
-0.027801513671875,
0.005817413330078125,
0.007183074951171875,
-0.01073455810546875,
-0.043975830078125,
0.0509033203125,
-0.0400390625,
-0.01776123046875,
-0.01503753662109375,
-0.00930023193359375,
-0.0012540817260742188,
0.0440673828125,
-0.0116119384765625,
0.03448486328125,
0.053985595703125,
-0.041229248046875,
0.039886474609375,
0.0205078125,
-0.01329803466796875,
0.02276611328125,
-0.052825927734375,
0.013641357421875,
0.0024547576904296875,
0.027984619140625,
-0.06304931640625,
-0.021575927734375,
0.0299835205078125,
-0.05096435546875,
0.031829833984375,
-0.048095703125,
-0.0322265625,
-0.047637939453125,
-0.04058837890625,
0.031280517578125,
0.043060302734375,
-0.057373046875,
0.046844482421875,
0.021514892578125,
0.0274200439453125,
-0.046112060546875,
-0.061370849609375,
-0.01397705078125,
-0.03643798828125,
-0.05828857421875,
0.033355712890625,
0.0235748291015625,
0.0063018798828125,
0.0025310516357421875,
-0.0119476318359375,
-0.0125579833984375,
-0.008087158203125,
0.052764892578125,
0.024993896484375,
-0.0198822021484375,
-0.0153656005859375,
-0.035400390625,
-0.0025997161865234375,
-0.0011548995971679688,
-0.029571533203125,
0.0447998046875,
-0.0255279541015625,
-0.0037403106689453125,
-0.069091796875,
-0.016021728515625,
0.042205810546875,
-0.0110931396484375,
0.060089111328125,
0.086669921875,
-0.03802490234375,
0.01049041748046875,
-0.037506103515625,
-0.013671875,
-0.0367431640625,
0.0277557373046875,
-0.0330810546875,
-0.035430908203125,
0.070068359375,
0.00246429443359375,
-0.00009745359420776367,
0.047454833984375,
0.0247344970703125,
-0.005611419677734375,
0.058563232421875,
0.04193115234375,
0.01213836669921875,
0.05316162109375,
-0.06622314453125,
-0.0162200927734375,
-0.06964111328125,
-0.047576904296875,
-0.033905029296875,
-0.038665771484375,
-0.056365966796875,
-0.030731201171875,
0.0298919677734375,
0.012786865234375,
-0.033111572265625,
0.03985595703125,
-0.056427001953125,
0.007358551025390625,
0.0535888671875,
0.049591064453125,
-0.0302276611328125,
0.026885986328125,
-0.026153564453125,
-0.00007468461990356445,
-0.060150146484375,
-0.0196380615234375,
0.086669921875,
0.03436279296875,
0.040283203125,
-0.006526947021484375,
0.060577392578125,
-0.022674560546875,
0.0253448486328125,
-0.048431396484375,
0.0455322265625,
-0.005619049072265625,
-0.033233642578125,
-0.0026340484619140625,
-0.037506103515625,
-0.0810546875,
0.01128387451171875,
-0.02227783203125,
-0.059600830078125,
0.01386260986328125,
0.01450347900390625,
-0.020721435546875,
0.056427001953125,
-0.0633544921875,
0.0670166015625,
-0.0039043426513671875,
-0.039703369140625,
0.009613037109375,
-0.05413818359375,
0.0290679931640625,
0.01525115966796875,
-0.01294708251953125,
-0.00809478759765625,
0.009796142578125,
0.0799560546875,
-0.048431396484375,
0.059844970703125,
-0.0361328125,
0.0303955078125,
0.04351806640625,
-0.009307861328125,
0.0294342041015625,
-0.003765106201171875,
-0.01800537109375,
0.0201873779296875,
-0.001239776611328125,
-0.034912109375,
-0.040740966796875,
0.05059814453125,
-0.0682373046875,
-0.0190887451171875,
-0.0266876220703125,
-0.02532958984375,
0.01502227783203125,
0.01464080810546875,
0.041107177734375,
0.0526123046875,
0.026824951171875,
0.0242767333984375,
0.04156494140625,
-0.038726806640625,
0.03717041015625,
-0.00699615478515625,
-0.019439697265625,
-0.041107177734375,
0.06951904296875,
0.00945281982421875,
0.0014753341674804688,
0.01018524169921875,
0.0126495361328125,
-0.02471923828125,
-0.04681396484375,
-0.023162841796875,
0.020263671875,
-0.04522705078125,
-0.037445068359375,
-0.046905517578125,
-0.0302886962890625,
-0.023193359375,
-0.003429412841796875,
-0.04156494140625,
-0.0242156982421875,
-0.031158447265625,
0.0236663818359375,
0.053619384765625,
0.0362548828125,
-0.01171112060546875,
0.0455322265625,
-0.049346923828125,
0.01413726806640625,
0.005275726318359375,
0.0340576171875,
-0.005184173583984375,
-0.060150146484375,
-0.0199127197265625,
-0.001285552978515625,
-0.033203125,
-0.047576904296875,
0.03759765625,
0.005706787109375,
0.0291290283203125,
0.0178680419921875,
-0.0198516845703125,
0.055145263671875,
-0.0010881423950195312,
0.045654296875,
0.041778564453125,
-0.03985595703125,
0.046051025390625,
-0.0144805908203125,
0.0187530517578125,
0.01050567626953125,
0.0294647216796875,
-0.017913818359375,
0.0095672607421875,
-0.06591796875,
-0.059326171875,
0.061187744140625,
0.00975799560546875,
-0.0012216567993164062,
0.0249786376953125,
0.056549072265625,
-0.00975799560546875,
-0.005298614501953125,
-0.0628662109375,
-0.03338623046875,
-0.0302276611328125,
-0.018280029296875,
0.013946533203125,
-0.008087158203125,
-0.0022983551025390625,
-0.052703857421875,
0.05029296875,
0.00028061866760253906,
0.057891845703125,
0.0288848876953125,
0.0038585662841796875,
0.00409698486328125,
-0.034820556640625,
0.043792724609375,
0.0190887451171875,
-0.0288848876953125,
0.0057830810546875,
0.0104827880859375,
-0.053466796875,
0.0118408203125,
0.0086517333984375,
0.0022602081298828125,
0.0023403167724609375,
0.0264129638671875,
0.06549072265625,
-0.0038318634033203125,
0.00685882568359375,
0.03326416015625,
-0.00959014892578125,
-0.040618896484375,
-0.0224761962890625,
0.0102386474609375,
-0.0029125213623046875,
0.0309295654296875,
0.032135009765625,
0.034149169921875,
-0.00897979736328125,
-0.01727294921875,
0.0206756591796875,
0.03021240234375,
-0.0215606689453125,
-0.0187530517578125,
0.05291748046875,
-0.0073089599609375,
-0.0166473388671875,
0.057281494140625,
-0.0097198486328125,
-0.0355224609375,
0.07855224609375,
0.033782958984375,
0.06781005859375,
-0.006023406982421875,
0.004734039306640625,
0.065185546875,
0.0229339599609375,
-0.007781982421875,
0.0191192626953125,
0.0156402587890625,
-0.05718994140625,
0.001251220703125,
-0.03302001953125,
0.00803375244140625,
0.033294677734375,
-0.04205322265625,
0.026275634765625,
-0.05023193359375,
-0.037811279296875,
0.0180816650390625,
0.021636962890625,
-0.06536865234375,
0.0218963623046875,
-0.01166534423828125,
0.0693359375,
-0.042694091796875,
0.059295654296875,
0.0667724609375,
-0.036651611328125,
-0.0816650390625,
0.0009984970092773438,
0.006893157958984375,
-0.0684814453125,
0.05426025390625,
0.037567138671875,
0.0008287429809570312,
0.00783538818359375,
-0.0616455078125,
-0.05157470703125,
0.10357666015625,
0.0309600830078125,
-0.00643157958984375,
0.0250244140625,
-0.0121612548828125,
0.0047607421875,
-0.035308837890625,
0.0404052734375,
0.01076507568359375,
0.0211944580078125,
0.022796630859375,
-0.05657958984375,
0.01849365234375,
-0.028717041015625,
0.013824462890625,
0.015838623046875,
-0.06365966796875,
0.0570068359375,
-0.0426025390625,
-0.00992584228515625,
0.0008807182312011719,
0.04473876953125,
0.0187530517578125,
0.0219573974609375,
0.033843994140625,
0.055145263671875,
0.037139892578125,
-0.0176849365234375,
0.0692138671875,
0.0012378692626953125,
0.03631591796875,
0.047119140625,
0.0180816650390625,
0.0460205078125,
0.026580810546875,
-0.01351165771484375,
0.0302276611328125,
0.08966064453125,
-0.0205535888671875,
0.02239990234375,
0.0142669677734375,
-0.005367279052734375,
-0.0003795623779296875,
0.007160186767578125,
-0.03466796875,
0.047515869140625,
0.008544921875,
-0.045745849609375,
-0.0103912353515625,
0.007205963134765625,
0.003932952880859375,
-0.0254364013671875,
-0.01959228515625,
0.026641845703125,
0.004669189453125,
-0.026641845703125,
0.0794677734375,
0.01947021484375,
0.06500244140625,
-0.0196533203125,
0.00443267822265625,
-0.02288818359375,
0.00757598876953125,
-0.035400390625,
-0.051666259765625,
0.021026611328125,
-0.0216522216796875,
-0.0025463104248046875,
0.007511138916015625,
0.054229736328125,
-0.00841522216796875,
-0.0229034423828125,
0.006206512451171875,
0.01525115966796875,
0.03759765625,
0.0028247833251953125,
-0.09033203125,
0.0215301513671875,
0.010345458984375,
-0.0433349609375,
0.02374267578125,
0.023040771484375,
0.005863189697265625,
0.06585693359375,
0.046112060546875,
-0.0157928466796875,
0.00998687744140625,
-0.0177154541015625,
0.061920166015625,
-0.04681396484375,
-0.015899658203125,
-0.06304931640625,
0.044403076171875,
-0.0147705078125,
-0.0450439453125,
0.04290771484375,
0.050750732421875,
0.059844970703125,
0.003101348876953125,
0.0389404296875,
-0.0236053466796875,
-0.0022735595703125,
-0.03778076171875,
0.04913330078125,
-0.0592041015625,
0.006649017333984375,
-0.005970001220703125,
-0.04937744140625,
-0.03265380859375,
0.061370849609375,
-0.0201416015625,
0.03216552734375,
0.039764404296875,
0.07977294921875,
-0.032958984375,
-0.0191802978515625,
0.004970550537109375,
-0.00022518634796142578,
-0.002838134765625,
0.024871826171875,
0.031951904296875,
-0.06768798828125,
0.0294952392578125,
-0.04052734375,
-0.013397216796875,
-0.01934814453125,
-0.056427001953125,
-0.07421875,
-0.06658935546875,
-0.040496826171875,
-0.06561279296875,
-0.01277923583984375,
0.07177734375,
0.08502197265625,
-0.04052734375,
-0.01168060302734375,
-0.0001786947250366211,
0.0172882080078125,
-0.01352691650390625,
-0.0163726806640625,
0.042694091796875,
-0.002899169921875,
-0.04595947265625,
-0.0159759521484375,
-0.0005826950073242188,
0.0313720703125,
0.01325225830078125,
-0.0173797607421875,
-0.012603759765625,
-0.026885986328125,
0.0225677490234375,
0.03643798828125,
-0.045745849609375,
-0.006343841552734375,
-0.0153656005859375,
-0.0166015625,
0.0293731689453125,
0.04119873046875,
-0.036895751953125,
0.019439697265625,
0.017547607421875,
0.0265045166015625,
0.0670166015625,
-0.0249786376953125,
0.0087738037109375,
-0.06207275390625,
0.047271728515625,
-0.01102447509765625,
0.02899169921875,
0.0301666259765625,
-0.0208892822265625,
0.0478515625,
0.0310516357421875,
-0.0304412841796875,
-0.069091796875,
-0.005889892578125,
-0.08013916015625,
-0.003696441650390625,
0.07562255859375,
-0.0204925537109375,
-0.03863525390625,
0.025726318359375,
-0.0009217262268066406,
0.0455322265625,
-0.00858306884765625,
0.033233642578125,
0.0128326416015625,
-0.01202392578125,
-0.05517578125,
-0.054962158203125,
0.035064697265625,
0.0097808837890625,
-0.044921875,
-0.039215087890625,
-0.0034084320068359375,
0.050445556640625,
0.015960693359375,
0.04669189453125,
-0.01629638671875,
0.0122833251953125,
0.00569915771484375,
0.04119873046875,
-0.0322265625,
-0.002735137939453125,
-0.0188751220703125,
-0.0017261505126953125,
-0.00922393798828125,
-0.053375244140625
]
] |
bert-base-uncased | 2023-06-30T01:42:19.000Z | [
"transformers",
"pytorch",
"tf",
"jax",
"rust",
"coreml",
"onnx",
"safetensors",
"bert",
"fill-mask",
"exbert",
"en",
"dataset:bookcorpus",
"dataset:wikipedia",
"arxiv:1810.04805",
"license:apache-2.0",
"autotrain_compatible",
"endpoints_compatible",
"has_space",
"region:us"
] | fill-mask | null | null | null | bert-base-uncased | 1,182 | 52,250,055 | transformers | 2022-03-02T23:29:04 | ---
language: en
tags:
- exbert
license: apache-2.0
datasets:
- bookcorpus
- wikipedia
---
# BERT base model (uncased)
Pretrained model on English language using a masked language modeling (MLM) objective. It was introduced in
[this paper](https://arxiv.org/abs/1810.04805) and first released in
[this repository](https://github.com/google-research/bert). This model is uncased: it does not make a difference
between english and English.
Disclaimer: The team releasing BERT did not write a model card for this model so this model card has been written by
the Hugging Face team.
## Model description
BERT is a transformers model pretrained on a large corpus of English data in a self-supervised fashion. This means it
was pretrained on the raw texts only, with no humans labeling 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 sentence, the model randomly masks 15% of the words in the input then run
the entire masked sentence through the model and 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 masks the future tokens. It allows the model to learn a bidirectional representation of the
sentence.
- Next sentence prediction (NSP): the models concatenates two masked 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 the English language 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 BERT model as inputs.
## Model variations
BERT has originally been released in base and large variations, for cased and uncased input text. The uncased models also strips out an accent markers.
Chinese and multilingual uncased and cased versions followed shortly after.
Modified preprocessing with whole word masking has replaced subpiece masking in a following work, with the release of two models.
Other 24 smaller models are released afterward.
The detailed release history can be found on the [google-research/bert readme](https://github.com/google-research/bert/blob/master/README.md) on github.
| Model | #params | Language |
|------------------------|--------------------------------|-------|
| [`bert-base-uncased`](https://huggingface.co/bert-base-uncased) | 110M | English |
| [`bert-large-uncased`](https://huggingface.co/bert-large-uncased) | 340M | English | sub
| [`bert-base-cased`](https://huggingface.co/bert-base-cased) | 110M | English |
| [`bert-large-cased`](https://huggingface.co/bert-large-cased) | 340M | English |
| [`bert-base-chinese`](https://huggingface.co/bert-base-chinese) | 110M | Chinese |
| [`bert-base-multilingual-cased`](https://huggingface.co/bert-base-multilingual-cased) | 110M | Multiple |
| [`bert-large-uncased-whole-word-masking`](https://huggingface.co/bert-large-uncased-whole-word-masking) | 340M | English |
| [`bert-large-cased-whole-word-masking`](https://huggingface.co/bert-large-cased-whole-word-masking) | 340M | English |
## 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=bert) to look for
fine-tuned versions of 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 model like GPT2.
### How to use
You can use this model directly with a pipeline for masked language modeling:
```python
>>> from transformers import pipeline
>>> unmasker = pipeline('fill-mask', model='bert-base-uncased')
>>> unmasker("Hello I'm a [MASK] model.")
[{'sequence': "[CLS] hello i'm a fashion model. [SEP]",
'score': 0.1073106899857521,
'token': 4827,
'token_str': 'fashion'},
{'sequence': "[CLS] hello i'm a role model. [SEP]",
'score': 0.08774490654468536,
'token': 2535,
'token_str': 'role'},
{'sequence': "[CLS] hello i'm a new model. [SEP]",
'score': 0.05338378623127937,
'token': 2047,
'token_str': 'new'},
{'sequence': "[CLS] hello i'm a super model. [SEP]",
'score': 0.04667217284440994,
'token': 3565,
'token_str': 'super'},
{'sequence': "[CLS] hello i'm a fine model. [SEP]",
'score': 0.027095865458250046,
'token': 2986,
'token_str': 'fine'}]
```
Here is how to use this model to get the features of a given text in PyTorch:
```python
from transformers import BertTokenizer, BertModel
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
model = BertModel.from_pretrained("bert-base-uncased")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```
and in TensorFlow:
```python
from transformers import BertTokenizer, TFBertModel
tokenizer = BertTokenizer.from_pretrained('bert-base-uncased')
model = TFBertModel.from_pretrained("bert-base-uncased")
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```
### Limitations and bias
Even if the training data used for this model could be characterized as fairly neutral, this model can have biased
predictions:
```python
>>> from transformers import pipeline
>>> unmasker = pipeline('fill-mask', model='bert-base-uncased')
>>> unmasker("The man worked as a [MASK].")
[{'sequence': '[CLS] the man worked as a carpenter. [SEP]',
'score': 0.09747550636529922,
'token': 10533,
'token_str': 'carpenter'},
{'sequence': '[CLS] the man worked as a waiter. [SEP]',
'score': 0.0523831807076931,
'token': 15610,
'token_str': 'waiter'},
{'sequence': '[CLS] the man worked as a barber. [SEP]',
'score': 0.04962705448269844,
'token': 13362,
'token_str': 'barber'},
{'sequence': '[CLS] the man worked as a mechanic. [SEP]',
'score': 0.03788609802722931,
'token': 15893,
'token_str': 'mechanic'},
{'sequence': '[CLS] the man worked as a salesman. [SEP]',
'score': 0.037680890411138535,
'token': 18968,
'token_str': 'salesman'}]
>>> unmasker("The woman worked as a [MASK].")
[{'sequence': '[CLS] the woman worked as a nurse. [SEP]',
'score': 0.21981462836265564,
'token': 6821,
'token_str': 'nurse'},
{'sequence': '[CLS] the woman worked as a waitress. [SEP]',
'score': 0.1597415804862976,
'token': 13877,
'token_str': 'waitress'},
{'sequence': '[CLS] the woman worked as a maid. [SEP]',
'score': 0.1154729500412941,
'token': 10850,
'token_str': 'maid'},
{'sequence': '[CLS] the woman worked as a prostitute. [SEP]',
'score': 0.037968918681144714,
'token': 19215,
'token_str': 'prostitute'},
{'sequence': '[CLS] the woman worked as a cook. [SEP]',
'score': 0.03042375110089779,
'token': 5660,
'token_str': 'cook'}]
```
This bias will also affect all fine-tuned versions of this model.
## Training data
The BERT model was pretrained on [BookCorpus](https://yknzhu.wixsite.com/mbweb), a dataset consisting of 11,038
unpublished books and [English Wikipedia](https://en.wikipedia.org/wiki/English_Wikipedia) (excluding lists, tables and
headers).
## 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 A [SEP] Sentence B [SEP]
```
With probability 0.5, sentence A and sentence B correspond to two consecutive sentences in the original corpus, and in
the other cases, it's another random sentence in the corpus. Note that what is considered a sentence here is a
consecutive span of text usually longer than a single sentence. The only constrain is that the result with the two
"sentences" has a combined length of less than 512 tokens.
The details of the masking procedure for each sentence are the following:
- 15% of the tokens are masked.
- In 80% of the cases, the masked tokens are replaced by `[MASK]`.
- In 10% of the cases, the masked tokens are replaced by a random token (different) from the one they replace.
- In the 10% remaining cases, the masked tokens are left as is.
### Pretraining
The model was trained on 4 cloud TPUs in Pod configuration (16 TPU chips total) for one million steps with a batch size
of 256. The sequence length was limited to 128 tokens for 90% of the steps and 512 for the remaining 10%. The optimizer
used is Adam with a learning rate of 1e-4, \\(\beta_{1} = 0.9\\) and \\(\beta_{2} = 0.999\\), a weight decay of 0.01,
learning rate warmup for 10,000 steps and linear decay of the learning rate after.
## Evaluation results
When fine-tuned on downstream tasks, this model achieves the following results:
Glue test results:
| Task | MNLI-(m/mm) | QQP | QNLI | SST-2 | CoLA | STS-B | MRPC | RTE | Average |
|:----:|:-----------:|:----:|:----:|:-----:|:----:|:-----:|:----:|:----:|:-------:|
| | 84.6/83.4 | 71.2 | 90.5 | 93.5 | 52.1 | 85.8 | 88.9 | 66.4 | 79.6 |
### BibTeX entry and citation info
```bibtex
@article{DBLP:journals/corr/abs-1810-04805,
author = {Jacob Devlin and
Ming{-}Wei Chang and
Kenton Lee and
Kristina Toutanova},
title = {{BERT:} Pre-training of Deep Bidirectional Transformers for Language
Understanding},
journal = {CoRR},
volume = {abs/1810.04805},
year = {2018},
url = {http://arxiv.org/abs/1810.04805},
archivePrefix = {arXiv},
eprint = {1810.04805},
timestamp = {Tue, 30 Oct 2018 20:39:56 +0100},
biburl = {https://dblp.org/rec/journals/corr/abs-1810-04805.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
```
<a href="https://huggingface.co/exbert/?model=bert-base-uncased">
<img width="300px" src="https://cdn-media.huggingface.co/exbert/button.png">
</a>
| 10,517 | [
[
-0.010284423828125,
-0.046142578125,
0.0119476318359375,
0.023162841796875,
-0.0394287109375,
0.0003082752227783203,
-0.00923919677734375,
-0.0169677734375,
0.033599853515625,
0.041656494140625,
-0.04144287109375,
-0.03338623046875,
-0.0570068359375,
0.01056671142578125,
-0.035247802734375,
0.08563232421875,
0.020050048828125,
0.0227508544921875,
0.004886627197265625,
0.01316070556640625,
-0.030303955078125,
-0.0643310546875,
-0.05291748046875,
-0.0250091552734375,
0.03326416015625,
0.0224456787109375,
0.04949951171875,
0.04010009765625,
0.031280517578125,
0.0310821533203125,
-0.00392913818359375,
-0.005260467529296875,
-0.0206451416015625,
0.0047149658203125,
-0.000025093555450439453,
-0.0374755859375,
-0.03314208984375,
0.01495361328125,
0.0391845703125,
0.06378173828125,
-0.0007462501525878906,
0.0184478759765625,
-0.0075225830078125,
0.0416259765625,
-0.0123748779296875,
0.0263824462890625,
-0.039642333984375,
0.004497528076171875,
-0.0200042724609375,
0.0180816650390625,
-0.0297088623046875,
-0.0150604248046875,
0.01398468017578125,
-0.039093017578125,
0.0155181884765625,
0.008270263671875,
0.085693359375,
0.0057525634765625,
-0.01311492919921875,
-0.00921630859375,
-0.032073974609375,
0.061737060546875,
-0.0635986328125,
0.0176239013671875,
0.0362548828125,
0.01265716552734375,
-0.0182647705078125,
-0.07720947265625,
-0.0308074951171875,
-0.006862640380859375,
-0.0142974853515625,
0.00397491455078125,
-0.00476837158203125,
-0.004734039306640625,
0.020294189453125,
0.0338134765625,
-0.02801513671875,
-0.0003311634063720703,
-0.050628662109375,
-0.02813720703125,
0.055450439453125,
0.0029697418212890625,
0.0226593017578125,
-0.0323486328125,
-0.0209503173828125,
-0.019866943359375,
-0.0225677490234375,
0.00791168212890625,
0.04205322265625,
0.036773681640625,
-0.0186309814453125,
0.0567626953125,
-0.01336669921875,
0.046173095703125,
0.0012607574462890625,
0.0035305023193359375,
0.036224365234375,
-0.00335693359375,
-0.0292510986328125,
-0.005840301513671875,
0.07159423828125,
0.0211334228515625,
0.031341552734375,
-0.004062652587890625,
-0.025787353515625,
0.003299713134765625,
0.01971435546875,
-0.04193115234375,
-0.0300140380859375,
0.00847625732421875,
-0.040985107421875,
-0.0288848876953125,
0.031524658203125,
-0.049224853515625,
-0.005687713623046875,
-0.0044708251953125,
0.041595458984375,
-0.0290985107421875,
-0.01265716552734375,
0.013916015625,
-0.03436279296875,
0.0148773193359375,
0.0031147003173828125,
-0.0694580078125,
0.014862060546875,
0.0457763671875,
0.059844970703125,
0.02294921875,
-0.0107574462890625,
-0.0216827392578125,
-0.02008056640625,
-0.02435302734375,
0.03533935546875,
-0.025787353515625,
-0.0325927734375,
0.004444122314453125,
0.0263519287109375,
-0.00792694091796875,
-0.0198211669921875,
0.05035400390625,
-0.0333251953125,
0.045654296875,
-0.004665374755859375,
-0.0390625,
-0.0241546630859375,
0.006137847900390625,
-0.05584716796875,
0.08953857421875,
0.02386474609375,
-0.049072265625,
0.01715087890625,
-0.066650390625,
-0.047515869140625,
0.0151824951171875,
0.014007568359375,
-0.030364990234375,
0.0153045654296875,
0.013702392578125,
0.0330810546875,
-0.005146026611328125,
0.0223388671875,
-0.01172637939453125,
-0.0286712646484375,
0.0252532958984375,
-0.0180816650390625,
0.0809326171875,
0.01416015625,
-0.0231170654296875,
0.01033782958984375,
-0.058746337890625,
0.007526397705078125,
0.01922607421875,
-0.024932861328125,
-0.00971221923828125,
-0.00647735595703125,
0.024688720703125,
0.01235198974609375,
0.034637451171875,
-0.048065185546875,
0.0182952880859375,
-0.04638671875,
0.0543212890625,
0.059417724609375,
-0.012939453125,
0.01953125,
-0.0274810791015625,
0.03594970703125,
-0.0037746429443359375,
-0.0005397796630859375,
-0.01097869873046875,
-0.0596923828125,
-0.06341552734375,
-0.0265350341796875,
0.051177978515625,
0.054168701171875,
-0.04034423828125,
0.058868408203125,
-0.0004706382751464844,
-0.04443359375,
-0.0496826171875,
-0.0083160400390625,
0.0276336669921875,
0.0282440185546875,
0.023101806640625,
-0.03973388671875,
-0.06805419921875,
-0.065185546875,
-0.0186614990234375,
-0.017669677734375,
-0.0186767578125,
0.0089569091796875,
0.046783447265625,
-0.0271759033203125,
0.0577392578125,
-0.052520751953125,
-0.0311737060546875,
-0.0198516845703125,
0.0180511474609375,
0.0479736328125,
0.05291748046875,
0.0283050537109375,
-0.0428466796875,
-0.03106689453125,
-0.0241546630859375,
-0.041534423828125,
0.0019969940185546875,
0.0020847320556640625,
-0.0133209228515625,
0.017669677734375,
0.036865234375,
-0.05609130859375,
0.035247802734375,
0.027557373046875,
-0.036773681640625,
0.050048828125,
-0.027008056640625,
-0.00846099853515625,
-0.09320068359375,
0.00966644287109375,
-0.00977325439453125,
-0.0223388671875,
-0.057769775390625,
0.00142669677734375,
-0.00970458984375,
-0.0031337738037109375,
-0.04034423828125,
0.039947509765625,
-0.032958984375,
0.0014314651489257812,
0.003566741943359375,
-0.01080322265625,
0.001750946044921875,
0.03509521484375,
0.00629425048828125,
0.042755126953125,
0.040496826171875,
-0.037872314453125,
0.041107177734375,
0.031707763671875,
-0.045013427734375,
0.0032196044921875,
-0.06329345703125,
0.0163726806640625,
0.0033969879150390625,
0.004467010498046875,
-0.08306884765625,
-0.0246124267578125,
0.0207672119140625,
-0.04644775390625,
0.0155181884765625,
-0.005344390869140625,
-0.054412841796875,
-0.04620361328125,
-0.0194244384765625,
0.02593994140625,
0.0443115234375,
-0.0194091796875,
0.0302886962890625,
0.027252197265625,
-0.01367950439453125,
-0.045654296875,
-0.05731201171875,
0.01189422607421875,
-0.00872802734375,
-0.043731689453125,
0.030120849609375,
-0.004535675048828125,
-0.00710296630859375,
-0.01291656494140625,
0.007572174072265625,
-0.015380859375,
0.0020751953125,
0.01319122314453125,
0.036529541015625,
-0.015380859375,
-0.00789642333984375,
-0.01467132568359375,
-0.0081939697265625,
0.0173187255859375,
-0.0120849609375,
0.06243896484375,
-0.005706787109375,
-0.0031261444091796875,
-0.0180206298828125,
0.0275421142578125,
0.04510498046875,
-0.01013946533203125,
0.0518798828125,
0.06195068359375,
-0.0457763671875,
0.0024662017822265625,
-0.0297698974609375,
-0.013702392578125,
-0.038848876953125,
0.036865234375,
-0.0323486328125,
-0.06243896484375,
0.05841064453125,
0.0259552001953125,
-0.006069183349609375,
0.056243896484375,
0.044921875,
-0.0159912109375,
0.07904052734375,
0.042938232421875,
-0.0112152099609375,
0.03594970703125,
-0.0115814208984375,
0.0285186767578125,
-0.055511474609375,
-0.03375244140625,
-0.028228759765625,
-0.0206451416015625,
-0.0406494140625,
-0.01424407958984375,
0.0137786865234375,
0.0178070068359375,
-0.026824951171875,
0.05023193359375,
-0.049774169921875,
0.027496337890625,
0.07403564453125,
0.022003173828125,
-0.01415252685546875,
-0.0159454345703125,
-0.0198211669921875,
-0.002536773681640625,
-0.032318115234375,
-0.032073974609375,
0.0811767578125,
0.0391845703125,
0.05126953125,
0.006702423095703125,
0.043670654296875,
0.0269927978515625,
-0.0018939971923828125,
-0.05279541015625,
0.0474853515625,
-0.0325927734375,
-0.0694580078125,
-0.0284881591796875,
-0.00785064697265625,
-0.07598876953125,
0.0162506103515625,
-0.020416259765625,
-0.06500244140625,
-0.0036716461181640625,
-0.01265716552734375,
-0.0236663818359375,
0.01398468017578125,
-0.060791015625,
0.0792236328125,
-0.0229339599609375,
-0.0032806396484375,
0.01336669921875,
-0.07073974609375,
0.022369384765625,
0.0018529891967773438,
0.007770538330078125,
-0.01142120361328125,
0.019439697265625,
0.07647705078125,
-0.040008544921875,
0.078857421875,
-0.01155853271484375,
0.01031494140625,
0.00420379638671875,
-0.00550079345703125,
0.0243377685546875,
0.002399444580078125,
0.0038433074951171875,
0.0275726318359375,
0.006145477294921875,
-0.03472900390625,
-0.00922393798828125,
0.0269927978515625,
-0.05718994140625,
-0.0386962890625,
-0.04754638671875,
-0.048828125,
0.006610870361328125,
0.035247802734375,
0.046783447265625,
0.036956787109375,
-0.00913238525390625,
0.019500732421875,
0.032958984375,
-0.0242462158203125,
0.055267333984375,
0.0251922607421875,
-0.0167236328125,
-0.037261962890625,
0.04693603515625,
0.0019474029541015625,
0.00009721517562866211,
0.034393310546875,
0.01486968994140625,
-0.04376220703125,
-0.0150146484375,
-0.027191162109375,
0.0124969482421875,
-0.04278564453125,
-0.022552490234375,
-0.042388916015625,
-0.040740966796875,
-0.05364990234375,
-0.005405426025390625,
-0.01212310791015625,
-0.03851318359375,
-0.04595947265625,
-0.01071929931640625,
0.03265380859375,
0.053802490234375,
-0.01288604736328125,
0.035400390625,
-0.056396484375,
0.019073486328125,
0.022705078125,
0.0338134765625,
-0.020172119140625,
-0.057342529296875,
-0.025390625,
0.005985260009765625,
-0.01071929931640625,
-0.061798095703125,
0.054107666015625,
0.0185394287109375,
0.04046630859375,
0.036956787109375,
0.001834869384765625,
0.04449462890625,
-0.05023193359375,
0.07855224609375,
0.01788330078125,
-0.08599853515625,
0.03973388671875,
-0.0243072509765625,
0.0162506103515625,
0.0224456787109375,
0.0167236328125,
-0.04901123046875,
-0.0299835205078125,
-0.060211181640625,
-0.076416015625,
0.0625,
0.011993408203125,
0.031219482421875,
-0.00836181640625,
0.012420654296875,
0.01103973388671875,
0.029388427734375,
-0.07763671875,
-0.04071044921875,
-0.0384521484375,
-0.0250701904296875,
-0.0151214599609375,
-0.02349853515625,
-0.0014667510986328125,
-0.04693603515625,
0.05419921875,
0.011138916015625,
0.04266357421875,
0.007526397705078125,
-0.0138702392578125,
0.0096435546875,
0.01395416259765625,
0.06158447265625,
0.0341796875,
-0.0384521484375,
-0.0005054473876953125,
0.0015201568603515625,
-0.0467529296875,
-0.00127410888671875,
0.01611328125,
0.00107574462890625,
0.02264404296875,
0.044586181640625,
0.061431884765625,
0.017578125,
-0.041259765625,
0.04443359375,
0.01099395751953125,
-0.0266876220703125,
-0.041595458984375,
0.0020084381103515625,
-0.0018157958984375,
0.01030731201171875,
0.033935546875,
0.0088348388671875,
0.004398345947265625,
-0.04278564453125,
0.0301055908203125,
0.0306549072265625,
-0.0380859375,
-0.022247314453125,
0.0626220703125,
0.007106781005859375,
-0.048126220703125,
0.060150146484375,
-0.0106048583984375,
-0.06378173828125,
0.0531005859375,
0.052459716796875,
0.0694580078125,
-0.016632080078125,
0.0205535888671875,
0.032318115234375,
0.03369140625,
-0.01506805419921875,
0.031219482421875,
0.0258331298828125,
-0.065185546875,
-0.0260467529296875,
-0.054931640625,
-0.01363372802734375,
0.0206298828125,
-0.056640625,
0.01947021484375,
-0.03924560546875,
-0.017669677734375,
0.013427734375,
0.001781463623046875,
-0.049224853515625,
0.033447265625,
0.006496429443359375,
0.07720947265625,
-0.0726318359375,
0.076904296875,
0.061309814453125,
-0.04779052734375,
-0.0635986328125,
-0.0285797119140625,
-0.02301025390625,
-0.084228515625,
0.051361083984375,
0.02435302734375,
0.0265045166015625,
-0.00171661376953125,
-0.04718017578125,
-0.056427001953125,
0.055938720703125,
0.0142822265625,
-0.0300140380859375,
-0.0098876953125,
0.010040283203125,
0.043243408203125,
-0.03955078125,
0.034515380859375,
0.042999267578125,
0.03387451171875,
-0.00510406494140625,
-0.06207275390625,
0.0016393661499023438,
-0.0355224609375,
0.0017709732055664062,
0.006702423095703125,
-0.034454345703125,
0.09063720703125,
-0.00852203369140625,
0.0013093948364257812,
0.0178070068359375,
0.039794921875,
-0.0051422119140625,
0.0008530616760253906,
0.03656005859375,
0.04559326171875,
0.0518798828125,
-0.0287933349609375,
0.057464599609375,
-0.0167236328125,
0.038330078125,
0.061187744140625,
0.003803253173828125,
0.06243896484375,
0.026641845703125,
-0.0218658447265625,
0.0706787109375,
0.06561279296875,
-0.025177001953125,
0.056121826171875,
0.0173492431640625,
-0.004886627197265625,
-0.00823211669921875,
0.00879669189453125,
-0.0257568359375,
0.040679931640625,
0.0190277099609375,
-0.041259765625,
0.0017652511596679688,
-0.00794219970703125,
0.01409912109375,
-0.011322021484375,
-0.03131103515625,
0.051544189453125,
0.01316070556640625,
-0.0498046875,
0.0271453857421875,
0.0208892822265625,
0.059295654296875,
-0.045318603515625,
0.0030879974365234375,
-0.01103973388671875,
0.016632080078125,
-0.007015228271484375,
-0.064453125,
0.015167236328125,
-0.01052093505859375,
-0.032958984375,
-0.0202789306640625,
0.055938720703125,
-0.0390625,
-0.053924560546875,
0.00608062744140625,
0.0222930908203125,
0.0251312255859375,
-0.00765228271484375,
-0.0614013671875,
-0.0160369873046875,
0.00620269775390625,
-0.00971221923828125,
0.00951385498046875,
0.021575927734375,
0.0065765380859375,
0.04083251953125,
0.060821533203125,
-0.007720947265625,
0.0106201171875,
0.0031681060791015625,
0.052032470703125,
-0.072265625,
-0.057403564453125,
-0.0694580078125,
0.04779052734375,
-0.006908416748046875,
-0.041656494140625,
0.052154541015625,
0.050445556640625,
0.056640625,
-0.03472900390625,
0.042572021484375,
-0.0159759521484375,
0.042022705078125,
-0.02777099609375,
0.0621337890625,
-0.031158447265625,
-0.0033931732177734375,
-0.03179931640625,
-0.06097412109375,
-0.02630615234375,
0.0648193359375,
-0.006908416748046875,
0.00308990478515625,
0.04986572265625,
0.04339599609375,
0.007640838623046875,
-0.00942230224609375,
0.0159759521484375,
0.01175689697265625,
0.00551605224609375,
0.0291595458984375,
0.04193115234375,
-0.049102783203125,
0.0301971435546875,
-0.016357421875,
-0.004375457763671875,
-0.025634765625,
-0.0672607421875,
-0.07666015625,
-0.046661376953125,
-0.015716552734375,
-0.042205810546875,
-0.016448974609375,
0.06927490234375,
0.060028076171875,
-0.07452392578125,
-0.0243377685546875,
-0.0009102821350097656,
0.00807952880859375,
-0.0209503173828125,
-0.021697998046875,
0.03350830078125,
-0.0174102783203125,
-0.06085205078125,
0.0216827392578125,
-0.0038471221923828125,
0.00731658935546875,
-0.0112152099609375,
0.004535675048828125,
-0.0313720703125,
0.009735107421875,
0.046417236328125,
0.012603759765625,
-0.061981201171875,
-0.036468505859375,
0.00724029541015625,
-0.013153076171875,
0.006099700927734375,
0.0325927734375,
-0.04058837890625,
0.028472900390625,
0.031158447265625,
0.030670166015625,
0.043731689453125,
0.00276947021484375,
0.0537109375,
-0.0853271484375,
0.022003173828125,
0.015899658203125,
0.04022216796875,
0.0296783447265625,
-0.033294677734375,
0.03955078125,
0.03253173828125,
-0.03314208984375,
-0.06610107421875,
-0.0004992485046386719,
-0.07330322265625,
-0.0216217041015625,
0.064697265625,
-0.01198577880859375,
-0.0217132568359375,
-0.006145477294921875,
-0.0224609375,
0.0279541015625,
-0.0282440185546875,
0.052978515625,
0.069091796875,
0.00710296630859375,
-0.01279449462890625,
-0.0250244140625,
0.0297393798828125,
0.037322998046875,
-0.034423828125,
-0.027862548828125,
0.010284423828125,
0.031341552734375,
0.017578125,
0.04071044921875,
-0.0064849853515625,
0.008056640625,
0.00913238525390625,
0.0228271484375,
-0.0037994384765625,
-0.01013946533203125,
-0.0192108154296875,
0.0014715194702148438,
-0.01175689697265625,
-0.05242919921875
]
] |
distilbert-base-uncased-finetuned-sst-2-english | 2023-10-26T16:14:11.000Z | [
"transformers",
"pytorch",
"tf",
"rust",
"onnx",
"safetensors",
"distilbert",
"text-classification",
"en",
"dataset:sst2",
"dataset:glue",
"arxiv:1910.01108",
"doi:10.57967/hf/0181",
"license:apache-2.0",
"model-index",
"endpoints_compatible",
"has_space",
"region:us"
] | text-classification | null | null | null | distilbert-base-uncased-finetuned-sst-2-english | 331 | 41,670,892 | transformers | 2022-03-02T23:29:04 | ---
language: en
license: apache-2.0
datasets:
- sst2
- glue
model-index:
- name: distilbert-base-uncased-finetuned-sst-2-english
results:
- task:
type: text-classification
name: Text Classification
dataset:
name: glue
type: glue
config: sst2
split: validation
metrics:
- type: accuracy
value: 0.9105504587155964
name: Accuracy
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiN2YyOGMxYjY2Y2JhMjkxNjIzN2FmMjNiNmM2ZWViNGY3MTNmNWI2YzhiYjYxZTY0ZGUyN2M1NGIxZjRiMjQwZiIsInZlcnNpb24iOjF9.uui0srxV5ZHRhxbYN6082EZdwpnBgubPJ5R2-Wk8HTWqmxYE3QHidevR9LLAhidqGw6Ih93fK0goAXncld_gBg
- type: precision
value: 0.8978260869565218
name: Precision
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiMzgwYTYwYjA2MmM0ZTYwNDk0M2NmNTBkZmM2NGNhYzQ1OGEyN2NkNDQ3Mzc2NTQyMmZiNDJiNzBhNGVhZGUyOSIsInZlcnNpb24iOjF9.eHjLmw3K02OU69R2Au8eyuSqT3aBDHgZCn8jSzE3_urD6EUSSsLxUpiAYR4BGLD_U6-ZKcdxVo_A2rdXqvUJDA
- type: recall
value: 0.9301801801801802
name: Recall
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiMGIzM2E3MTI2Mzc2MDYwNmU3ZTVjYmZmZDBkNjY4ZTc5MGY0Y2FkNDU3NjY1MmVkNmE3Y2QzMzAwZDZhOWY1NiIsInZlcnNpb24iOjF9.PUZlqmct13-rJWBXdHm5tdkXgETL9F82GNbbSR4hI8MB-v39KrK59cqzFC2Ac7kJe_DtOeUyosj34O_mFt_1DQ
- type: auc
value: 0.9716626673402374
name: AUC
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiMDM0YWIwZmQ4YjUwOGZmMWU2MjI1YjIxZGQ2MzNjMzRmZmYxMzZkNGFjODhlMDcyZDM1Y2RkMWZlOWQ0MWYwNSIsInZlcnNpb24iOjF9.E7GRlAXmmpEkTHlXheVkuL1W4WNjv4JO3qY_WCVsTVKiO7bUu0UVjPIyQ6g-J1OxsfqZmW3Leli1wY8vPBNNCQ
- type: f1
value: 0.9137168141592922
name: F1
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiMGU4MjNmOGYwZjZjMDQ1ZTkyZTA4YTc1MWYwOTM0NDM4ZWY1ZGVkNDY5MzNhYTQyZGFlNzIyZmUwMDg3NDU0NyIsInZlcnNpb24iOjF9.mW5ftkq50Se58M-jm6a2Pu93QeKa3MfV7xcBwvG3PSB_KNJxZWTCpfMQp-Cmx_EMlmI2siKOyd8akYjJUrzJCA
- type: loss
value: 0.39013850688934326
name: loss
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiMTZiNzAyZDc0MzUzMmE1MGJiN2JlYzFiODE5ZTNlNGE4MmI4YzRiMTc2ODEzMTUwZmEzOTgxNzc4YjJjZTRmNiIsInZlcnNpb24iOjF9.VqIC7uYC-ZZ8ss9zQOlRV39YVOOLc5R36sIzCcVz8lolh61ux_5djm2XjpP6ARc6KqEnXC4ZtfNXsX2HZfrtCQ
- task:
type: text-classification
name: Text Classification
dataset:
name: sst2
type: sst2
config: default
split: train
metrics:
- type: accuracy
value: 0.9885521685548412
name: Accuracy
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiY2I3NzU3YzhmMDkxZTViY2M3OTY1NmI0ZTdmMDQxNjNjYzJiZmQxNzczM2E4YmExYTY5ODY0NDBkY2I4ZjNkOCIsInZlcnNpb24iOjF9.4Gtk3FeVc9sPWSqZIaeUXJ9oVlPzm-NmujnWpK2y5s1Vhp1l6Y1pK5_78wW0-NxSvQqV6qd5KQf_OAEpVAkQDA
- type: precision
value: 0.9881965062029833
name: Precision Macro
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiZDdlZDMzY2I3MTAwYTljNmM4MGMyMzU2YjAzZDg1NDYwN2ZmM2Y5OWZhMjUyMGJiNjY1YmZiMzFhMDI2ODFhNyIsInZlcnNpb24iOjF9.cqmv6yBxu4St2mykRWrZ07tDsiSLdtLTz2hbqQ7Gm1rMzq9tdlkZ8MyJRxtME_Y8UaOG9rs68pV-gKVUs8wABw
- type: precision
value: 0.9885521685548412
name: Precision Micro
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiZjFlYzAzNmE1YjljNjUwNzBjZjEzZDY0ZDQyMmY5ZWM2OTBhNzNjYjYzYTk1YWE1NjU3YTMxZDQwOTE1Y2FkNyIsInZlcnNpb24iOjF9.jnCHOkUHuAOZZ_ZMVOnetx__OVJCS6LOno4caWECAmfrUaIPnPNV9iJ6izRO3sqkHRmxYpWBb-27GJ4N3LU-BQ
- type: precision
value: 0.9885639626373408
name: Precision Weighted
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiZGUyODFjNjBlNTE2MTY3ZDAxOGU1N2U0YjUyY2NiZjhkOGVmYThjYjBkNGU3NTRkYzkzNDQ2MmMwMjkwMWNiMyIsInZlcnNpb24iOjF9.zTNabMwApiZyXdr76QUn7WgGB7D7lP-iqS3bn35piqVTNsv3wnKjZOaKFVLIUvtBXq4gKw7N2oWxvWc4OcSNDg
- type: recall
value: 0.9886145346602994
name: Recall Macro
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiNTU1YjlhODU3YTkyNTdiZDcwZGFlZDBiYjY0N2NjMGM2NTRiNjQ3MDNjNGMxOWY2ZGQ4NWU1YmMzY2UwZTI3YSIsInZlcnNpb24iOjF9.xaLPY7U-wHsJ3DDui1yyyM-xWjL0Jz5puRThy7fczal9x05eKEQ9s0a_WD-iLmapvJs0caXpV70hDe2NLcs-DA
- type: recall
value: 0.9885521685548412
name: Recall Micro
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiODE0YTU0MDBlOGY4YzU0MjY5MzA3OTk2OGNhOGVkMmU5OGRjZmFiZWI2ZjY5ODEzZTQzMTI0N2NiOTVkNDliYiIsInZlcnNpb24iOjF9.SOt1baTBbuZRrsvGcak2sUwoTrQzmNCbyV2m1_yjGsU48SBH0NcKXicidNBSnJ6ihM5jf_Lv_B5_eOBkLfNWDQ
- type: recall
value: 0.9885521685548412
name: Recall Weighted
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiZWNkNmM0ZGRlNmYxYzIwNDk4OTI5MzIwZWU1NzZjZDVhMDcyNDFlMjBhNDQxODU5OWMwMWNhNGEzNjY3ZGUyOSIsInZlcnNpb24iOjF9.b15Fh70GwtlG3cSqPW-8VEZT2oy0CtgvgEOtWiYonOovjkIQ4RSLFVzVG-YfslaIyfg9RzMWzjhLnMY7Bpn2Aw
- type: f1
value: 0.9884019815052447
name: F1 Macro
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiYmM4NjQ5Yjk5ODRhYTU1MTY3MmRhZDBmODM1NTg3OTFiNWM4NDRmYjI0MzZkNmQ1MzE3MzcxODZlYzBkYTMyYSIsInZlcnNpb24iOjF9.74RaDK8nBVuGRl2Se_-hwQvP6c4lvVxGHpcCWB4uZUCf2_HoC9NT9u7P3pMJfH_tK2cpV7U3VWGgSDhQDi-UBQ
- type: f1
value: 0.9885521685548412
name: F1 Micro
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiZDRmYWRmMmQ0YjViZmQxMzhhYTUyOTE1MTc0ZDU1ZjQyZjFhMDYzYzMzZDE0NzZlYzQyOTBhMTBhNmM5NTlkMiIsInZlcnNpb24iOjF9.VMn_psdAHIZTlW6GbjERZDe8MHhwzJ0rbjV_VJyuMrsdOh5QDmko-wEvaBWNEdT0cEKsbggm-6jd3Gh81PfHAQ
- type: f1
value: 0.9885546181087554
name: F1 Weighted
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiMjUyZWFhZDZhMGQ3MzBmYmRiNDVmN2FkZDBjMjk3ODk0OTAxNGZkMWE0NzU5ZjI0NzE0NGZiNzM0N2Y2NDYyOSIsInZlcnNpb24iOjF9.YsXBhnzEEFEW6jw3mQlFUuIrW7Gabad2Ils-iunYJr-myg0heF8NEnEWABKFE1SnvCWt-69jkLza6SupeyLVCA
- type: loss
value: 0.040652573108673096
name: loss
verified: true
verifyToken: eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJoYXNoIjoiZTc3YjU3MjdjMzkxODA5MjU5NGUyY2NkMGVhZDg3ZWEzMmU1YWVjMmI0NmU2OWEyZTkzMTVjNDZiYTc0YjIyNCIsInZlcnNpb24iOjF9.lA90qXZVYiILHMFlr6t6H81Oe8a-4KmeX-vyCC1BDia2ofudegv6Vb46-4RzmbtuKeV6yy6YNNXxXxqVak1pAg
---
# DistilBERT base uncased finetuned SST-2
## Table of Contents
- [Model Details](#model-details)
- [How to Get Started With the Model](#how-to-get-started-with-the-model)
- [Uses](#uses)
- [Risks, Limitations and Biases](#risks-limitations-and-biases)
- [Training](#training)
## Model Details
**Model Description:** This model is a fine-tune checkpoint of [DistilBERT-base-uncased](https://huggingface.co/distilbert-base-uncased), fine-tuned on SST-2.
This model reaches an accuracy of 91.3 on the dev set (for comparison, Bert bert-base-uncased version reaches an accuracy of 92.7).
- **Developed by:** Hugging Face
- **Model Type:** Text Classification
- **Language(s):** English
- **License:** Apache-2.0
- **Parent Model:** For more details about DistilBERT, we encourage users to check out [this model card](https://huggingface.co/distilbert-base-uncased).
- **Resources for more information:**
- [Model Documentation](https://huggingface.co/docs/transformers/main/en/model_doc/distilbert#transformers.DistilBertForSequenceClassification)
- [DistilBERT paper](https://arxiv.org/abs/1910.01108)
## How to Get Started With the Model
Example of single-label classification:
```python
import torch
from transformers import DistilBertTokenizer, DistilBertForSequenceClassification
tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased")
model = DistilBertForSequenceClassification.from_pretrained("distilbert-base-uncased")
inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
with torch.no_grad():
logits = model(**inputs).logits
predicted_class_id = logits.argmax().item()
model.config.id2label[predicted_class_id]
```
## Uses
#### Direct Use
This model can be used for topic classification. 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 to look for fine-tuned versions on a task that interests you.
#### Misuse and Out-of-scope Use
The model should not be used to intentionally create hostile or alienating environments for people. In addition, the model was not trained to be factual or true representations of people or events, and therefore using the model to generate such content is out-of-scope for the abilities of this model.
## Risks, Limitations and Biases
Based on a few experimentations, we observed that this model could produce biased predictions that target underrepresented populations.
For instance, for sentences like `This film was filmed in COUNTRY`, this binary classification model will give radically different probabilities for the positive label depending on the country (0.89 if the country is France, but 0.08 if the country is Afghanistan) when nothing in the input indicates such a strong semantic shift. In this [colab](https://colab.research.google.com/gist/ageron/fb2f64fb145b4bc7c49efc97e5f114d3/biasmap.ipynb), [Aurélien Géron](https://twitter.com/aureliengeron) made an interesting map plotting these probabilities for each country.
<img src="https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english/resolve/main/map.jpeg" alt="Map of positive probabilities per country." width="500"/>
We strongly advise users to thoroughly probe these aspects on their use-cases in order to evaluate the risks of this model. We recommend looking at the following bias evaluation datasets as a place to start: [WinoBias](https://huggingface.co/datasets/wino_bias), [WinoGender](https://huggingface.co/datasets/super_glue), [Stereoset](https://huggingface.co/datasets/stereoset).
# Training
#### Training Data
The authors use the following Stanford Sentiment Treebank([sst2](https://huggingface.co/datasets/sst2)) corpora for the model.
#### Training Procedure
###### Fine-tuning hyper-parameters
- learning_rate = 1e-5
- batch_size = 32
- warmup = 600
- max_seq_length = 128
- num_train_epochs = 3.0
| 10,458 | [
[
-0.0304412841796875,
-0.05908203125,
0.0137481689453125,
0.012725830078125,
-0.032501220703125,
-0.0002455711364746094,
-0.01410675048828125,
-0.0252838134765625,
0.007808685302734375,
0.032745361328125,
-0.04638671875,
-0.04730224609375,
-0.0693359375,
-0.01554107666015625,
-0.0091705322265625,
0.110595703125,
0.0013370513916015625,
0.01512908935546875,
-0.0000023245811462402344,
0.0007128715515136719,
-0.03240966796875,
-0.0452880859375,
-0.0287322998046875,
-0.0243072509765625,
0.0083465576171875,
0.0231475830078125,
0.045166015625,
0.01399993896484375,
0.0333251953125,
0.0234527587890625,
-0.035552978515625,
-0.01025390625,
-0.04461669921875,
-0.01134490966796875,
-0.01177215576171875,
-0.033233642578125,
-0.039031982421875,
0.0266265869140625,
0.0209503173828125,
0.048187255859375,
-0.0013904571533203125,
0.0230865478515625,
0.008209228515625,
0.043212890625,
-0.02227783203125,
0.0230255126953125,
-0.05328369140625,
-0.004344940185546875,
-0.01861572265625,
0.013153076171875,
-0.036590576171875,
-0.0226287841796875,
0.0309600830078125,
-0.0281219482421875,
0.0301971435546875,
-0.0013256072998046875,
0.08154296875,
0.023590087890625,
-0.036224365234375,
-0.0160980224609375,
-0.0360107421875,
0.05755615234375,
-0.041534423828125,
0.01537322998046875,
0.036102294921875,
0.00759124755859375,
-0.01067352294921875,
-0.05364990234375,
-0.03924560546875,
-0.01116943359375,
-0.0044097900390625,
0.024139404296875,
-0.020233154296875,
-0.003704071044921875,
0.03192138671875,
0.03045654296875,
-0.033447265625,
-0.00772857666015625,
-0.0439453125,
-0.026123046875,
0.043792724609375,
-0.006710052490234375,
0.01412200927734375,
-0.02569580078125,
-0.050262451171875,
-0.01145172119140625,
-0.030792236328125,
0.0003490447998046875,
0.034515380859375,
0.02618408203125,
-0.020721435546875,
0.047821044921875,
-0.01100921630859375,
0.03662109375,
0.030609130859375,
-0.006763458251953125,
0.043670654296875,
-0.0177459716796875,
-0.0171661376953125,
0.01084136962890625,
0.053375244140625,
0.036834716796875,
0.017303466796875,
0.00308990478515625,
0.00411224365234375,
0.01971435546875,
0.00476837158203125,
-0.08001708984375,
-0.0286865234375,
0.01617431640625,
-0.029449462890625,
-0.0404052734375,
0.01032257080078125,
-0.05352783203125,
-0.01064300537109375,
-0.017181396484375,
0.033294677734375,
-0.036407470703125,
-0.03057861328125,
0.0103912353515625,
-0.0252685546875,
0.0018939971923828125,
0.012176513671875,
-0.051025390625,
0.00907135009765625,
0.023590087890625,
0.05853271484375,
-0.0120391845703125,
-0.01264190673828125,
-0.010467529296875,
-0.0164947509765625,
-0.0111236572265625,
0.034759521484375,
-0.011627197265625,
-0.0202789306640625,
-0.0169830322265625,
0.0150299072265625,
0.0089111328125,
-0.0244903564453125,
0.0567626953125,
-0.0298919677734375,
0.0382080078125,
-0.01412200927734375,
-0.033050537109375,
-0.01287078857421875,
0.017059326171875,
-0.047210693359375,
0.08892822265625,
0.02752685546875,
-0.08697509765625,
0.035400390625,
-0.035064697265625,
-0.0281219482421875,
-0.0113677978515625,
0.00911712646484375,
-0.045379638671875,
-0.0032939910888671875,
0.005695343017578125,
0.032989501953125,
-0.00850677490234375,
0.045257568359375,
-0.0203094482421875,
-0.02337646484375,
0.01485443115234375,
-0.0328369140625,
0.09515380859375,
0.0157470703125,
-0.038818359375,
-0.00780487060546875,
-0.055908203125,
-0.0093231201171875,
0.00582122802734375,
-0.0177764892578125,
-0.031768798828125,
-0.0255889892578125,
0.03143310546875,
0.034210205078125,
0.0154266357421875,
-0.048828125,
0.01393890380859375,
-0.0271148681640625,
0.03466796875,
0.051177978515625,
-0.00472259521484375,
0.0323486328125,
-0.005401611328125,
0.0222930908203125,
0.028289794921875,
0.015167236328125,
0.014007568359375,
-0.043853759765625,
-0.0576171875,
-0.0257415771484375,
0.041656494140625,
0.046234130859375,
-0.050567626953125,
0.05218505859375,
-0.0026416778564453125,
-0.05230712890625,
-0.02777099609375,
-0.00029015541076660156,
0.035980224609375,
0.05023193359375,
0.0316162109375,
-0.026763916015625,
-0.0428466796875,
-0.060211181640625,
0.006702423095703125,
-0.0208587646484375,
0.0011844635009765625,
-0.00555419921875,
0.051513671875,
-0.029022216796875,
0.06500244140625,
-0.0517578125,
-0.0286102294921875,
-0.0167999267578125,
0.0185089111328125,
0.0224609375,
0.039581298828125,
0.046234130859375,
-0.06689453125,
-0.036102294921875,
-0.03338623046875,
-0.05487060546875,
0.0048370361328125,
0.0103607177734375,
-0.025177001953125,
0.026336669921875,
0.024261474609375,
-0.04779052734375,
0.033050537109375,
0.031646728515625,
-0.041534423828125,
0.03350830078125,
-0.00241851806640625,
-0.00780487060546875,
-0.10382080078125,
-0.0032501220703125,
0.0218353271484375,
-0.004909515380859375,
-0.049102783203125,
-0.01110076904296875,
0.0018987655639648438,
0.005313873291015625,
-0.0458984375,
0.0401611328125,
-0.028564453125,
0.0224456787109375,
-0.0191497802734375,
-0.013885498046875,
0.006175994873046875,
0.046173095703125,
0.0230560302734375,
0.0419921875,
0.04998779296875,
-0.03265380859375,
0.01343536376953125,
0.03790283203125,
-0.03558349609375,
0.04376220703125,
-0.052337646484375,
-0.0020198822021484375,
-0.0201568603515625,
0.0294952392578125,
-0.064208984375,
-0.01102447509765625,
0.0219573974609375,
-0.040008544921875,
0.042694091796875,
-0.0160980224609375,
-0.03131103515625,
-0.03662109375,
-0.02392578125,
0.016082763671875,
0.0477294921875,
-0.030181884765625,
0.022308349609375,
0.03509521484375,
-0.0091094970703125,
-0.051239013671875,
-0.07342529296875,
-0.0174713134765625,
-0.036224365234375,
-0.036224365234375,
0.0361328125,
-0.007488250732421875,
-0.00966644287109375,
-0.00982666015625,
-0.00688934326171875,
-0.002117156982421875,
-0.00005835294723510742,
0.036712646484375,
0.039459228515625,
0.0052490234375,
0.0166015625,
0.0060577392578125,
-0.01548004150390625,
-0.0026950836181640625,
-0.0162200927734375,
0.03424072265625,
-0.0265045166015625,
0.003032684326171875,
-0.0289306640625,
0.0052490234375,
0.0261688232421875,
0.000583648681640625,
0.053802490234375,
0.060882568359375,
-0.04010009765625,
0.01013946533203125,
-0.039947509765625,
-0.0203857421875,
-0.032012939453125,
0.043121337890625,
-0.0241546630859375,
-0.05706787109375,
0.032257080078125,
-0.0006074905395507812,
-0.0150604248046875,
0.058502197265625,
0.057220458984375,
-0.014190673828125,
0.0662841796875,
0.054473876953125,
-0.01311492919921875,
0.032562255859375,
-0.037322998046875,
0.0011148452758789062,
-0.0638427734375,
-0.0270538330078125,
-0.0255279541015625,
-0.0150146484375,
-0.0693359375,
-0.034759521484375,
0.0170135498046875,
0.024322509765625,
-0.035797119140625,
0.046112060546875,
-0.05279541015625,
0.0242919921875,
0.059661865234375,
0.019317626953125,
0.01050567626953125,
0.01345062255859375,
-0.005603790283203125,
-0.0147705078125,
-0.044769287109375,
-0.0439453125,
0.08917236328125,
0.053802490234375,
0.06817626953125,
-0.00920867919921875,
0.048370361328125,
0.0273895263671875,
0.0227813720703125,
-0.04156494140625,
0.02117919921875,
-0.0192108154296875,
-0.0775146484375,
-0.0248260498046875,
-0.0219879150390625,
-0.052978515625,
0.01062774658203125,
-0.0133819580078125,
-0.054229736328125,
0.02294921875,
0.00423431396484375,
-0.017333984375,
0.0155487060546875,
-0.0589599609375,
0.07366943359375,
-0.0296630859375,
-0.0304412841796875,
0.0164031982421875,
-0.0640869140625,
0.0268402099609375,
0.0006670951843261719,
0.0028896331787109375,
-0.0192108154296875,
0.0233306884765625,
0.06365966796875,
-0.0244598388671875,
0.08111572265625,
-0.0260162353515625,
0.007785797119140625,
0.04095458984375,
-0.0124969482421875,
0.029327392578125,
0.01168060302734375,
-0.01410675048828125,
0.04345703125,
0.0026950836181640625,
-0.0268096923828125,
-0.01534271240234375,
0.04443359375,
-0.0792236328125,
-0.021636962890625,
-0.0611572265625,
-0.029022216796875,
-0.00716400146484375,
0.0161285400390625,
0.052978515625,
0.017608642578125,
-0.0279388427734375,
0.006481170654296875,
0.059906005859375,
-0.0184173583984375,
0.004993438720703125,
0.0254364013671875,
-0.0016355514526367188,
-0.029388427734375,
0.056121826171875,
0.006015777587890625,
0.0179595947265625,
0.0178985595703125,
0.0210113525390625,
-0.0428466796875,
-0.0195770263671875,
-0.03887939453125,
0.0085906982421875,
-0.056549072265625,
-0.02545166015625,
-0.051849365234375,
-0.0269927978515625,
-0.041534423828125,
0.006046295166015625,
-0.0277557373046875,
-0.03662109375,
-0.033782958984375,
-0.0302734375,
0.041656494140625,
0.032073974609375,
-0.005077362060546875,
0.03521728515625,
-0.0217437744140625,
0.0146484375,
0.00865936279296875,
0.025482177734375,
-0.0298004150390625,
-0.06243896484375,
0.0011987686157226562,
0.020843505859375,
-0.03961181640625,
-0.0726318359375,
0.0196533203125,
0.00585174560546875,
0.034820556640625,
0.02764892578125,
0.0187835693359375,
0.032684326171875,
-0.02569580078125,
0.05010986328125,
0.0248260498046875,
-0.0657958984375,
0.057952880859375,
-0.0208892822265625,
0.017547607421875,
0.06439208984375,
0.054595947265625,
-0.0253753662109375,
-0.028350830078125,
-0.0606689453125,
-0.07147216796875,
0.061737060546875,
0.0325927734375,
0.01424407958984375,
0.003993988037109375,
0.017578125,
0.0142822265625,
0.02392578125,
-0.0814208984375,
-0.033172607421875,
-0.037353515625,
-0.0188446044921875,
-0.01522064208984375,
-0.033203125,
-0.007617950439453125,
-0.0372314453125,
0.074462890625,
0.0008111000061035156,
0.024139404296875,
0.0137481689453125,
-0.01001739501953125,
0.0012769699096679688,
0.00891876220703125,
0.032196044921875,
0.0306243896484375,
-0.04931640625,
0.007343292236328125,
0.0155181884765625,
-0.047332763671875,
0.00722503662109375,
0.02850341796875,
-0.0291595458984375,
0.01177215576171875,
0.01216888427734375,
0.07635498046875,
-0.00356292724609375,
-0.032196044921875,
0.042816162109375,
-0.00018918514251708984,
-0.0286712646484375,
-0.0316162109375,
-0.010345458984375,
0.0118255615234375,
0.019256591796875,
0.01334381103515625,
0.008392333984375,
0.01323699951171875,
-0.0540771484375,
0.0184173583984375,
0.0269622802734375,
-0.049285888671875,
-0.007709503173828125,
0.055877685546875,
0.0171661376953125,
-0.00295257568359375,
0.054443359375,
-0.029876708984375,
-0.055267333984375,
0.055267333984375,
0.037139892578125,
0.060699462890625,
-0.006511688232421875,
0.033233642578125,
0.049652099609375,
0.03662109375,
-0.01227569580078125,
0.00835418701171875,
0.01139068603515625,
-0.053802490234375,
-0.006404876708984375,
-0.0614013671875,
-0.01100921630859375,
0.0181427001953125,
-0.05230712890625,
0.034759521484375,
-0.0200347900390625,
-0.032989501953125,
0.00379180908203125,
0.0111236572265625,
-0.060760498046875,
0.0289764404296875,
0.0163421630859375,
0.068359375,
-0.091796875,
0.06689453125,
0.049835205078125,
-0.049652099609375,
-0.046875,
0.0017576217651367188,
0.0037689208984375,
-0.044036865234375,
0.053466796875,
0.033050537109375,
0.018707275390625,
-0.01690673828125,
-0.040313720703125,
-0.06182861328125,
0.08673095703125,
0.01335906982421875,
-0.0443115234375,
0.000010728836059570312,
0.0134429931640625,
0.055999755859375,
-0.0183563232421875,
0.0419921875,
0.0386962890625,
0.0206451416015625,
0.0240936279296875,
-0.06243896484375,
0.008270263671875,
-0.01446533203125,
0.00994110107421875,
-0.0008153915405273438,
-0.0599365234375,
0.06976318359375,
-0.0159759521484375,
-0.00174713134765625,
-0.0101165771484375,
0.048492431640625,
0.024505615234375,
0.032012939453125,
0.035369873046875,
0.053741455078125,
0.0518798828125,
-0.0216522216796875,
0.054443359375,
-0.007328033447265625,
0.045623779296875,
0.09637451171875,
-0.01329803466796875,
0.050628662109375,
0.03338623046875,
-0.0255279541015625,
0.0458984375,
0.0732421875,
-0.0177459716796875,
0.057525634765625,
0.0216064453125,
-0.0021076202392578125,
-0.004894256591796875,
0.003753662109375,
-0.044586181640625,
0.037628173828125,
0.0220184326171875,
-0.036834716796875,
-0.01267242431640625,
0.01259613037109375,
0.01256561279296875,
-0.01318359375,
-0.007266998291015625,
0.044586181640625,
0.0024890899658203125,
-0.05010986328125,
0.0345458984375,
0.00958251953125,
0.07470703125,
-0.038299560546875,
0.00894927978515625,
-0.021087646484375,
0.019866943359375,
-0.00870513916015625,
-0.057037353515625,
0.0212860107421875,
0.00847625732421875,
-0.01922607421875,
-0.01561737060546875,
0.06427001953125,
-0.040374755859375,
-0.06805419921875,
0.0174102783203125,
0.0231170654296875,
0.02392578125,
-0.0185089111328125,
-0.07366943359375,
0.00014388561248779297,
0.00864410400390625,
-0.030364990234375,
0.0216064453125,
0.0306549072265625,
-0.0111083984375,
0.032684326171875,
0.033233642578125,
-0.0095062255859375,
-0.00487518310546875,
-0.0024890899658203125,
0.06512451171875,
-0.032684326171875,
-0.02923583984375,
-0.055389404296875,
0.047088623046875,
-0.015350341796875,
-0.035064697265625,
0.0552978515625,
0.057464599609375,
0.08740234375,
-0.01511383056640625,
0.06683349609375,
-0.02679443359375,
0.0284423828125,
-0.030670166015625,
0.056732177734375,
-0.039093017578125,
-0.00547027587890625,
-0.03533935546875,
-0.0667724609375,
0.0011796951293945312,
0.05523681640625,
-0.021484375,
0.01229095458984375,
0.04522705078125,
0.0584716796875,
-0.008209228515625,
-0.004291534423828125,
0.002288818359375,
0.0205230712890625,
-0.003406524658203125,
0.035919189453125,
0.0455322265625,
-0.0560302734375,
0.03277587890625,
-0.048126220703125,
-0.0374755859375,
-0.018585205078125,
-0.06597900390625,
-0.083984375,
-0.053741455078125,
-0.0467529296875,
-0.05364990234375,
-0.0017614364624023438,
0.06304931640625,
0.057373046875,
-0.06561279296875,
-0.00139617919921875,
-0.004474639892578125,
-0.0022449493408203125,
-0.0035457611083984375,
-0.01812744140625,
0.038055419921875,
0.0008063316345214844,
-0.0692138671875,
-0.0137786865234375,
-0.00855255126953125,
0.0219573974609375,
-0.018829345703125,
-0.003627777099609375,
-0.0206451416015625,
-0.0188140869140625,
0.050537109375,
0.0030879974365234375,
-0.055206298828125,
-0.00493621826171875,
-0.003444671630859375,
-0.018951416015625,
-0.01006317138671875,
0.026580810546875,
-0.04022216796875,
0.032562255859375,
0.031036376953125,
0.0203704833984375,
0.0594482421875,
0.00209808349609375,
0.01154327392578125,
-0.05975341796875,
0.03045654296875,
0.0113067626953125,
0.0228729248046875,
0.024017333984375,
-0.040496826171875,
0.051483154296875,
0.0282440185546875,
-0.033935546875,
-0.0543212890625,
0.00565338134765625,
-0.09527587890625,
-0.0277557373046875,
0.10125732421875,
-0.0024051666259765625,
-0.01116943359375,
0.007293701171875,
-0.0308380126953125,
0.04144287109375,
-0.0261688232421875,
0.06439208984375,
0.0709228515625,
0.0007390975952148438,
0.01092529296875,
-0.042236328125,
0.04046630859375,
0.02276611328125,
-0.04693603515625,
-0.01183319091796875,
0.033447265625,
0.04925537109375,
0.0154571533203125,
0.0498046875,
-0.014129638671875,
0.0005726814270019531,
0.004970550537109375,
0.022705078125,
-0.00225067138671875,
-0.0223846435546875,
-0.0099029541015625,
-0.00858306884765625,
-0.004856109619140625,
-0.0250244140625
]
] |
openai/clip-vit-large-patch14 | 2023-09-15T15:49:35.000Z | [
"transformers",
"pytorch",
"tf",
"jax",
"safetensors",
"clip",
"zero-shot-image-classification",
"vision",
"arxiv:2103.00020",
"arxiv:1908.04913",
"endpoints_compatible",
"has_space",
"region:us"
] | zero-shot-image-classification | openai | null | null | openai/clip-vit-large-patch14 | 676 | 26,212,915 | transformers | 2022-03-02T23:29:05 | ---
tags:
- vision
widget:
- src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/cat-dog-music.png
candidate_labels: playing music, playing sports
example_title: Cat & Dog
---
# Model Card: CLIP
Disclaimer: The model card is taken and modified from the official CLIP repository, it can be found [here](https://github.com/openai/CLIP/blob/main/model-card.md).
## Model Details
The CLIP model was developed by researchers at OpenAI to learn about what contributes to robustness in computer vision tasks. The model was also developed to test the ability of models to generalize to arbitrary image classification tasks in a zero-shot manner. It was not developed for general model deployment - to deploy models like CLIP, researchers will first need to carefully study their capabilities in relation to the specific context they’re being deployed within.
### Model Date
January 2021
### Model Type
The base model uses a ViT-L/14 Transformer architecture as an image encoder and uses a masked self-attention Transformer as a text encoder. These encoders are trained to maximize the similarity of (image, text) pairs via a contrastive loss.
The original implementation had two variants: one using a ResNet image encoder and the other using a Vision Transformer. This repository has the variant with the Vision Transformer.
### Documents
- [Blog Post](https://openai.com/blog/clip/)
- [CLIP Paper](https://arxiv.org/abs/2103.00020)
### Use with Transformers
```python
from PIL import Image
import requests
from transformers import CLIPProcessor, CLIPModel
model = CLIPModel.from_pretrained("openai/clip-vit-large-patch14")
processor = CLIPProcessor.from_pretrained("openai/clip-vit-large-patch14")
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
inputs = processor(text=["a photo of a cat", "a photo of a dog"], images=image, return_tensors="pt", padding=True)
outputs = model(**inputs)
logits_per_image = outputs.logits_per_image # this is the image-text similarity score
probs = logits_per_image.softmax(dim=1) # we can take the softmax to get the label probabilities
```
## Model Use
### Intended Use
The model is intended as a research output for research communities. We hope that this model will enable researchers to better understand and explore zero-shot, arbitrary image classification. We also hope it can be used for interdisciplinary studies of the potential impact of such models - the CLIP paper includes a discussion of potential downstream impacts to provide an example for this sort of analysis.
#### Primary intended uses
The primary intended users of these models are AI researchers.
We primarily imagine the model will be used by researchers to better understand robustness, generalization, and other capabilities, biases, and constraints of computer vision models.
### Out-of-Scope Use Cases
**Any** deployed use case of the model - whether commercial or not - is currently out of scope. Non-deployed use cases such as image search in a constrained environment, are also not recommended unless there is thorough in-domain testing of the model with a specific, fixed class taxonomy. This is because our safety assessment demonstrated a high need for task specific testing especially given the variability of CLIP’s performance with different class taxonomies. This makes untested and unconstrained deployment of the model in any use case currently potentially harmful.
Certain use cases which would fall under the domain of surveillance and facial recognition are always out-of-scope regardless of performance of the model. This is because the use of artificial intelligence for tasks such as these can be premature currently given the lack of testing norms and checks to ensure its fair use.
Since the model has not been purposefully trained in or evaluated on any languages other than English, its use should be limited to English language use cases.
## Data
The model was trained on publicly available image-caption data. This was done through a combination of crawling a handful of websites and using commonly-used pre-existing image datasets such as [YFCC100M](http://projects.dfki.uni-kl.de/yfcc100m/). A large portion of the data comes from our crawling of the internet. This means that the data is more representative of people and societies most connected to the internet which tend to skew towards more developed nations, and younger, male users.
### Data Mission Statement
Our goal with building this dataset was to test out robustness and generalizability in computer vision tasks. As a result, the focus was on gathering large quantities of data from different publicly-available internet data sources. The data was gathered in a mostly non-interventionist manner. However, we only crawled websites that had policies against excessively violent and adult images and allowed us to filter out such content. We do not intend for this dataset to be used as the basis for any commercial or deployed model and will not be releasing the dataset.
## Performance and Limitations
### Performance
We have evaluated the performance of CLIP on a wide range of benchmarks across a variety of computer vision datasets such as OCR to texture recognition to fine-grained classification. The paper describes model performance on the following datasets:
- Food101
- CIFAR10
- CIFAR100
- Birdsnap
- SUN397
- Stanford Cars
- FGVC Aircraft
- VOC2007
- DTD
- Oxford-IIIT Pet dataset
- Caltech101
- Flowers102
- MNIST
- SVHN
- IIIT5K
- Hateful Memes
- SST-2
- UCF101
- Kinetics700
- Country211
- CLEVR Counting
- KITTI Distance
- STL-10
- RareAct
- Flickr30
- MSCOCO
- ImageNet
- ImageNet-A
- ImageNet-R
- ImageNet Sketch
- ObjectNet (ImageNet Overlap)
- Youtube-BB
- ImageNet-Vid
## Limitations
CLIP and our analysis of it have a number of limitations. CLIP currently struggles with respect to certain tasks such as fine grained classification and counting objects. CLIP also poses issues with regards to fairness and bias which we discuss in the paper and briefly in the next section. Additionally, our approach to testing CLIP also has an important limitation- in many cases we have used linear probes to evaluate the performance of CLIP and there is evidence suggesting that linear probes can underestimate model performance.
### Bias and Fairness
We find that the performance of CLIP - and the specific biases it exhibits - can depend significantly on class design and the choices one makes for categories to include and exclude. We tested the risk of certain kinds of denigration with CLIP by classifying images of people from [Fairface](https://arxiv.org/abs/1908.04913) into crime-related and non-human animal categories. We found significant disparities with respect to race and gender. Additionally, we found that these disparities could shift based on how the classes were constructed. (Details captured in the Broader Impacts Section in the paper).
We also tested the performance of CLIP on gender, race and age classification using the Fairface dataset (We default to using race categories as they are constructed in the Fairface dataset.) in order to assess quality of performance across different demographics. We found accuracy >96% across all races for gender classification with ‘Middle Eastern’ having the highest accuracy (98.4%) and ‘White’ having the lowest (96.5%). Additionally, CLIP averaged ~93% for racial classification and ~63% for age classification. Our use of evaluations to test for gender, race and age classification as well as denigration harms is simply to evaluate performance of the model across people and surface potential risks and not to demonstrate an endorsement/enthusiasm for such tasks.
## Feedback
### Where to send questions or comments about the model
Please use [this Google Form](https://forms.gle/Uv7afRH5dvY34ZEs9) | 7,935 | [
[
-0.039031982421875,
-0.0443115234375,
0.0128173828125,
-0.0023288726806640625,
-0.01251983642578125,
-0.019561767578125,
0.001708984375,
-0.054962158203125,
0.0099334716796875,
0.0298919677734375,
-0.0217132568359375,
-0.03155517578125,
-0.048919677734375,
0.00937652587890625,
-0.048370361328125,
0.055267333984375,
-0.004909515380859375,
0.005016326904296875,
-0.023681640625,
-0.025604248046875,
-0.03887939453125,
-0.053131103515625,
-0.0184326171875,
0.012603759765625,
0.0067138671875,
0.01096343994140625,
0.051025390625,
0.065185546875,
0.061859130859375,
0.0171051025390625,
-0.02423095703125,
-0.00868988037109375,
-0.038909912109375,
-0.047515869140625,
-0.02947998046875,
-0.03021240234375,
-0.030181884765625,
0.016021728515625,
0.041168212890625,
0.0281829833984375,
0.00244140625,
0.022796630859375,
0.005565643310546875,
0.0284271240234375,
-0.07135009765625,
-0.003841400146484375,
-0.042724609375,
0.005321502685546875,
-0.021759033203125,
0.01116180419921875,
-0.01328277587890625,
-0.01464080810546875,
0.02423095703125,
-0.0390625,
0.037109375,
-0.00487518310546875,
0.10064697265625,
0.01386260986328125,
-0.012847900390625,
-0.0023479461669921875,
-0.045379638671875,
0.057769775390625,
-0.04400634765625,
0.018402099609375,
0.01763916015625,
0.029754638671875,
0.011016845703125,
-0.06475830078125,
-0.048736572265625,
-0.004779815673828125,
0.0232086181640625,
0.001255035400390625,
-0.0174102783203125,
-0.004337310791015625,
0.032470703125,
0.0380859375,
-0.01238250732421875,
-0.004566192626953125,
-0.05499267578125,
-0.016693115234375,
0.051971435546875,
0.022918701171875,
0.02593994140625,
-0.0178985595703125,
-0.0484619140625,
-0.0362548828125,
-0.034637451171875,
0.041168212890625,
0.029541015625,
0.0074615478515625,
-0.01166534423828125,
0.0496826171875,
-0.003643035888671875,
0.03289794921875,
0.0005292892456054688,
-0.0268707275390625,
0.026641845703125,
-0.036285400390625,
-0.014404296875,
-0.0209197998046875,
0.05841064453125,
0.06390380859375,
0.01366424560546875,
0.016387939453125,
-0.00679779052734375,
0.0164947509765625,
0.0262603759765625,
-0.07135009765625,
-0.01218414306640625,
-0.01555633544921875,
-0.04833984375,
-0.0284271240234375,
0.0217742919921875,
-0.07086181640625,
0.00592041015625,
-0.00928497314453125,
0.0567626953125,
-0.034393310546875,
-0.00577545166015625,
0.01480865478515625,
-0.02490234375,
0.02484130859375,
0.0253753662109375,
-0.051361083984375,
0.029144287109375,
0.0247802734375,
0.08447265625,
-0.03643798828125,
-0.02398681640625,
0.0035343170166015625,
-0.005126953125,
-0.00870513916015625,
0.054779052734375,
-0.029052734375,
-0.0360107421875,
-0.01464080810546875,
0.033905029296875,
-0.00917816162109375,
-0.0469970703125,
0.04473876953125,
-0.016021728515625,
0.0019893646240234375,
-0.0217742919921875,
-0.02984619140625,
-0.04742431640625,
0.02459716796875,
-0.05487060546875,
0.0684814453125,
0.011383056640625,
-0.059844970703125,
0.028961181640625,
-0.054962158203125,
-0.003910064697265625,
-0.00991058349609375,
-0.007671356201171875,
-0.045867919921875,
-0.0218658447265625,
0.030853271484375,
0.02484130859375,
-0.0175933837890625,
0.0285186767578125,
-0.0462646484375,
-0.03790283203125,
0.01425933837890625,
-0.0338134765625,
0.06817626953125,
0.0015306472778320312,
-0.02520751953125,
0.00013267993927001953,
-0.035430908203125,
-0.01331329345703125,
0.027252197265625,
0.0006656646728515625,
-0.01251983642578125,
-0.00811004638671875,
0.0151824951171875,
0.007366180419921875,
-0.00318145751953125,
-0.0526123046875,
0.01025390625,
-0.00640106201171875,
0.041656494140625,
0.052154541015625,
0.007183074951171875,
0.021209716796875,
-0.032562255859375,
0.040130615234375,
-0.001861572265625,
0.05047607421875,
-0.0194091796875,
-0.0396728515625,
-0.037567138671875,
-0.035675048828125,
0.0447998046875,
0.0498046875,
-0.033599853515625,
0.01275634765625,
-0.01073455810546875,
-0.02581787109375,
-0.01378631591796875,
-0.016998291015625,
0.0266876220703125,
0.049957275390625,
0.0263824462890625,
-0.0753173828125,
-0.0311126708984375,
-0.08056640625,
0.01499176025390625,
0.005340576171875,
-0.004283905029296875,
0.053070068359375,
0.0694580078125,
-0.0181884765625,
0.08251953125,
-0.05767822265625,
-0.031951904296875,
-0.0104827880859375,
-0.01021575927734375,
-0.001708984375,
0.038177490234375,
0.072509765625,
-0.07147216796875,
-0.0200653076171875,
-0.04058837890625,
-0.061920166015625,
0.01111602783203125,
0.01515960693359375,
-0.00690460205078125,
0.0033111572265625,
0.0172119140625,
-0.01898193359375,
0.0787353515625,
0.0199432373046875,
-0.004192352294921875,
0.056060791015625,
0.006618499755859375,
0.02203369140625,
-0.045318603515625,
0.0278167724609375,
0.01323699951171875,
-0.01166534423828125,
-0.037261962890625,
0.004192352294921875,
-0.0006690025329589844,
-0.032623291015625,
-0.071044921875,
0.02838134765625,
-0.011016845703125,
-0.00948333740234375,
-0.01222991943359375,
-0.01450347900390625,
0.0242767333984375,
0.054931640625,
0.0106201171875,
0.08270263671875,
0.03790283203125,
-0.05810546875,
-0.0018405914306640625,
0.041534423828125,
-0.03643798828125,
0.041015625,
-0.0731201171875,
-0.003200531005859375,
-0.004535675048828125,
0.00817108154296875,
-0.043487548828125,
-0.0259246826171875,
0.023712158203125,
-0.02703857421875,
0.0162353515625,
-0.01018524169921875,
-0.024383544921875,
-0.0458984375,
-0.042022705078125,
0.05767822265625,
0.03912353515625,
-0.034393310546875,
0.0281829833984375,
0.05487060546875,
0.01445770263671875,
-0.0411376953125,
-0.058837890625,
-0.006103515625,
-0.0159149169921875,
-0.0557861328125,
0.0418701171875,
-0.00008100271224975586,
0.005779266357421875,
0.0101165771484375,
0.00701141357421875,
-0.0240478515625,
0.002086639404296875,
0.03521728515625,
0.03961181640625,
-0.0063018798828125,
-0.0090789794921875,
-0.022918701171875,
0.027435302734375,
-0.005764007568359375,
0.0098419189453125,
0.021148681640625,
-0.01085662841796875,
-0.0265350341796875,
-0.039031982421875,
0.0250396728515625,
0.034820556640625,
-0.0207061767578125,
0.037567138671875,
0.037689208984375,
-0.0211639404296875,
0.008514404296875,
-0.04107666015625,
-0.002811431884765625,
-0.034027099609375,
0.038665771484375,
-0.0095367431640625,
-0.05181884765625,
0.055908203125,
0.0106201171875,
-0.01108551025390625,
0.048187255859375,
0.0233612060546875,
0.0008273124694824219,
0.0654296875,
0.072265625,
0.0028324127197265625,
0.04949951171875,
-0.062286376953125,
-0.0012989044189453125,
-0.07733154296875,
-0.0260162353515625,
-0.0196685791015625,
-0.0165863037109375,
-0.033538818359375,
-0.042938232421875,
0.044830322265625,
0.01358795166015625,
-0.00817108154296875,
0.032073974609375,
-0.05096435546875,
0.034759521484375,
0.04766845703125,
0.034515380859375,
0.0012979507446289062,
-0.006504058837890625,
0.0002951622009277344,
-0.012420654296875,
-0.051727294921875,
-0.038238525390625,
0.08575439453125,
0.05096435546875,
0.05419921875,
-0.016998291015625,
0.0167999267578125,
0.032470703125,
-0.006702423095703125,
-0.057464599609375,
0.041351318359375,
-0.03509521484375,
-0.054718017578125,
-0.01444244384765625,
-0.004497528076171875,
-0.05853271484375,
0.0117340087890625,
-0.01088714599609375,
-0.057037353515625,
0.046539306640625,
0.01038360595703125,
-0.0257415771484375,
0.0516357421875,
-0.04559326171875,
0.07562255859375,
-0.022369384765625,
-0.03338623046875,
0.005584716796875,
-0.049652099609375,
0.04412841796875,
0.0055084228515625,
0.002166748046875,
-0.01611328125,
0.00778961181640625,
0.08294677734375,
-0.04443359375,
0.07135009765625,
-0.00893402099609375,
0.031982421875,
0.056884765625,
-0.01409149169921875,
0.004302978515625,
-0.015869140625,
0.01485443115234375,
0.054168701171875,
0.0212554931640625,
-0.0084991455078125,
-0.0283660888671875,
0.01116180419921875,
-0.055908203125,
-0.03045654296875,
-0.0284423828125,
-0.034088134765625,
0.017303466796875,
0.015533447265625,
0.04217529296875,
0.058258056640625,
-0.0038280487060546875,
0.0125274658203125,
0.047882080078125,
-0.038726806640625,
0.028900146484375,
0.0152740478515625,
-0.021331787109375,
-0.03997802734375,
0.06988525390625,
0.0214080810546875,
0.0166168212890625,
0.0031719207763671875,
0.00666046142578125,
-0.0174102783203125,
-0.03741455078125,
-0.033905029296875,
0.0055999755859375,
-0.056182861328125,
-0.0328369140625,
-0.04168701171875,
-0.0285186767578125,
-0.033905029296875,
-0.0009074211120605469,
-0.03692626953125,
-0.0257720947265625,
-0.048126220703125,
0.016082763671875,
0.01354217529296875,
0.049285888671875,
-0.007602691650390625,
0.0222930908203125,
-0.0474853515625,
0.019256591796875,
0.02947998046875,
0.04052734375,
0.005298614501953125,
-0.053375244140625,
-0.01107025146484375,
0.000002562999725341797,
-0.06719970703125,
-0.060516357421875,
0.03411865234375,
0.02520751953125,
0.04498291015625,
0.02764892578125,
0.00742340087890625,
0.05316162109375,
-0.03271484375,
0.08294677734375,
0.017547607421875,
-0.07275390625,
0.04217529296875,
-0.0236663818359375,
0.016571044921875,
0.052215576171875,
0.037200927734375,
-0.01611328125,
-0.00982666015625,
-0.04180908203125,
-0.068115234375,
0.06060791015625,
0.0099945068359375,
0.003711700439453125,
0.004894256591796875,
0.025543212890625,
0.0016679763793945312,
0.00658416748046875,
-0.05377197265625,
-0.01251983642578125,
-0.038482666015625,
0.004535675048828125,
0.02203369140625,
-0.0330810546875,
0.0018787384033203125,
-0.032196044921875,
0.0311126708984375,
-0.00403594970703125,
0.04296875,
0.041259765625,
-0.01328277587890625,
0.01062774658203125,
-0.007648468017578125,
0.05047607421875,
0.04638671875,
-0.02984619140625,
-0.0176239013671875,
0.019683837890625,
-0.06396484375,
0.0009121894836425781,
-0.01397705078125,
-0.038665771484375,
-0.0035247802734375,
0.024200439453125,
0.07135009765625,
0.01544189453125,
-0.057281494140625,
0.07684326171875,
-0.007297515869140625,
-0.04248046875,
-0.0199127197265625,
0.005950927734375,
-0.041961669921875,
0.010284423828125,
0.0244140625,
0.01678466796875,
0.034942626953125,
-0.039459228515625,
0.030059814453125,
0.03277587890625,
-0.026641845703125,
-0.0290069580078125,
0.058013916015625,
0.01119232177734375,
-0.0156707763671875,
0.038238525390625,
-0.01340484619140625,
-0.07330322265625,
0.0626220703125,
0.030792236328125,
0.050384521484375,
-0.0010805130004882812,
0.01323699951171875,
0.051177978515625,
0.01148223876953125,
-0.0261688232421875,
-0.003635406494140625,
0.0010900497436523438,
-0.04327392578125,
-0.0169525146484375,
-0.031768798828125,
-0.044525146484375,
0.0119171142578125,
-0.07073974609375,
0.032135009765625,
-0.038848876953125,
-0.038787841796875,
-0.00824737548828125,
-0.0207366943359375,
-0.055755615234375,
0.0102691650390625,
0.01198577880859375,
0.0936279296875,
-0.06427001953125,
0.03753662109375,
0.032989501953125,
-0.045562744140625,
-0.061737060546875,
-0.011505126953125,
-0.00778961181640625,
-0.0491943359375,
0.05108642578125,
0.04083251953125,
-0.00028133392333984375,
-0.03607177734375,
-0.07244873046875,
-0.0755615234375,
0.08648681640625,
0.02490234375,
-0.03125,
-0.0069122314453125,
-0.0012636184692382812,
0.026397705078125,
-0.0251922607421875,
0.02838134765625,
0.02508544921875,
-0.0016050338745117188,
0.02593994140625,
-0.089599609375,
-0.0145416259765625,
-0.0132293701171875,
0.0198822021484375,
0.0018024444580078125,
-0.06463623046875,
0.08062744140625,
-0.020843505859375,
-0.033721923828125,
0.004543304443359375,
0.033416748046875,
-0.00485992431640625,
0.0287933349609375,
0.0396728515625,
0.05352783203125,
0.03228759765625,
0.004970550537109375,
0.08209228515625,
-0.0043487548828125,
0.035125732421875,
0.07177734375,
-0.011077880859375,
0.06805419921875,
0.0233612060546875,
-0.027130126953125,
0.0280914306640625,
0.03314208984375,
-0.052490234375,
0.058563232421875,
0.00016570091247558594,
0.01197052001953125,
-0.0032806396484375,
-0.034332275390625,
-0.022796630859375,
0.0543212890625,
0.0024929046630859375,
-0.035736083984375,
-0.00489044189453125,
0.03131103515625,
-0.0190887451171875,
-0.004138946533203125,
-0.03466796875,
0.03448486328125,
-0.012420654296875,
-0.0262451171875,
0.033538818359375,
0.005069732666015625,
0.0728759765625,
-0.0277862548828125,
-0.01198577880859375,
0.0070343017578125,
0.01515960693359375,
-0.00644683837890625,
-0.07257080078125,
0.041961669921875,
0.00447845458984375,
-0.0172882080078125,
0.006832122802734375,
0.056549072265625,
-0.002712249755859375,
-0.04388427734375,
0.016387939453125,
-0.01055908203125,
0.02691650390625,
-0.0079193115234375,
-0.05401611328125,
0.0256805419921875,
0.004856109619140625,
0.0021648406982421875,
0.022705078125,
-0.0013065338134765625,
-0.00858306884765625,
0.05120849609375,
0.0295867919921875,
-0.003814697265625,
0.008392333984375,
-0.026214599609375,
0.08056640625,
-0.04229736328125,
-0.0308685302734375,
-0.052490234375,
0.0269622802734375,
-0.00762176513671875,
-0.0264434814453125,
0.04718017578125,
0.046844482421875,
0.08563232421875,
-0.00942230224609375,
0.042877197265625,
-0.0163726806640625,
0.038787841796875,
-0.0286102294921875,
0.03411865234375,
-0.0404052734375,
-0.0023632049560546875,
-0.033172607421875,
-0.048828125,
-0.0140228271484375,
0.046966552734375,
-0.0306243896484375,
-0.005657196044921875,
0.037628173828125,
0.055633544921875,
-0.01885986328125,
-0.0024852752685546875,
0.0201263427734375,
-0.025634765625,
0.0198822021484375,
0.04681396484375,
0.04669189453125,
-0.06072998046875,
0.053131103515625,
-0.05267333984375,
-0.0174407958984375,
-0.01511383056640625,
-0.06402587890625,
-0.079345703125,
-0.038726806640625,
-0.03271484375,
-0.01049041748046875,
-0.004497528076171875,
0.04412841796875,
0.0738525390625,
-0.054351806640625,
-0.0070343017578125,
0.0255126953125,
-0.0055389404296875,
-0.0005292892456054688,
-0.01861572265625,
0.029144287109375,
0.0160369873046875,
-0.0433349609375,
-0.01500701904296875,
0.00966644287109375,
0.02728271484375,
-0.01396942138671875,
0.009307861328125,
-0.01505279541015625,
-0.0051116943359375,
0.034393310546875,
0.040863037109375,
-0.049957275390625,
-0.0247344970703125,
0.01187896728515625,
0.0032100677490234375,
0.026153564453125,
0.049285888671875,
-0.04876708984375,
0.03326416015625,
0.021240234375,
0.042236328125,
0.05047607421875,
0.0199432373046875,
0.015625,
-0.03289794921875,
0.0162200927734375,
0.0161590576171875,
0.025787353515625,
0.0264434814453125,
-0.0305633544921875,
0.045318603515625,
0.037078857421875,
-0.0498046875,
-0.074951171875,
-0.00237274169921875,
-0.08251953125,
-0.0152435302734375,
0.0677490234375,
-0.031280517578125,
-0.051910400390625,
0.0117950439453125,
-0.0161590576171875,
0.012847900390625,
-0.0274658203125,
0.050323486328125,
0.0301666259765625,
-0.002231597900390625,
-0.02764892578125,
-0.0457763671875,
0.0152435302734375,
0.004451751708984375,
-0.0399169921875,
-0.0297088623046875,
0.027984619140625,
0.044677734375,
0.026336669921875,
0.0361328125,
-0.02630615234375,
0.02960205078125,
0.0032444000244140625,
0.0228424072265625,
-0.0249786376953125,
-0.0296173095703125,
-0.03656005859375,
0.022796630859375,
-0.0216217041015625,
-0.04693603515625
]
] |
gpt2 | 2023-06-30T02:19:43.000Z | [
"transformers",
"pytorch",
"tf",
"jax",
"tflite",
"rust",
"onnx",
"safetensors",
"gpt2",
"text-generation",
"exbert",
"en",
"doi:10.57967/hf/0039",
"license:mit",
"endpoints_compatible",
"has_space",
"text-generation-inference",
"region:us"
] | text-generation | null | null | null | gpt2 | 1,471 | 23,269,709 | transformers | 2022-03-02T23:29:04 | ---
language: en
tags:
- exbert
license: mit
---
# GPT-2
Test the whole generation capabilities here: https://transformer.huggingface.co/doc/gpt2-large
Pretrained model on English language using a causal language modeling (CLM) objective. It was introduced in
[this paper](https://d4mucfpksywv.cloudfront.net/better-language-models/language_models_are_unsupervised_multitask_learners.pdf)
and first released at [this page](https://openai.com/blog/better-language-models/).
Disclaimer: The team releasing GPT-2 also wrote a
[model card](https://github.com/openai/gpt-2/blob/master/model_card.md) for their model. Content from this model card
has been written by the Hugging Face team to complete the information they provided and give specific examples of bias.
## Model description
GPT-2 is a transformers model pretrained on a very large corpus of English data in a self-supervised fashion. 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 trained to guess the next word in sentences.
More precisely, inputs are sequences of continuous text of a certain length and the targets are the same sequence,
shifted one token (word or piece of word) to the right. The model uses internally a mask-mechanism to make sure the
predictions for the token `i` only uses the inputs from `1` to `i` but not the future tokens.
This way, the model learns an inner representation of the English language that can then be used to extract features
useful for downstream tasks. The model is best at what it was pretrained for however, which is generating texts from a
prompt.
This is the **smallest** version of GPT-2, with 124M parameters.
**Related Models:** [GPT-Large](https://huggingface.co/gpt2-large), [GPT-Medium](https://huggingface.co/gpt2-medium) and [GPT-XL](https://huggingface.co/gpt2-xl)
## Intended uses & limitations
You can use the raw model for text generation or fine-tune it to a downstream task. See the
[model hub](https://huggingface.co/models?filter=gpt2) to look for fine-tuned versions on a task that interests you.
### How to use
You can use this model directly with a pipeline for text generation. Since the generation relies on some randomness, we
set a seed for reproducibility:
```python
>>> from transformers import pipeline, set_seed
>>> generator = pipeline('text-generation', model='gpt2')
>>> set_seed(42)
>>> generator("Hello, I'm a language model,", max_length=30, num_return_sequences=5)
[{'generated_text': "Hello, I'm a language model, a language for thinking, a language for expressing thoughts."},
{'generated_text': "Hello, I'm a language model, a compiler, a compiler library, I just want to know how I build this kind of stuff. I don"},
{'generated_text': "Hello, I'm a language model, and also have more than a few of your own, but I understand that they're going to need some help"},
{'generated_text': "Hello, I'm a language model, a system model. I want to know my language so that it might be more interesting, more user-friendly"},
{'generated_text': 'Hello, I\'m a language model, not a language model"\n\nThe concept of "no-tricks" comes in handy later with new'}]
```
Here is how to use this model to get the features of a given text in PyTorch:
```python
from transformers import GPT2Tokenizer, GPT2Model
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
model = GPT2Model.from_pretrained('gpt2')
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
output = model(**encoded_input)
```
and in TensorFlow:
```python
from transformers import GPT2Tokenizer, TFGPT2Model
tokenizer = GPT2Tokenizer.from_pretrained('gpt2')
model = TFGPT2Model.from_pretrained('gpt2')
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='tf')
output = model(encoded_input)
```
### Limitations and bias
The training data used for this model has not been released as a dataset one can browse. We know it contains a lot of
unfiltered content from the internet, which is far from neutral. As the openAI team themselves point out in their
[model card](https://github.com/openai/gpt-2/blob/master/model_card.md#out-of-scope-use-cases):
> Because large-scale language models like GPT-2 do not distinguish fact from fiction, we don’t support use-cases
> that require the generated text to be true.
>
> Additionally, language models like GPT-2 reflect the biases inherent to the systems they were trained on, so we do
> not recommend that they be deployed into systems that interact with humans > unless the deployers first carry out a
> study of biases relevant to the intended use-case. We found no statistically significant difference in gender, race,
> and religious bias probes between 774M and 1.5B, implying all versions of GPT-2 should be approached with similar
> levels of caution around use cases that are sensitive to biases around human attributes.
Here's an example of how the model can have biased predictions:
```python
>>> from transformers import pipeline, set_seed
>>> generator = pipeline('text-generation', model='gpt2')
>>> set_seed(42)
>>> generator("The White man worked as a", max_length=10, num_return_sequences=5)
[{'generated_text': 'The White man worked as a mannequin for'},
{'generated_text': 'The White man worked as a maniser of the'},
{'generated_text': 'The White man worked as a bus conductor by day'},
{'generated_text': 'The White man worked as a plumber at the'},
{'generated_text': 'The White man worked as a journalist. He had'}]
>>> set_seed(42)
>>> generator("The Black man worked as a", max_length=10, num_return_sequences=5)
[{'generated_text': 'The Black man worked as a man at a restaurant'},
{'generated_text': 'The Black man worked as a car salesman in a'},
{'generated_text': 'The Black man worked as a police sergeant at the'},
{'generated_text': 'The Black man worked as a man-eating monster'},
{'generated_text': 'The Black man worked as a slave, and was'}]
```
This bias will also affect all fine-tuned versions of this model.
## Training data
The OpenAI team wanted to train this model on a corpus as large as possible. To build it, they scraped all the web
pages from outbound links on Reddit which received at least 3 karma. Note that all Wikipedia pages were removed from
this dataset, so the model was not trained on any part of Wikipedia. The resulting dataset (called WebText) weights
40GB of texts but has not been publicly released. You can find a list of the top 1,000 domains present in WebText
[here](https://github.com/openai/gpt-2/blob/master/domains.txt).
## Training procedure
### Preprocessing
The texts are tokenized using a byte-level version of Byte Pair Encoding (BPE) (for unicode characters) and a
vocabulary size of 50,257. The inputs are sequences of 1024 consecutive tokens.
The larger model was trained on 256 cloud TPU v3 cores. The training duration was not disclosed, nor were the exact
details of training.
## Evaluation results
The model achieves the following results without any fine-tuning (zero-shot):
| Dataset | LAMBADA | LAMBADA | CBT-CN | CBT-NE | WikiText2 | PTB | enwiki8 | text8 | WikiText103 | 1BW |
|:--------:|:-------:|:-------:|:------:|:------:|:---------:|:------:|:-------:|:------:|:-----------:|:-----:|
| (metric) | (PPL) | (ACC) | (ACC) | (ACC) | (PPL) | (PPL) | (BPB) | (BPC) | (PPL) | (PPL) |
| | 35.13 | 45.99 | 87.65 | 83.4 | 29.41 | 65.85 | 1.16 | 1,17 | 37.50 | 75.20 |
### BibTeX entry and citation info
```bibtex
@article{radford2019language,
title={Language Models are Unsupervised Multitask Learners},
author={Radford, Alec and Wu, Jeff and Child, Rewon and Luan, David and Amodei, Dario and Sutskever, Ilya},
year={2019}
}
```
<a href="https://huggingface.co/exbert/?model=gpt2">
<img width="300px" src="https://cdn-media.huggingface.co/exbert/button.png">
</a>
| 8,090 | [
[
-0.0205841064453125,
-0.055419921875,
0.0232086181640625,
-0.0022525787353515625,
-0.019683837890625,
-0.0235137939453125,
-0.030242919921875,
-0.03985595703125,
-0.00772857666015625,
0.023651123046875,
-0.0361328125,
-0.0206756591796875,
-0.055755615234375,
-0.002529144287109375,
-0.0201873779296875,
0.106689453125,
-0.008941650390625,
0.0010986328125,
0.00606536865234375,
0.00580596923828125,
-0.0267486572265625,
-0.03436279296875,
-0.048095703125,
-0.03436279296875,
0.0239410400390625,
0.00859832763671875,
0.045928955078125,
0.047515869140625,
0.0148468017578125,
0.0142974853515625,
-0.00852203369140625,
0.0029506683349609375,
-0.037384033203125,
-0.01349639892578125,
-0.01503753662109375,
-0.0251312255859375,
-0.0245361328125,
0.0162506103515625,
0.038116455078125,
0.029510498046875,
0.0108795166015625,
0.025665283203125,
0.022308349609375,
0.021881103515625,
-0.0293426513671875,
0.0224456787109375,
-0.041839599609375,
-0.008026123046875,
-0.0286407470703125,
0.0072174072265625,
-0.03131103515625,
-0.00948333740234375,
0.00772857666015625,
-0.037445068359375,
0.031463623046875,
-0.0072174072265625,
0.08953857421875,
0.0188446044921875,
-0.03570556640625,
-0.01480865478515625,
-0.053680419921875,
0.061309814453125,
-0.053497314453125,
0.024169921875,
0.035675048828125,
0.004711151123046875,
-0.00189208984375,
-0.06475830078125,
-0.056121826171875,
-0.01276397705078125,
-0.0224151611328125,
0.019866943359375,
-0.0051116943359375,
-0.00428009033203125,
0.0279998779296875,
0.0230712890625,
-0.06536865234375,
-0.0009450912475585938,
-0.035247802734375,
-0.0229339599609375,
0.036895751953125,
-0.00833892822265625,
0.027252197265625,
-0.0305633544921875,
-0.0275421142578125,
-0.0217437744140625,
-0.04364013671875,
-0.005680084228515625,
0.033416748046875,
0.0197906494140625,
-0.02264404296875,
0.052215576171875,
-0.00015485286712646484,
0.040130615234375,
-0.005100250244140625,
-0.01119232177734375,
0.0254974365234375,
-0.037353515625,
-0.00984954833984375,
-0.0181427001953125,
0.08502197265625,
0.0202484130859375,
0.0340576171875,
-0.00919342041015625,
-0.01561737060546875,
0.00977325439453125,
0.00431060791015625,
-0.068603515625,
-0.0253753662109375,
0.01500701904296875,
-0.0330810546875,
-0.0251312255859375,
0.004619598388671875,
-0.06182861328125,
-0.0035037994384765625,
-0.0118865966796875,
0.0300445556640625,
-0.034637451171875,
-0.0374755859375,
-0.018280029296875,
-0.018035888671875,
0.0181732177734375,
-0.00518798828125,
-0.08123779296875,
0.0112457275390625,
0.045989990234375,
0.0687255859375,
0.0011758804321289062,
-0.03143310546875,
-0.01129150390625,
-0.0021228790283203125,
-0.01041412353515625,
0.037933349609375,
-0.019989013671875,
-0.01055145263671875,
-0.007526397705078125,
0.0011854171752929688,
-0.0047149658203125,
-0.0221710205078125,
0.036224365234375,
-0.0303497314453125,
0.0477294921875,
-0.0174102783203125,
-0.034576416015625,
-0.007129669189453125,
0.0034618377685546875,
-0.036041259765625,
0.0927734375,
0.030242919921875,
-0.07965087890625,
0.0297088623046875,
-0.057769775390625,
-0.03033447265625,
-0.009918212890625,
-0.006992340087890625,
-0.038848876953125,
-0.00429534912109375,
0.01371002197265625,
0.022857666015625,
-0.035736083984375,
0.03131103515625,
-0.0091705322265625,
-0.0164337158203125,
0.0101318359375,
-0.0298614501953125,
0.08355712890625,
0.021636962890625,
-0.0506591796875,
-0.0050048828125,
-0.039154052734375,
0.00658416748046875,
0.03143310546875,
-0.0267181396484375,
-0.01009368896484375,
-0.00502777099609375,
0.0254364013671875,
0.027618408203125,
0.01458740234375,
-0.03900146484375,
0.0175323486328125,
-0.037353515625,
0.050201416015625,
0.046539306640625,
-0.009735107421875,
0.0247039794921875,
-0.01398468017578125,
0.0218963623046875,
-0.0012960433959960938,
0.007171630859375,
-0.0041656494140625,
-0.058868408203125,
-0.05706787109375,
-0.00911712646484375,
0.036285400390625,
0.055877685546875,
-0.059417724609375,
0.034088134765625,
-0.0218505859375,
-0.03692626953125,
-0.03704833984375,
0.0079498291015625,
0.048492431640625,
0.03955078125,
0.033660888671875,
-0.0171966552734375,
-0.044464111328125,
-0.061187744140625,
-0.02178955078125,
-0.025421142578125,
-0.01377105712890625,
0.012603759765625,
0.055633544921875,
-0.0235443115234375,
0.07171630859375,
-0.043121337890625,
-0.01654052734375,
-0.0292510986328125,
0.01532745361328125,
0.0108795166015625,
0.0408935546875,
0.039825439453125,
-0.049346923828125,
-0.038330078125,
-0.00922393798828125,
-0.061737060546875,
-0.006168365478515625,
0.0018301010131835938,
-0.00988006591796875,
0.0247039794921875,
0.0213165283203125,
-0.06744384765625,
0.020965576171875,
0.03717041015625,
-0.0382080078125,
0.05072021484375,
-0.009857177734375,
-0.0201568603515625,
-0.10260009765625,
0.026580810546875,
0.010406494140625,
-0.00942230224609375,
-0.058929443359375,
0.01068878173828125,
0.00328826904296875,
-0.005489349365234375,
-0.02288818359375,
0.06048583984375,
-0.039031982421875,
-0.0005812644958496094,
-0.0152130126953125,
0.00583648681640625,
-0.00921630859375,
0.049896240234375,
0.0011053085327148438,
0.071533203125,
0.0316162109375,
-0.03558349609375,
0.0105438232421875,
0.022735595703125,
-0.0307769775390625,
0.0189666748046875,
-0.05950927734375,
0.0213165283203125,
-0.00861358642578125,
0.0164794921875,
-0.0726318359375,
-0.0285491943359375,
0.0240325927734375,
-0.049041748046875,
0.032440185546875,
-0.01340484619140625,
-0.05047607421875,
-0.042022705078125,
-0.010772705078125,
0.03131103515625,
0.060333251953125,
-0.033416748046875,
0.025726318359375,
0.033721923828125,
-0.01012420654296875,
-0.04302978515625,
-0.062744140625,
-0.004207611083984375,
-0.00882720947265625,
-0.045501708984375,
0.0263519287109375,
0.00659942626953125,
-0.0059051513671875,
-0.00286102294921875,
0.01910400390625,
-0.005161285400390625,
-0.00028252601623535156,
0.0149688720703125,
0.0242156982421875,
-0.01029205322265625,
0.00675201416015625,
0.00034046173095703125,
-0.0135345458984375,
-0.00072479248046875,
-0.0428466796875,
0.0556640625,
0.004116058349609375,
-0.004016876220703125,
-0.03143310546875,
0.0113525390625,
0.0257568359375,
-0.0198211669921875,
0.05462646484375,
0.0775146484375,
-0.035186767578125,
0.00014698505401611328,
-0.033538818359375,
-0.022369384765625,
-0.0309295654296875,
0.05316162109375,
-0.0264129638671875,
-0.068359375,
0.031280517578125,
0.0232391357421875,
0.010284423828125,
0.062042236328125,
0.058135986328125,
0.01235198974609375,
0.0797119140625,
0.03936767578125,
-0.0092010498046875,
0.0316162109375,
-0.03118896484375,
0.01305389404296875,
-0.06951904296875,
-0.01526641845703125,
-0.03277587890625,
-0.01007843017578125,
-0.05926513671875,
-0.0308685302734375,
0.018035888671875,
0.017333984375,
-0.035400390625,
0.037109375,
-0.047607421875,
0.02606201171875,
0.057708740234375,
0.005985260009765625,
-0.0017347335815429688,
0.00853729248046875,
-0.01529693603515625,
-0.0002799034118652344,
-0.040985107421875,
-0.03985595703125,
0.09881591796875,
0.033660888671875,
0.032012939453125,
0.0021800994873046875,
0.032867431640625,
0.002437591552734375,
0.025177001953125,
-0.039154052734375,
0.0267486572265625,
-0.0213165283203125,
-0.063720703125,
-0.0244140625,
-0.03851318359375,
-0.06903076171875,
0.0177459716796875,
-0.002300262451171875,
-0.06890869140625,
-0.004901885986328125,
0.01434326171875,
-0.01422119140625,
0.0301666259765625,
-0.0625,
0.07781982421875,
-0.0145721435546875,
-0.0272064208984375,
0.00337982177734375,
-0.05352783203125,
0.0345458984375,
-0.0011358261108398438,
0.00579833984375,
0.010345458984375,
0.0069732666015625,
0.0694580078125,
-0.047943115234375,
0.07037353515625,
-0.0227203369140625,
-0.0004489421844482422,
0.038848876953125,
-0.006763458251953125,
0.041015625,
-0.0034027099609375,
0.0026340484619140625,
0.029144287109375,
-0.0170440673828125,
-0.031768798828125,
-0.0206756591796875,
0.046600341796875,
-0.0909423828125,
-0.0278778076171875,
-0.033966064453125,
-0.036224365234375,
0.0036945343017578125,
0.0300445556640625,
0.056060791015625,
0.03045654296875,
-0.006622314453125,
-0.00734710693359375,
0.03173828125,
-0.0187225341796875,
0.03448486328125,
0.0118560791015625,
-0.009552001953125,
-0.034088134765625,
0.0660400390625,
0.01242828369140625,
0.0206451416015625,
0.0272979736328125,
0.0162506103515625,
-0.038116455078125,
-0.0276336669921875,
-0.0467529296875,
0.033660888671875,
-0.04229736328125,
-0.00782012939453125,
-0.06231689453125,
-0.02655029296875,
-0.048675537109375,
0.017822265625,
-0.0226287841796875,
-0.034515380859375,
-0.0304412841796875,
-0.01229095458984375,
0.02239990234375,
0.065185546875,
0.0032024383544921875,
0.0303802490234375,
-0.03564453125,
0.0169219970703125,
0.031005859375,
0.0284881591796875,
0.0007696151733398438,
-0.056243896484375,
-0.01425933837890625,
0.018585205078125,
-0.037017822265625,
-0.0635986328125,
0.0263519287109375,
0.006893157958984375,
0.0270538330078125,
0.0221405029296875,
-0.01470947265625,
0.033203125,
-0.03436279296875,
0.0809326171875,
0.01435089111328125,
-0.0631103515625,
0.03851318359375,
-0.0301666259765625,
0.0220947265625,
0.02569580078125,
0.019775390625,
-0.039581298828125,
-0.0216522216796875,
-0.050537109375,
-0.066162109375,
0.07012939453125,
0.0343017578125,
0.0135650634765625,
-0.005016326904296875,
0.032135009765625,
0.004787445068359375,
0.0086822509765625,
-0.08001708984375,
-0.02996826171875,
-0.040863037109375,
-0.0238037109375,
-0.015625,
-0.03387451171875,
0.0050811767578125,
-0.0159912109375,
0.061187744140625,
-0.0033359527587890625,
0.049652099609375,
0.00977325439453125,
-0.01934814453125,
0.003559112548828125,
0.012237548828125,
0.050262451171875,
0.04022216796875,
-0.006237030029296875,
0.00897216796875,
0.007465362548828125,
-0.05419921875,
0.0005121231079101562,
0.0174713134765625,
-0.035797119140625,
0.0010805130004882812,
0.0278778076171875,
0.08660888671875,
-0.013153076171875,
-0.0283203125,
0.047882080078125,
0.00905609130859375,
-0.021759033203125,
-0.028961181640625,
-0.0006647109985351562,
0.00553131103515625,
0.01026153564453125,
0.017913818359375,
-0.0037593841552734375,
-0.0063018798828125,
-0.040191650390625,
0.01206207275390625,
0.02490234375,
-0.02978515625,
-0.039215087890625,
0.07501220703125,
0.006557464599609375,
-0.02197265625,
0.0623779296875,
-0.037017822265625,
-0.049713134765625,
0.04296875,
0.0546875,
0.07305908203125,
-0.00983428955078125,
0.02197265625,
0.049530029296875,
0.032379150390625,
-0.017333984375,
0.01483154296875,
0.015533447265625,
-0.054595947265625,
-0.0390625,
-0.048126220703125,
0.0031757354736328125,
0.0357666015625,
-0.0287017822265625,
0.022735595703125,
-0.0279693603515625,
-0.0236358642578125,
-0.005878448486328125,
0.005031585693359375,
-0.0606689453125,
0.018646240234375,
0.006175994873046875,
0.05767822265625,
-0.07000732421875,
0.07080078125,
0.0521240234375,
-0.05267333984375,
-0.07177734375,
0.00965118408203125,
-0.0017976760864257812,
-0.06536865234375,
0.04901123046875,
0.0238037109375,
0.03106689453125,
0.004093170166015625,
-0.03955078125,
-0.0662841796875,
0.087890625,
0.0225830078125,
-0.0282440185546875,
-0.0204010009765625,
0.0265655517578125,
0.04644775390625,
-0.00917816162109375,
0.053863525390625,
0.04302978515625,
0.037353515625,
-0.01335906982421875,
-0.0789794921875,
0.021728515625,
-0.0254058837890625,
0.0142822265625,
0.0168914794921875,
-0.058746337890625,
0.08966064453125,
-0.0184783935546875,
-0.01197052001953125,
0.00658416748046875,
0.042633056640625,
0.008331298828125,
0.0028705596923828125,
0.031280517578125,
0.0504150390625,
0.052215576171875,
-0.023101806640625,
0.097412109375,
-0.02490234375,
0.052978515625,
0.08135986328125,
0.0054473876953125,
0.048614501953125,
0.023193359375,
-0.0216522216796875,
0.0362548828125,
0.047088623046875,
-0.01110076904296875,
0.042205810546875,
0.005023956298828125,
0.0028228759765625,
0.001972198486328125,
-0.0016756057739257812,
-0.031158447265625,
0.0296630859375,
0.00765228271484375,
-0.04022216796875,
-0.0089263916015625,
-0.00250244140625,
0.03302001953125,
-0.0220489501953125,
-0.00409698486328125,
0.055328369140625,
0.007049560546875,
-0.06597900390625,
0.0511474609375,
0.023681640625,
0.05902099609375,
-0.044281005859375,
0.01258087158203125,
-0.01058197021484375,
0.0197906494140625,
-0.01107025146484375,
-0.059661865234375,
0.01342010498046875,
0.00861358642578125,
-0.0251312255859375,
-0.01215362548828125,
0.0552978515625,
-0.042755126953125,
-0.032958984375,
0.020721435546875,
0.0333251953125,
0.023681640625,
-0.0171966552734375,
-0.056549072265625,
-0.01434326171875,
0.01403045654296875,
-0.034912109375,
0.0294952392578125,
0.02099609375,
-0.005584716796875,
0.028656005859375,
0.049713134765625,
0.006587982177734375,
0.0019588470458984375,
0.0077056884765625,
0.056610107421875,
-0.044403076171875,
-0.03466796875,
-0.07073974609375,
0.04498291015625,
-0.0069732666015625,
-0.0430908203125,
0.050506591796875,
0.04949951171875,
0.07843017578125,
-0.01134490966796875,
0.07781982421875,
-0.0280609130859375,
0.03387451171875,
-0.03143310546875,
0.0582275390625,
-0.03948974609375,
-0.0054473876953125,
-0.0185546875,
-0.0771484375,
-0.0038623809814453125,
0.048431396484375,
-0.0253448486328125,
0.0269927978515625,
0.05682373046875,
0.066650390625,
-0.00882720947265625,
-0.006984710693359375,
0.001216888427734375,
0.0290985107421875,
0.0251312255859375,
0.0511474609375,
0.034820556640625,
-0.0496826171875,
0.053253173828125,
-0.0267181396484375,
-0.0245361328125,
-0.004924774169921875,
-0.045318603515625,
-0.0787353515625,
-0.050079345703125,
-0.0148773193359375,
-0.044403076171875,
0.0020351409912109375,
0.06475830078125,
0.051483154296875,
-0.06646728515625,
-0.017364501953125,
-0.0182647705078125,
-0.006923675537109375,
-0.0117950439453125,
-0.021881103515625,
0.037567138671875,
-0.0181427001953125,
-0.05859375,
-0.0011777877807617188,
-0.00978851318359375,
0.0152587890625,
-0.0199127197265625,
-0.01337432861328125,
-0.016571044921875,
-0.01430511474609375,
0.0411376953125,
0.01568603515625,
-0.05206298828125,
-0.027740478515625,
-0.002899169921875,
-0.01580810546875,
-0.00455474853515625,
0.0511474609375,
-0.04278564453125,
0.0190582275390625,
0.039154052734375,
0.032196044921875,
0.045379638671875,
-0.00853729248046875,
0.0333251953125,
-0.055816650390625,
0.016357421875,
-0.000751495361328125,
0.0252532958984375,
0.0281524658203125,
-0.0308990478515625,
0.04632568359375,
0.036895751953125,
-0.04754638671875,
-0.05328369140625,
0.01349639892578125,
-0.05731201171875,
-0.0213165283203125,
0.10992431640625,
-0.0090179443359375,
-0.01275634765625,
-0.0022792816162109375,
-0.01425933837890625,
0.048583984375,
-0.028839111328125,
0.051361083984375,
0.05181884765625,
0.01250457763671875,
-0.006809234619140625,
-0.053466796875,
0.043365478515625,
0.0236053466796875,
-0.052001953125,
0.00379180908203125,
0.016326904296875,
0.045257568359375,
0.01727294921875,
0.05682373046875,
-0.01038360595703125,
0.00321197509765625,
0.0033664703369140625,
0.0164337158203125,
-0.007709503173828125,
-0.012603759765625,
-0.01180267333984375,
0.0037403106689453125,
-0.00577545166015625,
-0.0106964111328125
]
] |
tiiuae/falcon-7b-instruct | 2023-09-29T14:32:23.000Z | [
"transformers",
"pytorch",
"coreml",
"falcon",
"text-generation",
"custom_code",
"en",
"dataset:tiiuae/falcon-refinedweb",
"arxiv:2205.14135",
"arxiv:1911.02150",
"arxiv:2005.14165",
"arxiv:2104.09864",
"arxiv:2306.01116",
"license:apache-2.0",
"endpoints_compatible",
"has_space",
"text-generation-inference",
"region:us"
] | text-generation | tiiuae | null | null | tiiuae/falcon-7b-instruct | 710 | 15,487,847 | transformers | 2023-04-25T06:21:01 | ---
datasets:
- tiiuae/falcon-refinedweb
language:
- en
inference: true
widget:
- text: "Hey Falcon! Any recommendations for my holidays in Abu Dhabi?"
example_title: "Abu Dhabi Trip"
- text: "What's the Everett interpretation of quantum mechanics?"
example_title: "Q/A: Quantum & Answers"
- text: "Give me a list of the top 10 dive sites you would recommend around the world."
example_title: "Diving Top 10"
- text: "Can you tell me more about deep-water soloing?"
example_title: "Extreme sports"
- text: "Can you write a short tweet about the Apache 2.0 release of our latest AI model, Falcon LLM?"
example_title: "Twitter Helper"
- text: "What are the responsabilities of a Chief Llama Officer?"
example_title: "Trendy Jobs"
license: apache-2.0
---
# ✨ Falcon-7B-Instruct
**Falcon-7B-Instruct is a 7B parameters causal decoder-only model built by [TII](https://www.tii.ae) based on [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b) and finetuned on a mixture of chat/instruct datasets. It is made available under the Apache 2.0 license.**
*Paper coming soon 😊.*
🤗 To get started with Falcon (inference, finetuning, quantization, etc.), we recommend reading [this great blogpost fron HF](https://huggingface.co/blog/falcon)!
## Why use Falcon-7B-Instruct?
* **You are looking for a ready-to-use chat/instruct model based on [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).**
* **Falcon-7B is a strong base model, outperforming comparable open-source models** (e.g., [MPT-7B](https://huggingface.co/mosaicml/mpt-7b), [StableLM](https://github.com/Stability-AI/StableLM), [RedPajama](https://huggingface.co/togethercomputer/RedPajama-INCITE-Base-7B-v0.1) etc.), thanks to being trained on 1,500B tokens of [RefinedWeb](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) enhanced with curated corpora. See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard).
* **It features an architecture optimized for inference**, with FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135)) and multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)).
💬 **This is an instruct model, which may not be ideal for further finetuning.** If you are interested in building your own instruct/chat model, we recommend starting from [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
🔥 **Looking for an even more powerful model?** [Falcon-40B-Instruct](https://huggingface.co/tiiuae/falcon-40b-instruct) is Falcon-7B-Instruct's big brother!
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers
import torch
model = "tiiuae/falcon-7b-instruct"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
device_map="auto",
)
sequences = pipeline(
"Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:",
max_length=200,
do_sample=True,
top_k=10,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
)
for seq in sequences:
print(f"Result: {seq['generated_text']}")
```
💥 **Falcon LLMs require PyTorch 2.0 for use with `transformers`!**
For fast inference with Falcon, check-out [Text Generation Inference](https://github.com/huggingface/text-generation-inference)! Read more in this [blogpost]((https://huggingface.co/blog/falcon).
You will need **at least 16GB of memory** to swiftly run inference with Falcon-7B-Instruct.
# Model Card for Falcon-7B-Instruct
## Model Details
### Model Description
- **Developed by:** [https://www.tii.ae](https://www.tii.ae);
- **Model type:** Causal decoder-only;
- **Language(s) (NLP):** English and French;
- **License:** Apache 2.0;
- **Finetuned from model:** [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
### Model Source
- **Paper:** *coming soon*.
## Uses
### Direct Use
Falcon-7B-Instruct has been finetuned on a mixture of instruct and chat datasets.
### Out-of-Scope Use
Production use without adequate assessment of risks and mitigation; any use cases which may be considered irresponsible or harmful.
## Bias, Risks, and Limitations
Falcon-7B-Instruct is mostly trained on English data, and will not generalize appropriately to other languages. Furthermore, as it is trained on a large-scale corpora representative of the web, it will carry the stereotypes and biases commonly encountered online.
### Recommendations
We recommend users of Falcon-7B-Instruct to develop guardrails and to take appropriate precautions for any production use.
## How to Get Started with the Model
```python
from transformers import AutoTokenizer, AutoModelForCausalLM
import transformers
import torch
model = "tiiuae/falcon-7b-instruct"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
"text-generation",
model=model,
tokenizer=tokenizer,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
device_map="auto",
)
sequences = pipeline(
"Girafatron is obsessed with giraffes, the most glorious animal on the face of this Earth. Giraftron believes all other animals are irrelevant when compared to the glorious majesty of the giraffe.\nDaniel: Hello, Girafatron!\nGirafatron:",
max_length=200,
do_sample=True,
top_k=10,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
)
for seq in sequences:
print(f"Result: {seq['generated_text']}")
```
## Training Details
### Training Data
Falcon-7B-Instruct was finetuned on a 250M tokens mixture of instruct/chat datasets.
| **Data source** | **Fraction** | **Tokens** | **Description** |
|--------------------|--------------|------------|-----------------------------------|
| [Bai ze](https://github.com/project-baize/baize-chatbot) | 65% | 164M | chat |
| [GPT4All](https://github.com/nomic-ai/gpt4all) | 25% | 62M | instruct |
| [GPTeacher](https://github.com/teknium1/GPTeacher) | 5% | 11M | instruct |
| [RefinedWeb-English](https://huggingface.co/datasets/tiiuae/falcon-refinedweb) | 5% | 13M | massive web crawl |
The data was tokenized with the Falcon-[7B](https://huggingface.co/tiiuae/falcon-7b)/[40B](https://huggingface.co/tiiuae/falcon-40b) tokenizer.
## Evaluation
*Paper coming soon.*
See the [OpenLLM Leaderboard](https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard) for early results.
Note that this model variant is not optimized for NLP benchmarks.
## Technical Specifications
For more information about pretraining, see [Falcon-7B](https://huggingface.co/tiiuae/falcon-7b).
### Model Architecture and Objective
Falcon-7B is a causal decoder-only model trained on a causal language modeling task (i.e., predict the next token).
The architecture is broadly adapted from the GPT-3 paper ([Brown et al., 2020](https://arxiv.org/abs/2005.14165)), with the following differences:
* **Positionnal embeddings:** rotary ([Su et al., 2021](https://arxiv.org/abs/2104.09864));
* **Attention:** multiquery ([Shazeer et al., 2019](https://arxiv.org/abs/1911.02150)) and FlashAttention ([Dao et al., 2022](https://arxiv.org/abs/2205.14135));
* **Decoder-block:** parallel attention/MLP with a single layer norm.
| **Hyperparameter** | **Value** | **Comment** |
|--------------------|-----------|----------------------------------------|
| Layers | 32 | |
| `d_model` | 4544 | Increased to compensate for multiquery |
| `head_dim` | 64 | Reduced to optimise for FlashAttention |
| Vocabulary | 65024 | |
| Sequence length | 2048 | |
### Compute Infrastructure
#### Hardware
Falcon-7B-Instruct was trained on AWS SageMaker, on 32 A100 40GB GPUs in P4d instances.
#### Software
Falcon-7B-Instruct was trained a custom distributed training codebase, Gigatron. It uses a 3D parallelism approach combined with ZeRO and high-performance Triton kernels (FlashAttention, etc.)
## Citation
*Paper coming soon* 😊. In the meanwhile, you can use the following information to cite:
```
@article{falcon40b,
title={{Falcon-40B}: an open large language model with state-of-the-art performance},
author={Almazrouei, Ebtesam and Alobeidli, Hamza and Alshamsi, Abdulaziz and Cappelli, Alessandro and Cojocaru, Ruxandra and Debbah, Merouane and Goffinet, Etienne and Heslow, Daniel and Launay, Julien and Malartic, Quentin and Noune, Badreddine and Pannier, Baptiste and Penedo, Guilherme},
year={2023}
}
```
To learn more about the pretraining dataset, see the 📓 [RefinedWeb paper](https://arxiv.org/abs/2306.01116).
```
@article{refinedweb,
title={The {R}efined{W}eb dataset for {F}alcon {LLM}: outperforming curated corpora with web data, and web data only},
author={Guilherme Penedo and Quentin Malartic and Daniel Hesslow and Ruxandra Cojocaru and Alessandro Cappelli and Hamza Alobeidli and Baptiste Pannier and Ebtesam Almazrouei and Julien Launay},
journal={arXiv preprint arXiv:2306.01116},
eprint={2306.01116},
eprinttype = {arXiv},
url={https://arxiv.org/abs/2306.01116},
year={2023}
}
```
## License
Falcon-7B-Instruct is made available under the Apache 2.0 license.
## Contact
falconllm@tii.ae | 9,798 | [
[
-0.035675048828125,
-0.07257080078125,
0.005641937255859375,
0.02783203125,
-0.00731658935546875,
-0.007244110107421875,
-0.00921630859375,
-0.034698486328125,
0.01654052734375,
0.0285797119140625,
-0.0340576171875,
-0.036224365234375,
-0.056793212890625,
0.005584716796875,
-0.029632568359375,
0.07391357421875,
0.0185546875,
-0.01132965087890625,
0.01439666748046875,
0.0033054351806640625,
-0.0215606689453125,
-0.040740966796875,
-0.0723876953125,
-0.0012559890747070312,
0.02923583984375,
0.0176544189453125,
0.044677734375,
0.06719970703125,
0.050567626953125,
0.0301361083984375,
-0.019012451171875,
0.018310546875,
-0.043182373046875,
-0.01453399658203125,
-0.0011606216430664062,
-0.0210113525390625,
-0.0201873779296875,
-0.002376556396484375,
0.056304931640625,
0.035980224609375,
0.0012912750244140625,
0.0177459716796875,
-0.0020427703857421875,
0.037139892578125,
-0.0462646484375,
0.041900634765625,
-0.042388916015625,
-0.0084228515625,
-0.01849365234375,
0.01047515869140625,
-0.03887939453125,
0.006755828857421875,
-0.02191162109375,
-0.060791015625,
0.0172271728515625,
0.0190277099609375,
0.09228515625,
0.0252685546875,
-0.0286712646484375,
-0.019683837890625,
-0.031280517578125,
0.0516357421875,
-0.06573486328125,
0.0311737060546875,
0.01358795166015625,
0.0288848876953125,
-0.0307464599609375,
-0.081298828125,
-0.039825439453125,
-0.0136260986328125,
-0.0034885406494140625,
0.0240631103515625,
-0.01026153564453125,
0.00844573974609375,
0.035003662109375,
0.01308441162109375,
-0.0306243896484375,
0.00055694580078125,
-0.037689208984375,
-0.01514434814453125,
0.043548583984375,
-0.0008268356323242188,
0.018218994140625,
-0.0235748291015625,
-0.0252227783203125,
-0.0226287841796875,
-0.0274810791015625,
0.018310546875,
0.0296783447265625,
0.027923583984375,
-0.0215606689453125,
0.03570556640625,
-0.022186279296875,
0.043060302734375,
0.035491943359375,
-0.005428314208984375,
0.03033447265625,
-0.0252227783203125,
-0.03240966796875,
0.0027713775634765625,
0.08831787109375,
0.014678955078125,
0.006198883056640625,
-0.0086669921875,
0.0016908645629882812,
0.002864837646484375,
0.0086669921875,
-0.072998046875,
0.01103973388671875,
0.0172576904296875,
-0.040191650390625,
-0.023712158203125,
0.0269317626953125,
-0.052642822265625,
-0.005260467529296875,
0.0091094970703125,
0.01480865478515625,
-0.037384033203125,
-0.0297088623046875,
0.0190582275390625,
-0.01189422607421875,
0.01439666748046875,
-0.004276275634765625,
-0.06085205078125,
0.0141754150390625,
0.04730224609375,
0.06640625,
0.01045989990234375,
-0.048614501953125,
-0.05609130859375,
0.003551483154296875,
-0.0200653076171875,
0.043060302734375,
-0.03656005859375,
-0.0239715576171875,
-0.007511138916015625,
0.023681640625,
-0.02777099609375,
-0.01201629638671875,
0.0628662109375,
-0.0278778076171875,
0.020751953125,
-0.0263214111328125,
-0.048248291015625,
-0.030487060546875,
-0.0022220611572265625,
-0.04266357421875,
0.07257080078125,
-0.0035610198974609375,
-0.08270263671875,
0.01532745361328125,
-0.067138671875,
-0.0206756591796875,
-0.0160980224609375,
-0.0005135536193847656,
-0.03369140625,
-0.01169586181640625,
0.034454345703125,
0.04852294921875,
-0.0267791748046875,
0.037933349609375,
-0.04949951171875,
-0.044647216796875,
-0.0006413459777832031,
-0.0174407958984375,
0.0665283203125,
0.041046142578125,
-0.042388916015625,
0.011138916015625,
-0.042816162109375,
-0.018280029296875,
0.015655517578125,
0.0002598762512207031,
0.01230621337890625,
-0.0013065338134765625,
0.0026988983154296875,
0.0211944580078125,
0.004810333251953125,
-0.043609619140625,
0.004596710205078125,
-0.046661376953125,
0.0445556640625,
0.0294342041015625,
-0.0017299652099609375,
0.027740478515625,
-0.037933349609375,
0.02752685546875,
0.036224365234375,
0.0259246826171875,
-0.0191650390625,
-0.045867919921875,
-0.07440185546875,
-0.0222625732421875,
0.008941650390625,
0.03021240234375,
-0.054046630859375,
0.035064697265625,
-0.010986328125,
-0.04864501953125,
-0.03509521484375,
-0.01666259765625,
0.037841796875,
0.04986572265625,
0.037628173828125,
0.010650634765625,
-0.049224853515625,
-0.060089111328125,
-0.005825042724609375,
-0.020751953125,
0.0218353271484375,
0.01041412353515625,
0.04400634765625,
-0.0250701904296875,
0.0477294921875,
-0.020538330078125,
-0.019012451171875,
-0.018096923828125,
0.005260467529296875,
0.026031494140625,
0.040374755859375,
0.058929443359375,
-0.039093017578125,
-0.022552490234375,
-0.004833221435546875,
-0.07080078125,
-0.005161285400390625,
-0.01468658447265625,
-0.026397705078125,
0.034393310546875,
0.044677734375,
-0.058837890625,
0.027801513671875,
0.0240325927734375,
-0.0262451171875,
0.02777099609375,
0.00159454345703125,
0.014801025390625,
-0.0970458984375,
0.0160369873046875,
0.011566162109375,
0.00780487060546875,
-0.03564453125,
0.0146636962890625,
-0.00020802021026611328,
-0.00234222412109375,
-0.0482177734375,
0.059844970703125,
-0.040191650390625,
-0.00006866455078125,
-0.007175445556640625,
-0.006175994873046875,
-0.0118560791015625,
0.050262451171875,
0.0058746337890625,
0.06207275390625,
0.044647216796875,
-0.03021240234375,
0.0020694732666015625,
0.029327392578125,
-0.002063751220703125,
0.0085601806640625,
-0.063232421875,
0.0018815994262695312,
-0.0085296630859375,
0.0290679931640625,
-0.065185546875,
-0.0198516845703125,
0.03997802734375,
-0.053009033203125,
0.024017333984375,
-0.01824951171875,
-0.0306854248046875,
-0.0421142578125,
-0.016387939453125,
0.0019092559814453125,
0.038299560546875,
-0.0421142578125,
0.035491943359375,
0.0201416015625,
0.00835418701171875,
-0.072998046875,
-0.046630859375,
0.00370025634765625,
-0.022003173828125,
-0.0621337890625,
0.02197265625,
-0.00128936767578125,
0.00499725341796875,
-0.0046844482421875,
0.0118560791015625,
0.006603240966796875,
0.004299163818359375,
0.042388916015625,
0.01398468017578125,
-0.0220489501953125,
-0.00563812255859375,
0.0100555419921875,
-0.00787353515625,
0.0052032470703125,
-0.0226593017578125,
0.03643798828125,
-0.047149658203125,
-0.0214080810546875,
-0.03411865234375,
0.02734375,
0.041534423828125,
-0.015899658203125,
0.06500244140625,
0.07916259765625,
-0.02484130859375,
0.006832122802734375,
-0.04986572265625,
-0.0088043212890625,
-0.03863525390625,
0.0333251953125,
-0.035247802734375,
-0.065673828125,
0.052215576171875,
0.0177764892578125,
0.004119873046875,
0.06634521484375,
0.035858154296875,
0.00894927978515625,
0.08367919921875,
0.0247802734375,
-0.0103759765625,
0.03533935546875,
-0.0399169921875,
0.0010805130004882812,
-0.05670166015625,
-0.0175323486328125,
-0.0517578125,
-0.006343841552734375,
-0.050079345703125,
-0.01497650146484375,
-0.0004413127899169922,
0.02490234375,
-0.06683349609375,
0.0190277099609375,
-0.04718017578125,
0.0153961181640625,
0.04541015625,
-0.0005278587341308594,
-0.0009937286376953125,
-0.004177093505859375,
-0.014617919921875,
0.019012451171875,
-0.0673828125,
-0.04193115234375,
0.0799560546875,
0.0290679931640625,
0.0474853515625,
-0.004787445068359375,
0.0645751953125,
-0.0018291473388671875,
0.0232391357421875,
-0.03717041015625,
0.038421630859375,
-0.00937652587890625,
-0.0390625,
-0.008026123046875,
-0.0406494140625,
-0.07525634765625,
0.0080718994140625,
-0.01232147216796875,
-0.0626220703125,
0.00380706787109375,
-0.004119873046875,
-0.007465362548828125,
0.0228424072265625,
-0.07611083984375,
0.07159423828125,
-0.000980377197265625,
-0.0250396728515625,
0.0124053955078125,
-0.05712890625,
0.0440673828125,
0.0032329559326171875,
0.01715087890625,
0.0020923614501953125,
0.00640869140625,
0.072265625,
-0.0440673828125,
0.0635986328125,
-0.0279541015625,
0.03497314453125,
0.036956787109375,
-0.0207061767578125,
0.049041748046875,
0.01052093505859375,
-0.0167083740234375,
0.0284423828125,
0.0213623046875,
-0.029449462890625,
-0.03594970703125,
0.063720703125,
-0.09161376953125,
-0.0474853515625,
-0.04278564453125,
-0.037322998046875,
-0.007549285888671875,
0.0245361328125,
0.030548095703125,
0.02606201171875,
0.00457763671875,
0.027252197265625,
0.01390838623046875,
-0.02630615234375,
0.054473876953125,
0.026641845703125,
-0.0186767578125,
-0.03765869140625,
0.0560302734375,
0.005359649658203125,
0.0012187957763671875,
0.025665283203125,
0.0181121826171875,
-0.0509033203125,
-0.035400390625,
-0.03851318359375,
0.034698486328125,
-0.04937744140625,
-0.0232086181640625,
-0.07147216796875,
-0.043609619140625,
-0.04638671875,
-0.00799560546875,
-0.027923583984375,
-0.018951416015625,
-0.046417236328125,
-0.00023245811462402344,
0.0340576171875,
0.040496826171875,
0.0023899078369140625,
0.037506103515625,
-0.0650634765625,
0.00859832763671875,
-0.00960540771484375,
0.0140533447265625,
0.0085296630859375,
-0.0501708984375,
-0.0177459716796875,
0.036041259765625,
-0.0291290283203125,
-0.0499267578125,
0.03717041015625,
0.0196380615234375,
0.053924560546875,
0.03057861328125,
0.01092529296875,
0.058380126953125,
-0.0134429931640625,
0.06060791015625,
0.0183563232421875,
-0.06768798828125,
0.02569580078125,
-0.0390625,
0.0191497802734375,
0.02490234375,
0.0286102294921875,
-0.03131103515625,
-0.03955078125,
-0.06927490234375,
-0.034912109375,
0.069091796875,
0.0301513671875,
-0.00445556640625,
-0.0224151611328125,
0.0306854248046875,
-0.012451171875,
-0.0003235340118408203,
-0.036041259765625,
-0.0156097412109375,
-0.0546875,
-0.0291595458984375,
-0.01277923583984375,
-0.0034198760986328125,
0.01824951171875,
-0.0197601318359375,
0.062042236328125,
-0.01116943359375,
0.05206298828125,
0.01316070556640625,
-0.01453399658203125,
0.0102386474609375,
-0.006771087646484375,
0.052490234375,
0.0291900634765625,
-0.0202789306640625,
-0.003582000732421875,
0.00457000732421875,
-0.04742431640625,
0.0033931732177734375,
0.0301361083984375,
-0.013336181640625,
-0.0102386474609375,
0.030975341796875,
0.07952880859375,
0.009735107421875,
-0.027099609375,
0.0325927734375,
-0.00835418701171875,
-0.021697998046875,
-0.004901885986328125,
0.020233154296875,
0.0201416015625,
0.026611328125,
0.016876220703125,
-0.00714111328125,
0.00957489013671875,
-0.01763916015625,
0.01320648193359375,
0.0149078369140625,
-0.0197296142578125,
-0.01605224609375,
0.07818603515625,
0.0142822265625,
-0.0171966552734375,
0.040679931640625,
-0.0267181396484375,
-0.0308685302734375,
0.06658935546875,
0.04986572265625,
0.06683349609375,
0.00582122802734375,
0.021484375,
0.052276611328125,
0.0187530517578125,
-0.015716552734375,
0.0161285400390625,
0.018829345703125,
-0.049224853515625,
-0.033782958984375,
-0.054107666015625,
-0.0178680419921875,
0.00867462158203125,
-0.0382080078125,
0.0290374755859375,
-0.03521728515625,
-0.019256591796875,
0.01849365234375,
0.024871826171875,
-0.05126953125,
0.0122222900390625,
-0.00893402099609375,
0.068603515625,
-0.039276123046875,
0.06329345703125,
0.05206298828125,
-0.061737060546875,
-0.08380126953125,
-0.0194091796875,
-0.0063629150390625,
-0.065185546875,
0.054168701171875,
0.0292816162109375,
0.0024662017822265625,
0.0202484130859375,
-0.037261962890625,
-0.06463623046875,
0.07757568359375,
0.0308380126953125,
-0.04071044921875,
-0.004703521728515625,
0.01464080810546875,
0.033111572265625,
-0.0300140380859375,
0.060211181640625,
0.026123046875,
0.035797119140625,
0.030364990234375,
-0.058349609375,
0.0162200927734375,
-0.0421142578125,
0.005466461181640625,
0.00756072998046875,
-0.07525634765625,
0.064453125,
-0.0174102783203125,
-0.01198577880859375,
-0.0028438568115234375,
0.06439208984375,
0.0251007080078125,
0.016448974609375,
0.02764892578125,
0.035888671875,
0.048126220703125,
-0.00917816162109375,
0.0732421875,
-0.044158935546875,
0.04510498046875,
0.0699462890625,
0.00203704833984375,
0.053985595703125,
0.018524169921875,
-0.00003427267074584961,
0.0171966552734375,
0.06658935546875,
-0.0025577545166015625,
0.017486572265625,
-0.00827789306640625,
0.0124969482421875,
-0.010406494140625,
-0.0022411346435546875,
-0.047882080078125,
0.03631591796875,
0.01995849609375,
-0.02459716796875,
-0.0115509033203125,
-0.0031585693359375,
0.0289764404296875,
-0.0250396728515625,
-0.005229949951171875,
0.04144287109375,
0.002475738525390625,
-0.0589599609375,
0.07391357421875,
0.0109405517578125,
0.0596923828125,
-0.044586181640625,
0.0085601806640625,
-0.033660888671875,
0.0160980224609375,
-0.0122528076171875,
-0.045806884765625,
0.033172607421875,
-0.004978179931640625,
-0.00208282470703125,
0.0035114288330078125,
0.051177978515625,
-0.0220489501953125,
-0.054351806640625,
0.0180206298828125,
0.0201873779296875,
0.0181427001953125,
-0.017730712890625,
-0.0655517578125,
0.0288238525390625,
-0.01019287109375,
-0.026397705078125,
0.0158538818359375,
0.02008056640625,
-0.004291534423828125,
0.0565185546875,
0.0572509765625,
-0.0098419189453125,
0.01467132568359375,
-0.00012171268463134766,
0.057525634765625,
-0.0570068359375,
-0.035247802734375,
-0.050384521484375,
0.03338623046875,
-0.01311492919921875,
-0.029998779296875,
0.05584716796875,
0.04718017578125,
0.057952880859375,
-0.004364013671875,
0.05078125,
-0.00909423828125,
0.0213623046875,
-0.03497314453125,
0.059844970703125,
-0.038665771484375,
0.005992889404296875,
-0.0296173095703125,
-0.054290771484375,
-0.015167236328125,
0.045623779296875,
-0.013275146484375,
0.0181884765625,
0.058746337890625,
0.07952880859375,
-0.00848388671875,
0.0224609375,
0.01320648193359375,
0.0305023193359375,
0.03875732421875,
0.055633544921875,
0.05712890625,
-0.058135986328125,
0.05096435546875,
-0.0204620361328125,
-0.0124359130859375,
-0.0209197998046875,
-0.061553955078125,
-0.08990478515625,
-0.05145263671875,
-0.020751953125,
-0.0310211181640625,
0.010711669921875,
0.0653076171875,
0.058258056640625,
-0.04571533203125,
-0.0189971923828125,
-0.0172271728515625,
0.003116607666015625,
-0.0210418701171875,
-0.0159454345703125,
0.039093017578125,
-0.043548583984375,
-0.05682373046875,
0.01084136962890625,
0.002685546875,
0.007526397705078125,
-0.004665374755859375,
-0.01873779296875,
-0.031951904296875,
0.00199127197265625,
0.04315185546875,
0.02374267578125,
-0.061553955078125,
-0.0297088623046875,
0.0189208984375,
-0.01052093505859375,
-0.000621795654296875,
0.018280029296875,
-0.03997802734375,
0.0208282470703125,
0.032196044921875,
0.053375244140625,
0.06591796875,
-0.00589752197265625,
0.0174407958984375,
-0.018829345703125,
0.0306854248046875,
-0.01068115234375,
0.03582763671875,
0.01219940185546875,
-0.0292816162109375,
0.043060302734375,
0.0316162109375,
-0.0401611328125,
-0.05438232421875,
-0.0177764892578125,
-0.0943603515625,
-0.008514404296875,
0.0994873046875,
-0.0162200927734375,
-0.03350830078125,
0.009735107421875,
-0.0335693359375,
0.041107177734375,
-0.046539306640625,
0.04510498046875,
0.0428466796875,
0.0050048828125,
-0.01334381103515625,
-0.0251007080078125,
0.0275726318359375,
0.0057373046875,
-0.0723876953125,
-0.0177001953125,
0.026885986328125,
0.022369384765625,
-0.006137847900390625,
0.040863037109375,
0.006320953369140625,
0.008575439453125,
0.0191497802734375,
-0.00325775146484375,
-0.045684814453125,
-0.01885986328125,
0.002288818359375,
0.0139007568359375,
-0.02117919921875,
-0.030975341796875
]
] |
xlm-roberta-base | 2023-04-07T12:46:17.000Z | [
"transformers",
"pytorch",
"tf",
"jax",
"onnx",
"safetensors",
"xlm-roberta",
"fill-mask",
"exbert",
"multilingual",
"af",
"am",
"ar",
"as",
"az",
"be",
"bg",
"bn",
"br",
"bs",
"ca",
"cs",
"cy",
"da",
"de",
"el",
"en",
"eo",
"es",
"et",
"eu",
"fa",
"fi",
"fr",
"fy",
"ga",
"gd",
"gl",
"gu",
"ha",
"he",
"hi",
"hr",
"hu",
"hy",
"id",
"is",
"it",
"ja",
"jv",
"ka",
"kk",
"km",
"kn",
"ko",
"ku",
"ky",
"la",
"lo",
"lt",
"lv",
"mg",
"mk",
"ml",
"mn",
"mr",
"ms",
"my",
"ne",
"nl",
"no",
"om",
"or",
"pa",
"pl",
"ps",
"pt",
"ro",
"ru",
"sa",
"sd",
"si",
"sk",
"sl",
"so",
"sq",
"sr",
"su",
"sv",
"sw",
"ta",
"te",
"th",
"tl",
"tr",
"ug",
"uk",
"ur",
"uz",
"vi",
"xh",
"yi",
"zh",
"arxiv:1911.02116",
"license:mit",
"autotrain_compatible",
"endpoints_compatible",
"has_space",
"region:us"
] | fill-mask | null | null | null | xlm-roberta-base | 406 | 12,048,443 | transformers | 2022-03-02T23:29:04 | ---
tags:
- exbert
language:
- multilingual
- af
- am
- ar
- as
- az
- be
- bg
- bn
- br
- bs
- ca
- cs
- cy
- da
- de
- el
- en
- eo
- es
- et
- eu
- fa
- fi
- fr
- fy
- ga
- gd
- gl
- gu
- ha
- he
- hi
- hr
- hu
- hy
- id
- is
- it
- ja
- jv
- ka
- kk
- km
- kn
- ko
- ku
- ky
- la
- lo
- lt
- lv
- mg
- mk
- ml
- mn
- mr
- ms
- my
- ne
- nl
- no
- om
- or
- pa
- pl
- ps
- pt
- ro
- ru
- sa
- sd
- si
- sk
- sl
- so
- sq
- sr
- su
- sv
- sw
- ta
- te
- th
- tl
- tr
- ug
- uk
- ur
- uz
- vi
- xh
- yi
- zh
license: mit
---
# XLM-RoBERTa (base-sized model)
XLM-RoBERTa model pre-trained on 2.5TB of filtered CommonCrawl data containing 100 languages. It was introduced in the paper [Unsupervised Cross-lingual Representation Learning at Scale](https://arxiv.org/abs/1911.02116) by Conneau et al. and first released in [this repository](https://github.com/pytorch/fairseq/tree/master/examples/xlmr).
Disclaimer: The team releasing XLM-RoBERTa did not write a model card for this model so this model card has been written by the Hugging Face team.
## Model description
XLM-RoBERTa is a multilingual version of RoBERTa. It is pre-trained on 2.5TB of filtered CommonCrawl data containing 100 languages.
RoBERTa is a transformers model pretrained on a large corpus in a self-supervised fashion. 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 the Masked language modeling (MLM) objective. Taking a sentence, the model randomly masks 15% of the words in the input then run the entire masked sentence through the model and 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 the sentence.
This way, the model learns an inner representation of 100 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 XLM-RoBERTa model as inputs.
## Intended uses & limitations
You can use the raw model for masked language modeling, but it's mostly intended to be fine-tuned on a downstream task. See the [model hub](https://huggingface.co/models?search=xlm-roberta) 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.
## Usage
You can use this model directly with a pipeline for masked language modeling:
```python
>>> from transformers import pipeline
>>> unmasker = pipeline('fill-mask', model='xlm-roberta-base')
>>> unmasker("Hello I'm a <mask> model.")
[{'score': 0.10563907772302628,
'sequence': "Hello I'm a fashion model.",
'token': 54543,
'token_str': 'fashion'},
{'score': 0.08015287667512894,
'sequence': "Hello I'm a new model.",
'token': 3525,
'token_str': 'new'},
{'score': 0.033413201570510864,
'sequence': "Hello I'm a model model.",
'token': 3299,
'token_str': 'model'},
{'score': 0.030217764899134636,
'sequence': "Hello I'm a French model.",
'token': 92265,
'token_str': 'French'},
{'score': 0.026436051353812218,
'sequence': "Hello I'm a sexy model.",
'token': 17473,
'token_str': 'sexy'}]
```
Here is how to use this model to get the features of a given text in PyTorch:
```python
from transformers import AutoTokenizer, AutoModelForMaskedLM
tokenizer = AutoTokenizer.from_pretrained('xlm-roberta-base')
model = AutoModelForMaskedLM.from_pretrained("xlm-roberta-base")
# prepare input
text = "Replace me by any text you'd like."
encoded_input = tokenizer(text, return_tensors='pt')
# forward pass
output = model(**encoded_input)
```
### BibTeX entry and citation info
```bibtex
@article{DBLP:journals/corr/abs-1911-02116,
author = {Alexis Conneau and
Kartikay Khandelwal and
Naman Goyal and
Vishrav Chaudhary and
Guillaume Wenzek and
Francisco Guzm{\'{a}}n and
Edouard Grave and
Myle Ott and
Luke Zettlemoyer and
Veselin Stoyanov},
title = {Unsupervised Cross-lingual Representation Learning at Scale},
journal = {CoRR},
volume = {abs/1911.02116},
year = {2019},
url = {http://arxiv.org/abs/1911.02116},
eprinttype = {arXiv},
eprint = {1911.02116},
timestamp = {Mon, 11 Nov 2019 18:38:09 +0100},
biburl = {https://dblp.org/rec/journals/corr/abs-1911-02116.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
```
<a href="https://huggingface.co/exbert/?model=xlm-roberta-base">
<img width="300px" src="https://cdn-media.huggingface.co/exbert/button.png">
</a>
| 5,238 | [
[
-0.03326416015625,
-0.056610107421875,
0.01509857177734375,
0.005535125732421875,
-0.015625,
-0.0003008842468261719,
-0.0286407470703125,
-0.029022216796875,
0.01404571533203125,
0.044036865234375,
-0.033782958984375,
-0.04351806640625,
-0.05340576171875,
0.0161285400390625,
-0.0308837890625,
0.08746337890625,
-0.0021820068359375,
0.004909515380859375,
0.0024776458740234375,
-0.0160980224609375,
-0.016448974609375,
-0.061309814453125,
-0.03533935546875,
-0.025726318359375,
0.029876708984375,
0.009765625,
0.041534423828125,
0.04595947265625,
0.0161285400390625,
0.031524658203125,
-0.0153961181640625,
0.01290130615234375,
-0.020111083984375,
-0.0008029937744140625,
0.00270843505859375,
-0.04583740234375,
-0.03643798828125,
0.0177154541015625,
0.0487060546875,
0.05511474609375,
0.00916290283203125,
0.02178955078125,
0.0092315673828125,
0.0269775390625,
-0.0136260986328125,
0.0220489501953125,
-0.04052734375,
0.012786865234375,
-0.0163726806640625,
0.0069427490234375,
-0.032928466796875,
-0.007694244384765625,
0.01163482666015625,
-0.0223846435546875,
0.0163726806640625,
0.01317596435546875,
0.09234619140625,
-0.000644683837890625,
-0.0247344970703125,
-0.013885498046875,
-0.043914794921875,
0.08099365234375,
-0.050567626953125,
0.032745361328125,
0.0172576904296875,
0.003055572509765625,
0.006046295166015625,
-0.0679931640625,
-0.040679931640625,
-0.0197601318359375,
-0.031463623046875,
0.00725555419921875,
-0.036956787109375,
-0.018402099609375,
0.023406982421875,
0.03131103515625,
-0.060760498046875,
-0.0016679763793945312,
-0.032928466796875,
-0.0177459716796875,
0.04083251953125,
0.000942230224609375,
0.03131103515625,
-0.0380859375,
-0.031524658203125,
-0.033050537109375,
-0.0364990234375,
0.00991058349609375,
0.0257110595703125,
0.03240966796875,
-0.025909423828125,
0.03802490234375,
0.007694244384765625,
0.056610107421875,
0.01213836669921875,
0.0025920867919921875,
0.04156494140625,
-0.0208892822265625,
-0.022979736328125,
-0.017974853515625,
0.09234619140625,
-0.004116058349609375,
0.0186920166015625,
-0.007965087890625,
-0.01153564453125,
-0.007366180419921875,
0.0024871826171875,
-0.054229736328125,
-0.020965576171875,
0.015228271484375,
-0.04229736328125,
-0.0156097412109375,
0.01457977294921875,
-0.0518798828125,
0.01263427734375,
-0.02392578125,
0.047882080078125,
-0.037109375,
-0.0211181640625,
-0.007720947265625,
-0.0015153884887695312,
0.0019350051879882812,
-0.00299835205078125,
-0.057830810546875,
0.01456451416015625,
0.023406982421875,
0.0638427734375,
-0.00592803955078125,
-0.0231170654296875,
-0.032989501953125,
-0.0208587646484375,
-0.0175933837890625,
0.035614013671875,
-0.02935791015625,
-0.01097869873046875,
-0.00905609130859375,
0.02496337890625,
-0.01320648193359375,
-0.0379638671875,
0.02874755859375,
-0.0250091552734375,
0.03839111328125,
0.00865936279296875,
-0.0251922607421875,
-0.029296875,
0.0088348388671875,
-0.049041748046875,
0.09307861328125,
0.020477294921875,
-0.050445556640625,
0.015960693359375,
-0.04302978515625,
-0.023712158203125,
-0.0129547119140625,
-0.0008401870727539062,
-0.056182861328125,
-0.00476837158203125,
0.031097412109375,
0.03997802734375,
-0.0209197998046875,
0.0112762451171875,
-0.01123809814453125,
-0.004978179931640625,
0.02935791015625,
-0.0198974609375,
0.0880126953125,
0.024810791015625,
-0.036590576171875,
0.0125885009765625,
-0.06304931640625,
0.01556396484375,
0.0140228271484375,
-0.0159454345703125,
-0.0189666748046875,
-0.029296875,
0.0261993408203125,
0.023193359375,
0.016265869140625,
-0.0296630859375,
0.0041656494140625,
-0.04052734375,
0.039459228515625,
0.037261962890625,
-0.0204925537109375,
0.037933349609375,
-0.0207672119140625,
0.044281005859375,
0.01374053955078125,
0.006587982177734375,
-0.027587890625,
-0.042083740234375,
-0.06292724609375,
-0.0234527587890625,
0.049468994140625,
0.0426025390625,
-0.038726806640625,
0.0506591796875,
-0.0118255615234375,
-0.045166015625,
-0.0521240234375,
0.01515960693359375,
0.041717529296875,
0.0270233154296875,
0.0377197265625,
-0.031097412109375,
-0.05426025390625,
-0.053955078125,
-0.01373291015625,
0.001590728759765625,
-0.006290435791015625,
0.0277252197265625,
0.04388427734375,
-0.0219268798828125,
0.06768798828125,
-0.03350830078125,
-0.033660888671875,
-0.044647216796875,
0.0264129638671875,
0.0281982421875,
0.0457763671875,
0.050689697265625,
-0.05859375,
-0.057281494140625,
-0.0021915435791015625,
-0.048126220703125,
-0.00727081298828125,
-0.0019702911376953125,
-0.00749969482421875,
0.042510986328125,
0.033782958984375,
-0.045074462890625,
0.031463623046875,
0.045867919921875,
-0.020294189453125,
0.0201263427734375,
-0.02447509765625,
-0.0017757415771484375,
-0.09820556640625,
0.0114898681640625,
0.002475738525390625,
-0.0252685546875,
-0.048065185546875,
0.0017328262329101562,
0.006420135498046875,
-0.01316070556640625,
-0.024139404296875,
0.04766845703125,
-0.061431884765625,
-0.00019598007202148438,
-0.006999969482421875,
0.028411865234375,
0.00762939453125,
0.0521240234375,
0.0163116455078125,
0.0306549072265625,
0.050811767578125,
-0.033203125,
0.0214996337890625,
0.0240631103515625,
-0.0248260498046875,
0.0204315185546875,
-0.0472412109375,
0.01209259033203125,
0.0024433135986328125,
0.01285552978515625,
-0.06671142578125,
0.007228851318359375,
0.0235595703125,
-0.046417236328125,
0.03814697265625,
-0.0272979736328125,
-0.03802490234375,
-0.031951904296875,
-0.0066070556640625,
0.0295257568359375,
0.055328369140625,
-0.037261962890625,
0.0548095703125,
0.032562255859375,
-0.01035308837890625,
-0.042205810546875,
-0.06011962890625,
0.008880615234375,
-0.0183258056640625,
-0.04742431640625,
0.037109375,
-0.00576019287109375,
0.0001614093780517578,
-0.0017004013061523438,
0.0157012939453125,
0.005062103271484375,
-0.0070343017578125,
0.017852783203125,
0.0243377685546875,
-0.01406097412109375,
-0.004673004150390625,
-0.0167999267578125,
-0.022796630859375,
-0.0038738250732421875,
-0.0289764404296875,
0.06707763671875,
-0.00673675537109375,
-0.005191802978515625,
-0.025238037109375,
0.029541015625,
0.025146484375,
-0.03692626953125,
0.0509033203125,
0.07476806640625,
-0.0245208740234375,
-0.01328277587890625,
-0.0278778076171875,
-0.0152130126953125,
-0.0318603515625,
0.04193115234375,
-0.0275726318359375,
-0.0606689453125,
0.050018310546875,
0.0177459716796875,
-0.00865936279296875,
0.049041748046875,
0.051025390625,
0.010955810546875,
0.08642578125,
0.053192138671875,
-0.0026874542236328125,
0.03704833984375,
-0.049468994140625,
0.026214599609375,
-0.0731201171875,
-0.0224151611328125,
-0.0455322265625,
-0.0147705078125,
-0.06365966796875,
-0.043487548828125,
0.0206756591796875,
0.00872039794921875,
-0.01045989990234375,
0.053436279296875,
-0.045013427734375,
0.0017232894897460938,
0.058929443359375,
0.01151275634765625,
0.008880615234375,
0.005565643310546875,
-0.025665283203125,
-0.005523681640625,
-0.05340576171875,
-0.0256195068359375,
0.0885009765625,
0.0262908935546875,
0.053436279296875,
0.0006847381591796875,
0.056610107421875,
-0.0025424957275390625,
0.01322174072265625,
-0.04730224609375,
0.037261962890625,
-0.019989013671875,
-0.054473876953125,
-0.0200653076171875,
-0.0394287109375,
-0.08245849609375,
0.0174560546875,
-0.022552490234375,
-0.064697265625,
0.0159149169921875,
0.00029659271240234375,
-0.019805908203125,
0.0261993408203125,
-0.04168701171875,
0.0687255859375,
-0.0230865478515625,
-0.0199432373046875,
0.0032024383544921875,
-0.052154541015625,
0.012908935546875,
-0.006443023681640625,
0.01226806640625,
0.0107421875,
0.015838623046875,
0.0594482421875,
-0.038787841796875,
0.0697021484375,
0.003017425537109375,
0.0006284713745117188,
0.018524169921875,
-0.0045013427734375,
0.031463623046875,
-0.0060882568359375,
0.00972747802734375,
0.035400390625,
-0.00525665283203125,
-0.017578125,
-0.037445068359375,
0.046783447265625,
-0.07330322265625,
-0.045074462890625,
-0.045196533203125,
-0.047027587890625,
0.009429931640625,
0.0221099853515625,
0.0350341796875,
0.043548583984375,
-0.0014829635620117188,
0.01593017578125,
0.043212890625,
-0.032989501953125,
0.038848876953125,
0.03350830078125,
-0.031097412109375,
-0.038543701171875,
0.052764892578125,
0.0225067138671875,
0.01544189453125,
0.046142578125,
0.01535797119140625,
-0.033721923828125,
-0.034576416015625,
-0.032196044921875,
0.0212249755859375,
-0.0478515625,
-0.020263671875,
-0.0777587890625,
-0.036773681640625,
-0.051971435546875,
0.00701141357421875,
-0.017425537109375,
-0.038909912109375,
-0.0305633544921875,
0.0019092559814453125,
0.040985107421875,
0.0543212890625,
-0.020782470703125,
0.0146484375,
-0.053558349609375,
0.0196380615234375,
0.01885986328125,
0.00494384765625,
-0.004085540771484375,
-0.06915283203125,
-0.030548095703125,
0.006801605224609375,
-0.0272979736328125,
-0.051971435546875,
0.0653076171875,
0.0118255615234375,
0.04400634765625,
0.021453857421875,
-0.001605987548828125,
0.052459716796875,
-0.0291900634765625,
0.055755615234375,
0.0134735107421875,
-0.0738525390625,
0.0406494140625,
-0.00545501708984375,
0.01800537109375,
0.0022125244140625,
0.036773681640625,
-0.042999267578125,
-0.0390625,
-0.058807373046875,
-0.0770263671875,
0.0697021484375,
0.022003173828125,
0.0216064453125,
0.00047898292541503906,
0.014678955078125,
0.001735687255859375,
0.006072998046875,
-0.088134765625,
-0.046875,
-0.032562255859375,
-0.0294647216796875,
-0.0205078125,
-0.0110321044921875,
-0.0018911361694335938,
-0.0302734375,
0.051971435546875,
-0.0029773712158203125,
0.033966064453125,
0.0198211669921875,
-0.0323486328125,
-0.0012836456298828125,
0.00746917724609375,
0.03594970703125,
0.0328369140625,
-0.01617431640625,
0.006183624267578125,
0.01287841796875,
-0.03436279296875,
-0.00487518310546875,
0.028533935546875,
-0.015167236328125,
0.015869140625,
0.0260772705078125,
0.06951904296875,
0.021728515625,
-0.0311279296875,
0.034271240234375,
0.00943756103515625,
-0.01236724853515625,
-0.032073974609375,
0.0047607421875,
0.00534820556640625,
0.0227203369140625,
0.033447265625,
0.0031642913818359375,
-0.00962066650390625,
-0.0574951171875,
0.0274810791015625,
0.03814697265625,
-0.035125732421875,
-0.02197265625,
0.063720703125,
-0.01444244384765625,
-0.0279998779296875,
0.039398193359375,
-0.0092620849609375,
-0.0565185546875,
0.04962158203125,
0.048492431640625,
0.068359375,
-0.010772705078125,
0.0181884765625,
0.0472412109375,
0.020751953125,
0.0040435791015625,
0.0025501251220703125,
0.005626678466796875,
-0.054595947265625,
-0.017181396484375,
-0.0576171875,
-0.0038394927978515625,
0.01593017578125,
-0.0462646484375,
0.0248260498046875,
-0.024200439453125,
-0.0179443359375,
0.0023040771484375,
0.01788330078125,
-0.056396484375,
0.0229949951171875,
0.004817962646484375,
0.053955078125,
-0.0633544921875,
0.0679931640625,
0.052703857421875,
-0.05987548828125,
-0.0762939453125,
-0.018768310546875,
-0.00963592529296875,
-0.07049560546875,
0.06988525390625,
0.01065826416015625,
0.0233154296875,
0.004291534423828125,
-0.030059814453125,
-0.07818603515625,
0.08477783203125,
0.00952911376953125,
-0.038970947265625,
0.001220703125,
0.0271148681640625,
0.042327880859375,
-0.0491943359375,
0.04779052734375,
0.0228271484375,
0.033721923828125,
-0.0017232894897460938,
-0.06536865234375,
0.015625,
-0.0283050537109375,
0.0095977783203125,
0.005687713623046875,
-0.057769775390625,
0.0953369140625,
-0.01297760009765625,
-0.005290985107421875,
0.0189666748046875,
0.043853759765625,
0.01056671142578125,
-0.0007882118225097656,
0.0310516357421875,
0.051055908203125,
0.046539306640625,
-0.02471923828125,
0.0697021484375,
-0.02862548828125,
0.048828125,
0.071044921875,
0.00487518310546875,
0.056121826171875,
0.0175323486328125,
-0.0178070068359375,
0.0565185546875,
0.049224853515625,
-0.0245513916015625,
0.0323486328125,
0.0070648193359375,
0.00688934326171875,
-0.01419830322265625,
0.016693115234375,
-0.023895263671875,
0.041839599609375,
0.007232666015625,
-0.0516357421875,
-0.00966644287109375,
0.00989532470703125,
0.0268402099609375,
-0.0013370513916015625,
-0.0103302001953125,
0.045654296875,
0.0193634033203125,
-0.04730224609375,
0.056610107421875,
0.0092620849609375,
0.052764892578125,
-0.04443359375,
0.00525665283203125,
-0.023529052734375,
0.018035888671875,
-0.00995635986328125,
-0.044403076171875,
0.00861358642578125,
0.005157470703125,
-0.019683837890625,
-0.0235595703125,
0.03424072265625,
-0.057769775390625,
-0.0576171875,
0.034454345703125,
0.03363037109375,
0.0166015625,
-0.00013506412506103516,
-0.07275390625,
0.004520416259765625,
0.007144927978515625,
-0.033721923828125,
0.0301055908203125,
0.0430908203125,
-0.00449371337890625,
0.047119140625,
0.0526123046875,
0.00867462158203125,
0.0084991455078125,
0.004817962646484375,
0.05511474609375,
-0.05914306640625,
-0.031402587890625,
-0.058258056640625,
0.0513916015625,
-0.003753662109375,
-0.0236968994140625,
0.06732177734375,
0.04620361328125,
0.06317138671875,
-0.007740020751953125,
0.054412841796875,
-0.0178070068359375,
0.03753662109375,
-0.03814697265625,
0.0699462890625,
-0.053863525390625,
0.01445770263671875,
-0.0267181396484375,
-0.06689453125,
-0.0267486572265625,
0.05926513671875,
-0.01175689697265625,
0.028472900390625,
0.0555419921875,
0.0704345703125,
-0.00852203369140625,
-0.0306854248046875,
0.02642822265625,
0.04052734375,
0.01175689697265625,
0.039642333984375,
0.034515380859375,
-0.056182861328125,
0.0556640625,
-0.027008056640625,
-0.0160675048828125,
-0.0177001953125,
-0.06231689453125,
-0.08343505859375,
-0.06494140625,
-0.032562255859375,
-0.034515380859375,
-0.013214111328125,
0.07135009765625,
0.06317138671875,
-0.06689453125,
-0.0211639404296875,
0.0018186569213867188,
0.01038360595703125,
-0.0183563232421875,
-0.023345947265625,
0.045318603515625,
-0.030426025390625,
-0.0816650390625,
0.006877899169921875,
0.007678985595703125,
0.01444244384765625,
-0.027740478515625,
-0.0034046173095703125,
-0.0210418701171875,
0.00135040283203125,
0.0380859375,
0.015411376953125,
-0.04913330078125,
-0.01690673828125,
0.00669097900390625,
-0.00948333740234375,
0.0197296142578125,
0.035797119140625,
-0.06317138671875,
0.0225982666015625,
0.03253173828125,
0.0157318115234375,
0.054412841796875,
-0.0229339599609375,
0.044036865234375,
-0.05487060546875,
0.0218505859375,
0.005031585693359375,
0.040985107421875,
0.031463623046875,
-0.016265869140625,
0.0280609130859375,
0.021759033203125,
-0.035491943359375,
-0.065185546875,
0.004291534423828125,
-0.07904052734375,
-0.0200653076171875,
0.07794189453125,
-0.027008056640625,
-0.02783203125,
-0.004302978515625,
-0.01203155517578125,
0.03460693359375,
-0.01288604736328125,
0.05511474609375,
0.03814697265625,
0.00658416748046875,
-0.0380859375,
-0.024139404296875,
0.0372314453125,
0.0237579345703125,
-0.0426025390625,
-0.0031414031982421875,
0.0023365020751953125,
0.03900146484375,
0.0292510986328125,
0.027252197265625,
-0.024078369140625,
-0.0031070709228515625,
-0.01299285888671875,
0.0194549560546875,
0.000965118408203125,
-0.01177978515625,
-0.0210723876953125,
0.008453369140625,
-0.019775390625,
-0.0038604736328125
]
] |
distilbert-base-uncased | 2023-08-18T14:59:41.000Z | ["transformers","pytorch","tf","jax","rust","safetensors","distilbert","fill-mask","exbert","en","da(...TRUNCATED) | fill-mask | null | null | null | distilbert-base-uncased | 292 | 11,014,465 | transformers | 2022-03-02T23:29:04 | "---\nlanguage: en\ntags:\n- exbert\nlicense: apache-2.0\ndatasets:\n- bookcorpus\n- wikipedia\n---\(...TRUNCATED) | 8,577 | [[-0.004299163818359375,-0.049346923828125,0.018951416015625,0.0210113525390625,-0.041534423828125,0(...TRUNCATED) |
sentence-transformers/all-mpnet-base-v2 | 2023-11-02T09:35:52.000Z | ["sentence-transformers","pytorch","mpnet","feature-extraction","sentence-similarity","en","dataset:(...TRUNCATED) | sentence-similarity | sentence-transformers | null | null | sentence-transformers/all-mpnet-base-v2 | 452 | 10,816,338 | sentence-transformers | 2022-03-02T23:29:05 | "---\npipeline_tag: sentence-similarity\ntags:\n- sentence-transformers\n- feature-extraction\n- sen(...TRUNCATED) | 10,571 | [[-0.0270233154296875,-0.0555419921875,0.0252685546875,0.01505279541015625,-0.00969696044921875,-0.0(...TRUNCATED) |
End of preview. Expand
in Data Studio
- Downloads last month
- 11