Stojanco Tudzarski commited on
Commit
6644692
1 Parent(s): 0e46ec3

initial commit

Browse files
Files changed (7) hide show
  1. README.md +61 -0
  2. abdulah-sidran.jpg +0 -0
  3. config.json +25 -0
  4. merges.txt +0 -0
  5. pytorch_model.bin +3 -0
  6. training_args.bin +3 -0
  7. vocab.json +0 -0
README.md ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - ba
4
+ thumbnail: https://huggingface.co/macedonizer/ba-roberta-base/abdulah-sidran.jpg
5
+ tags:
6
+ - masked-lm
7
+ license: Apache 2.0
8
+ datasets:
9
+ - wiki-bs
10
+ ---
11
+
12
+ # HR-RoBERTa base model
13
+ Pretrained model on Bosnian language using a masked language modeling (MLM) objective. It was introduced in this paper and first released in this repository. This model is case-sensitive: it makes a difference between sarajevo and Sarajevo.
14
+
15
+ # Model description
16
+ RoBERTa is a transformers model pre-trained on a large corpus of Bosnian texts in a self-supervised fashion. This means it was pre-trained 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 pre-trained with the Masked language modeling (MLM) objective. Taking a sentence, the model randomly masks 15% of the words in the input then runs 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 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.
21
+
22
+ # Intended uses & limitations
23
+ 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 to look for fine-tuned versions of a task that interests you.
24
+ 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.
25
+
26
+ # How to use
27
+ You can use this model directly with a pipeline for masked language modeling: \
28
+
29
+ from transformers import pipeline \
30
+ unmasker = pipeline('fill-mask', model='macedonizer/ba-roberta-base') \
31
+ unmasker("Sarajevo je \\<mask\\> grad Bosne i Hercegovine.") \
32
+
33
+ [{'score': 0.6210788488388062, \
34
+ 'sequence': 'Sarajevo je glavni grad Bosne i Hercegovine', \
35
+ 'token': 2006, \
36
+ 'token_str': ' glavni'}, \
37
+ {'score': 0.19640550017356873, \
38
+ 'sequence': 'Sarajevo je najveći grad Bosne i Hercegovine', \
39
+ 'token': 1707, \
40
+ 'token_str': ' najveći'}, \
41
+ {'score': 0.0210184995085001, \
42
+ 'sequence': 'Sarajevo je srednjovjekovni grad Bosne i Hercegovine', \
43
+ 'token': 22596, \
44
+ 'token_str': ' srednjovjekovni'}, \
45
+ {'score': 0.010822420939803123, \
46
+ 'sequence': 'Sarajevo je najmnogoljudniji grad Bosne i Hercegovine', \
47
+ 'token': 40186, \
48
+ 'token_str': ' najmnogoljudniji'}, \
49
+ {'score': 0.006114463787525892, \
50
+ 'sequence': 'Sarajevo je službeni grad Bosne i Hercegovine', \
51
+ 'token': 8546, \
52
+ 'token_str': ' službeni'}] \
53
+
54
+ Here is how to use this model to get the features of a given text in PyTorch:
55
+
56
+ from transformers import RobertaTokenizer, RobertaModel \
57
+ tokenizer = RobertaTokenizer.from_pretrained('macedonizer/ba-roberta-base') \
58
+ model = RobertaModel.from_pretrained('macedonizer/ba-roberta-base') \
59
+ text = "Replace me by any text you'd like." \
60
+ encoded_input = tokenizer(text, return_tensors='pt') \
61
+ output = model(**encoded_input)
abdulah-sidran.jpg ADDED
config.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "RobertaForMaskedLM"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.1,
6
+ "bos_token_id": 0,
7
+ "eos_token_id": 2,
8
+ "gradient_checkpointing": false,
9
+ "hidden_act": "gelu",
10
+ "hidden_dropout_prob": 0.1,
11
+ "hidden_size": 768,
12
+ "initializer_range": 0.02,
13
+ "intermediate_size": 3072,
14
+ "layer_norm_eps": 1e-12,
15
+ "max_position_embeddings": 514,
16
+ "model_type": "roberta",
17
+ "num_attention_heads": 12,
18
+ "num_hidden_layers": 6,
19
+ "pad_token_id": 1,
20
+ "position_embedding_type": "absolute",
21
+ "transformers_version": "4.6.1",
22
+ "type_vocab_size": 1,
23
+ "use_cache": true,
24
+ "vocab_size": 52000
25
+ }
merges.txt ADDED
The diff for this file is too large to render. See raw diff
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc942a57b453670659799eda648c3c78d650fd457e5e243deb0d1a1d8f94efae
3
+ size 334067506
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6ec282ccce3b28a3238179cde8deaa7965e9ea448612d787f51848ca218a0892
3
+ size 2479
vocab.json ADDED
The diff for this file is too large to render. See raw diff