update README
Browse files
README.md
CHANGED
@@ -18,27 +18,27 @@ This repository is based on the following open source projects: [google-research
|
|
18 |
#### How to use
|
19 |
|
20 |
```python
|
21 |
-
from transformers import pipeline, AutoTokenizer,
|
22 |
|
23 |
tokenizer = AutoTokenizer.from_pretrained('tugstugi/bert-base-mongolian-cased')
|
24 |
-
model =
|
25 |
|
26 |
## declare task ##
|
27 |
pipe = pipeline(task="fill-mask", model=model, tokenizer=tokenizer)
|
28 |
|
29 |
## example ##
|
30 |
-
input_ = '
|
31 |
|
32 |
output_ = pipe(input_)
|
33 |
for i in range(len(output_)):
|
34 |
print(output_[i])
|
35 |
|
36 |
-
##
|
37 |
-
# {'sequence': 'Улаанбаатар
|
38 |
-
# {'sequence': '
|
39 |
-
# {'sequence': '
|
40 |
-
# {'sequence': '
|
41 |
-
# {'sequence': '
|
42 |
```
|
43 |
|
44 |
|
|
|
18 |
#### How to use
|
19 |
|
20 |
```python
|
21 |
+
from transformers import pipeline, AutoTokenizer, AutoModelForMaskedLM
|
22 |
|
23 |
tokenizer = AutoTokenizer.from_pretrained('tugstugi/bert-base-mongolian-cased')
|
24 |
+
model = AutoModelForMaskedLM.from_pretrained('tugstugi/bert-base-mongolian-cased')
|
25 |
|
26 |
## declare task ##
|
27 |
pipe = pipeline(task="fill-mask", model=model, tokenizer=tokenizer)
|
28 |
|
29 |
## example ##
|
30 |
+
input_ = '[MASK] хот Монгол улсын нийслэл.'
|
31 |
|
32 |
output_ = pipe(input_)
|
33 |
for i in range(len(output_)):
|
34 |
print(output_[i])
|
35 |
|
36 |
+
## output ##
|
37 |
+
# {'sequence': 'Улаанбаатар хот Монгол улсын нийслэл.', 'score': 0.826970100402832, 'token': 281, 'token_str': 'Улаанбаатар'}
|
38 |
+
# {'sequence': 'Нийслэл хот Монгол улсын нийслэл.', 'score': 0.06551621109247208, 'token': 4059, 'token_str': 'Нийслэл'}
|
39 |
+
# {'sequence': 'Эрдэнэт хот Монгол улсын нийслэл.', 'score': 0.0264141745865345, 'token': 2229, 'token_str': 'Эрдэнэт'}
|
40 |
+
# {'sequence': 'Дархан хот Монгол улсын нийслэл.', 'score': 0.017083868384361267, 'token': 1646, 'token_str': 'Дархан'}
|
41 |
+
# {'sequence': 'УБ хот Монгол улсын нийслэл.', 'score': 0.010854342952370644, 'token': 7389, 'token_str': 'УБ'}
|
42 |
```
|
43 |
|
44 |
|