macedonizer
commited on
Commit
•
1148920
1
Parent(s):
1557613
Update README.md
Browse files
README.md
CHANGED
@@ -24,11 +24,11 @@ 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("Η Αθήνα είναι η
|
32 |
|
33 |
[{'score': 0.8832866549491882, \
|
34 |
'sequence': 'Η Αθήνα είναι η πρωτεύουσα της Ελλάδας', \
|
@@ -53,9 +53,9 @@ unmasker("Η Αθήνα είναι η \\\\<mask\\\\> της Ελλάδας") \
|
|
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': 'Η Αθήνα είναι η πρωτεύουσα της Ελλάδας', \
|
|
|
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)
|