Migrate model card from transformers-repo
Browse filesRead announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/MoseliMotsoehli/TswanaBert/README.md
README.md
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: tn
|
3 |
+
---
|
4 |
+
|
5 |
+
# TswanaBert
|
6 |
+
Pretrained model on the Tswana language using a masked language modeling (MLM) objective.
|
7 |
+
|
8 |
+
## Model Description.
|
9 |
+
TswanaBERT is a transformer model pre-trained on a corpus of Setswana in a self-supervised fashion by masking part of the input words and training to predict the masks by using byte-level tokens.
|
10 |
+
|
11 |
+
## Intended uses & limitations
|
12 |
+
The model can be used for either masked language modeling or next word prediction. It can also be fine-tuned on a specific down-stream NLP application.
|
13 |
+
|
14 |
+
#### How to use
|
15 |
+
|
16 |
+
```python
|
17 |
+
>>> from transformers import pipeline
|
18 |
+
>>> from transformers import AutoTokenizer, AutoModelWithLMHead
|
19 |
+
|
20 |
+
>>> tokenizer = AutoTokenizer.from_pretrained("MoseliMotsoehli/TswanaBert")
|
21 |
+
>>> model = AutoModelWithLMHead.from_pretrained("MoseliMotsoehli/TswanaBert")
|
22 |
+
>>> unmasker = pipeline('fill-mask', model=model, tokenizer=tokenizer)
|
23 |
+
>>> unmasker("Ntshopotse <mask> e godile.")
|
24 |
+
|
25 |
+
[{'score': 0.32749542593955994,
|
26 |
+
'sequence': '<s>Ntshopotse setse e godile.</s>',
|
27 |
+
'token': 538,
|
28 |
+
'token_str': 'Ġsetse'},
|
29 |
+
{'score': 0.060260992497205734,
|
30 |
+
'sequence': '<s>Ntshopotse le e godile.</s>',
|
31 |
+
'token': 270,
|
32 |
+
'token_str': 'Ġle'},
|
33 |
+
{'score': 0.058460816740989685,
|
34 |
+
'sequence': '<s>Ntshopotse bone e godile.</s>',
|
35 |
+
'token': 364,
|
36 |
+
'token_str': 'Ġbone'},
|
37 |
+
{'score': 0.05694682151079178,
|
38 |
+
'sequence': '<s>Ntshopotse ga e godile.</s>',
|
39 |
+
'token': 298,
|
40 |
+
'token_str': 'Ġga'},
|
41 |
+
{'score': 0.0565204992890358,
|
42 |
+
'sequence': '<s>Ntshopotse, e godile.</s>',
|
43 |
+
'token': 16,
|
44 |
+
'token_str': ','}]
|
45 |
+
```
|
46 |
+
|
47 |
+
#### Limitations and bias
|
48 |
+
The model is trained on a relatively small collection of setwana, mostly from news articles and creative writtings, and so is not representative enough of the language as yet.
|
49 |
+
|
50 |
+
## Training data
|
51 |
+
|
52 |
+
1. The largest portion of this dataset (10k) sentences of text, comes from the [Leipzig Corpora Collection](https://wortschatz.uni-leipzig.de/en/download)
|
53 |
+
|
54 |
+
2. I Then added SABC news headlines collected by Marivate Vukosi, & Sefara Tshephisho, (2020) that is generously made available on [zenoodo](http://doi.org/10.5281/zenodo.3668495 ). This added 185 tswana sentences to my corpus.
|
55 |
+
|
56 |
+
3. I went on to add 300 more sentences by scrapping following news sites and blogs that mosty originate in Botswana. I actively continue to expand the dataset.
|
57 |
+
|
58 |
+
* http://setswana.blogspot.com/
|
59 |
+
* https://omniglot.com/writing/tswana.php
|
60 |
+
* http://www.dailynews.gov.bw/
|
61 |
+
* http://www.mmegi.bw/index.php
|
62 |
+
* https://tsena.co.bw
|
63 |
+
* http://www.botswana.co.za/Cultural_Issues-travel/botswana-country-guide-en-route.html
|
64 |
+
* https://www.poemhunter.com/poem/2013-setswana/
|
65 |
+
https://www.poemhunter.com/poem/ngwana-wa-mosetsana/
|
66 |
+
|
67 |
+
|
68 |
+
### BibTeX entry and citation info
|
69 |
+
|
70 |
+
```bibtex
|
71 |
+
@inproceedings{author = {Moseli Motsoehli},
|
72 |
+
year={2020}
|
73 |
+
}
|
74 |
+
```
|