patrickvonplaten
commited on
Commit
•
cf07705
1
Parent(s):
557a849
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: multilingual
|
3 |
+
license: mit
|
4 |
+
---
|
5 |
+
|
6 |
+
# XLM-RoBERTa-XL (xxlarge-sized model)
|
7 |
+
|
8 |
+
XLM-RoBERTa-XL model pre-trained on 2.5TB of filtered CommonCrawl data containing 100 languages. It was introduced in the paper [Larger-Scale Transformers for Multilingual Masked Language Modeling](https://arxiv.org/abs/2105.00572) by Naman Goyal, Jingfei Du, Myle Ott, Giri Anantharaman, Alexis Conneau and first released in [this repository](https://github.com/pytorch/fairseq/tree/master/examples/xlmr).
|
9 |
+
|
10 |
+
Disclaimer: The team releasing XLM-RoBERTa-XL did not write a model card for this model so this model card has been written by the Hugging Face team.
|
11 |
+
|
12 |
+
## Model description
|
13 |
+
|
14 |
+
XLM-RoBERTa-XL is a extra large multilingual version of RoBERTa. It is pre-trained on 2.5TB of filtered CommonCrawl data containing 100 languages.
|
15 |
+
|
16 |
+
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 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.
|
17 |
+
|
18 |
+
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.
|
19 |
+
|
20 |
+
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-XL model as inputs.
|
21 |
+
|
22 |
+
## Intended uses & limitations
|
23 |
+
|
24 |
+
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-xl) to look for fine-tuned versions on a task that interests you.
|
25 |
+
|
26 |
+
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.
|
27 |
+
|
28 |
+
## Usage
|
29 |
+
|
30 |
+
You can use this model directly with a pipeline for masked language modeling:
|
31 |
+
|
32 |
+
```python
|
33 |
+
>>> from transformers import pipeline
|
34 |
+
>>> unmasker = pipeline('fill-mask', model='facebook/xlm-roberta-xxl')
|
35 |
+
>>> unmasker("Europe is a <mask> continent.")
|
36 |
+
|
37 |
+
[{'score': 0.22996895015239716,
|
38 |
+
'token': 28811,
|
39 |
+
'token_str': 'European',
|
40 |
+
'sequence': 'Europe is a European continent.'},
|
41 |
+
{'score': 0.14307449758052826,
|
42 |
+
'token': 21334,
|
43 |
+
'token_str': 'large',
|
44 |
+
'sequence': 'Europe is a large continent.'},
|
45 |
+
{'score': 0.12239163368940353,
|
46 |
+
'token': 19336,
|
47 |
+
'token_str': 'small',
|
48 |
+
'sequence': 'Europe is a small continent.'},
|
49 |
+
{'score': 0.07025063782930374,
|
50 |
+
'token': 18410,
|
51 |
+
'token_str': 'vast',
|
52 |
+
'sequence': 'Europe is a vast continent.'},
|
53 |
+
{'score': 0.032869212329387665,
|
54 |
+
'token': 6957,
|
55 |
+
'token_str': 'big',
|
56 |
+
'sequence': 'Europe is a big continent.'}]
|
57 |
+
```
|
58 |
+
|
59 |
+
Here is how to use this model to get the features of a given text in PyTorch:
|
60 |
+
|
61 |
+
```python
|
62 |
+
from transformers import AutoTokenizer, AutoModelForMaskedLM
|
63 |
+
|
64 |
+
tokenizer = AutoTokenizer.from_pretrained('facebook/xlm-roberta-xxl')
|
65 |
+
model = AutoModelForMaskedLM.from_pretrained("facebook/xlm-roberta-xxl")
|
66 |
+
|
67 |
+
# prepare input
|
68 |
+
text = "Replace me by any text you'd like."
|
69 |
+
encoded_input = tokenizer(text, return_tensors='pt')
|
70 |
+
|
71 |
+
# forward pass
|
72 |
+
output = model(**encoded_input)
|
73 |
+
```
|
74 |
+
|
75 |
+
### BibTeX entry and citation info
|
76 |
+
|
77 |
+
```bibtex
|
78 |
+
@article{DBLP:journals/corr/abs-2105-00572,
|
79 |
+
author = {Naman Goyal and
|
80 |
+
Jingfei Du and
|
81 |
+
Myle Ott and
|
82 |
+
Giri Anantharaman and
|
83 |
+
Alexis Conneau},
|
84 |
+
title = {Larger-Scale Transformers for Multilingual Masked Language Modeling},
|
85 |
+
journal = {CoRR},
|
86 |
+
volume = {abs/2105.00572},
|
87 |
+
year = {2021},
|
88 |
+
url = {https://arxiv.org/abs/2105.00572},
|
89 |
+
eprinttype = {arXiv},
|
90 |
+
eprint = {2105.00572},
|
91 |
+
timestamp = {Wed, 12 May 2021 15:54:31 +0200},
|
92 |
+
biburl = {https://dblp.org/rec/journals/corr/abs-2105-00572.bib},
|
93 |
+
bibsource = {dblp computer science bibliography, https://dblp.org}
|
94 |
+
}
|
95 |
+
```
|