nielsr HF staff commited on
Commit
682e73b
1 Parent(s): 208cd28

Add model card

Browse files
Files changed (1) hide show
  1. README.md +106 -0
README.md ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - exbert
4
+ language: multilingual
5
+ license: mit
6
+ ---
7
+
8
+ # XLM-RoBERTa (large-sized model)
9
+
10
+ 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).
11
+
12
+ 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.
13
+
14
+ ## Model description
15
+
16
+ XLM-RoBERTa is a multilingual version of RoBERTa. It is pre-trained on 2.5TB of filtered CommonCrawl data containing 100 languages.
17
+
18
+ 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.
19
+
20
+ 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.
21
+
22
+ 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.
23
+
24
+ ## Intended uses & limitations
25
+
26
+ 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.
27
+
28
+ 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.
29
+
30
+ ## Usage
31
+
32
+ You can use this model directly with a pipeline for masked language modeling:
33
+
34
+ ```python
35
+ >>> from transformers import pipeline
36
+ >>> unmasker = pipeline('fill-mask', model='xlm-roberta-large')
37
+ >>> unmasker("Hello I'm a <mask> model.")
38
+
39
+ [{'score': 0.10563907772302628,
40
+ 'sequence': "Hello I'm a fashion model.",
41
+ 'token': 54543,
42
+ 'token_str': 'fashion'},
43
+ {'score': 0.08015287667512894,
44
+ 'sequence': "Hello I'm a new model.",
45
+ 'token': 3525,
46
+ 'token_str': 'new'},
47
+ {'score': 0.033413201570510864,
48
+ 'sequence': "Hello I'm a model model.",
49
+ 'token': 3299,
50
+ 'token_str': 'model'},
51
+ {'score': 0.030217764899134636,
52
+ 'sequence': "Hello I'm a French model.",
53
+ 'token': 92265,
54
+ 'token_str': 'French'},
55
+ {'score': 0.026436051353812218,
56
+ 'sequence': "Hello I'm a sexy model.",
57
+ 'token': 17473,
58
+ 'token_str': 'sexy'}]
59
+ ```
60
+
61
+ Here is how to use this model to get the features of a given text in PyTorch:
62
+
63
+ ```python
64
+ from transformers import AutoTokenizer, AutoModelForMaskedLM
65
+
66
+ tokenizer = AutoTokenizer.from_pretrained('xlm-roberta-large')
67
+ model = AutoModelForMaskedLM.from_pretrained("xlm-roberta-large")
68
+
69
+ # prepare input
70
+ text = "Replace me by any text you'd like."
71
+ encoded_input = tokenizer(text, return_tensors='pt')
72
+
73
+ # forward pass
74
+ output = model(**encoded_input)
75
+ ```
76
+
77
+ ### BibTeX entry and citation info
78
+
79
+ ```bibtex
80
+ @article{DBLP:journals/corr/abs-1911-02116,
81
+ author = {Alexis Conneau and
82
+ Kartikay Khandelwal and
83
+ Naman Goyal and
84
+ Vishrav Chaudhary and
85
+ Guillaume Wenzek and
86
+ Francisco Guzm{\'{a}}n and
87
+ Edouard Grave and
88
+ Myle Ott and
89
+ Luke Zettlemoyer and
90
+ Veselin Stoyanov},
91
+ title = {Unsupervised Cross-lingual Representation Learning at Scale},
92
+ journal = {CoRR},
93
+ volume = {abs/1911.02116},
94
+ year = {2019},
95
+ url = {http://arxiv.org/abs/1911.02116},
96
+ eprinttype = {arXiv},
97
+ eprint = {1911.02116},
98
+ timestamp = {Mon, 11 Nov 2019 18:38:09 +0100},
99
+ biburl = {https://dblp.org/rec/journals/corr/abs-1911-02116.bib},
100
+ bibsource = {dblp computer science bibliography, https://dblp.org}
101
+ }
102
+ ```
103
+
104
+ <a href="https://huggingface.co/exbert/?model=xlm-roberta-base">
105
+ <img width="300px" src="https://cdn-media.huggingface.co/exbert/button.png">
106
+ </a>