Stojanco Tudzarski commited on
Commit
536973b
1 Parent(s): 72f4da1

initial commit

Browse files
Files changed (7) hide show
  1. README.md +61 -0
  2. config.json +25 -0
  3. lets-talk-about-nlp-sr.jpg +0 -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
+ - sr
4
+ thumbnail: https://huggingface.co/macedonizer/sr-roberta-base/lets-talk-about-nlp-sr.jpg
5
+ tags:
6
+ - masked-lm
7
+ license: Apache 2.0
8
+ datasets:
9
+ - wiki-sr
10
+ ---
11
+
12
+ # SR-RoBERTa base model
13
+ Pretrained model on Serbian 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 скопје and Скопје.
14
+
15
+ # Model description
16
+ RoBERTa is a transformers model pre-trained on a large corpus of мацед data 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/sr-roberta-base') \
31
+ unmasker("Београд је <mask> град Србије.") \
32
+
33
+ [{'score': 0.7834128141403198,
34
+ 'sequence': 'Београд је главни град Србије',
35
+ 'token': 3087,
36
+ 'token_str': ' главни'},
37
+ {'score': 0.15424974262714386,
38
+ 'sequence': 'Београд је највећи град Србије',
39
+ 'token': 3916,
40
+ 'token_str': ' највећи'},
41
+ {'score': 0.0035441946238279343,
42
+ 'sequence': 'Београд је најважнији град Србије',
43
+ 'token': 18577,
44
+ 'token_str': ' најважнији'},
45
+ {'score': 0.003132033161818981,
46
+ 'sequence': 'Београд је велики град Србије',
47
+ 'token': 2063,
48
+ 'token_str': ' велики'},
49
+ {'score': 0.0030417360831052065,
50
+ 'sequence': 'Београд је важан град Србије',
51
+ 'token': 9463,
52
+ 'token_str': ' важан'}]
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/mk-roberta-base') \
58
+ model = RobertaModel.from_pretrained('macedonizer/sr-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)
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.0",
22
+ "type_vocab_size": 1,
23
+ "use_cache": true,
24
+ "vocab_size": 52000
25
+ }
lets-talk-about-nlp-sr.jpg ADDED
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:f0c602057d2749d2798e59cfa23bbd04a02deebe39e4343a715969994a7cbf8b
3
+ size 334067506
training_args.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:69f902a66d9f65ae807b43cd33ee82fe7329233c239ff424f2bf847d8f743782
3
+ size 2479
vocab.json ADDED
The diff for this file is too large to render. See raw diff