r4j4n commited on
Commit ·
996c3b8
1
Parent(s): 14d5daa
🤗🤗🤗🤗
Browse files
README.md
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# NepaliBERT(Phase 1)
|
| 3 |
+
NEPALIBERT is a state-of-the-art language model for Nepali based on the BERT model. The model is trained using a masked language modeling (MLM).
|
| 4 |
+
|
| 5 |
+
# Loading the model and tokenizer
|
| 6 |
+
1. clone the model repo
|
| 7 |
+
```
|
| 8 |
+
git lfs install
|
| 9 |
+
git clone https://huggingface.co/Rajan/NepaliBERT
|
| 10 |
+
```
|
| 11 |
+
2. Loading the Tokenizer
|
| 12 |
+
```
|
| 13 |
+
from transformers import BertTokenizer
|
| 14 |
+
vocab_file_dir = './NepaliBERT/'
|
| 15 |
+
tokenizer = BertTokenizer.from_pretrained(vocab_file_dir,
|
| 16 |
+
strip_accents=False,
|
| 17 |
+
clean_text=False )
|
| 18 |
+
```
|
| 19 |
+
3. Loading the model:
|
| 20 |
+
```
|
| 21 |
+
from transformers import BertForMaskedLM
|
| 22 |
+
model = BertForMaskedLM.from_pretrained('./NepaliBERT')
|
| 23 |
+
```
|
| 24 |
+
|
| 25 |
+
The easiest way to check whether our language model is learning anything interesting is via the ```FillMaskPipeline```.
|
| 26 |
+
|
| 27 |
+
Pipelines are simple wrappers around tokenizers and models, and the 'fill-mask' one will let you input a sequence containing a masked token (here, [mask]) and return a list of the most probable filled sequences, with their probabilities.
|
| 28 |
+
|
| 29 |
+
```
|
| 30 |
+
from transformers import pipeline
|
| 31 |
+
|
| 32 |
+
fill_mask = pipeline(
|
| 33 |
+
"fill-mask",
|
| 34 |
+
model=model,
|
| 35 |
+
tokenizer=tokenizer
|
| 36 |
+
)
|
| 37 |
+
```
|
| 38 |
+
For more info visit the [GITHUB🤗](https://github.com/R4j4n/NepaliBERT)
|