Update README.md
Browse files
README.md
CHANGED
@@ -9,4 +9,37 @@ metrics:
|
|
9 |
- accuracy
|
10 |
library_name: transformers
|
11 |
pipeline_tag: token-classification
|
12 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
- accuracy
|
10 |
library_name: transformers
|
11 |
pipeline_tag: token-classification
|
12 |
+
---
|
13 |
+
|
14 |
+
# XLM-RoBERTa (base-sized model)
|
15 |
+
|
16 |
+
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).
|
17 |
+
|
18 |
+
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.
|
19 |
+
|
20 |
+
## Model description
|
21 |
+
|
22 |
+
XLM-RoBERTa is a multilingual version of RoBERTa. It is pre-trained on 2.5TB of filtered CommonCrawl data containing 100 languages.
|
23 |
+
|
24 |
+
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.
|
25 |
+
|
26 |
+
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.
|
27 |
+
|
28 |
+
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.
|
29 |
+
|
30 |
+
|
31 |
+
Here is how to use this model to get the features of a given text in PyTorch:
|
32 |
+
|
33 |
+
```python
|
34 |
+
from transformers import AutoTokenizer, AutoModelForMaskedLM
|
35 |
+
|
36 |
+
tokenizer = AutoTokenizer.from_pretrained('xlm-roberta-base')
|
37 |
+
model = AutoModelForMaskedLM.from_pretrained("xlm-roberta-base")
|
38 |
+
|
39 |
+
# prepare input
|
40 |
+
text = "Replace me by any text you'd like."
|
41 |
+
encoded_input = tokenizer(text, return_tensors='pt')
|
42 |
+
|
43 |
+
# forward pass
|
44 |
+
output = model(**encoded_input)
|
45 |
+
```
|