macedonizer commited on
Commit
eb9bc56
1 Parent(s): 801ae22

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +31 -31
README.md CHANGED
@@ -24,38 +24,38 @@ You can use the raw model for masked language modeling, but it's mostly intended
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/gr-roberta-base') \\
31
- unmasker("Η Αθήνα είναι η \<mask\> της Ελλάδας") \\
32
-
33
- [{'score': 0.8832866549491882, \
34
- 'sequence': 'Η Αθήνα είναι η πρωτεύουσα της Ελλάδας', \
35
- 'token': 2788, \
36
- 'token_str': ' πρωτεύουσα'}, \
37
- {'score': 0.018105432391166687, \
38
- 'sequence': 'Η Αθήνα είναι η μεγαλύτερη της Ελλάδας', \
39
- 'token': 2363, \
40
- 'token_str': ' μεγαλύτερη'}, \
41
- {'score': 0.015836946666240692, \
42
- 'sequence': 'Η Αθήνα είναι η έδρα της Ελλάδας', \
43
- 'token': 1950, \
44
- 'token_str': ' έδρα'}, \
45
- {'score': 0.015673324465751648, \
46
- 'sequence': 'Η Αθήνα είναι η μόνη της Ελλάδας', \
47
- 'token': 6548, \
48
- 'token_str': ' μόνη'}, \
49
- {'score': 0.01375910360366106, \
50
- 'sequence': 'Η Αθήνα είναι η πόλη της Ελλάδας', \
51
- 'token': 825, \
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/gr-roberta-base') \\
58
- model = RobertaModel.from_pretrained('macedonizer/gr-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)
 
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/gr-roberta-base') \\\\
31
+ unmasker("Η Αθήνα είναι η \\<mask\\> της Ελλάδας") \\\\
32
+
33
+ [{'score': 0.8832866549491882, \\
34
+ 'sequence': 'Η Αθήνα είναι η πρωτεύουσα της Ελλάδας', \\
35
+ 'token': 2788, \\
36
+ 'token_str': ' πρωτεύουσα'}, \\
37
+ {'score': 0.018105432391166687, \\
38
+ 'sequence': 'Η Αθήνα είναι η μεγαλύτερη της Ελλάδας', \\
39
+ 'token': 2363, \\
40
+ 'token_str': ' μεγαλύτερη'}, \\
41
+ {'score': 0.015836946666240692, \\
42
+ 'sequence': 'Η Αθήνα είναι η έδρα της Ελλάδας', \\
43
+ 'token': 1950, \\
44
+ 'token_str': ' έδρα'}, \\
45
+ {'score': 0.015673324465751648, \\
46
+ 'sequence': 'Η Αθήνα είναι η μόνη της Ελλάδας', \\
47
+ 'token': 6548, \\
48
+ 'token_str': ' μόνη'}, \\
49
+ {'score': 0.01375910360366106, \\
50
+ 'sequence': 'Η Αθήνα είναι η πόλη της Ελλάδας', \\
51
+ 'token': 825, \\
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/gr-roberta-base') \\\\
58
+ model = RobertaModel.from_pretrained('macedonizer/gr-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)