banglagov commited on
Commit
51e64bd
·
verified ·
1 Parent(s): 0d4b0c6

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +52 -4
README.md CHANGED
@@ -10,22 +10,70 @@ tags:
10
 
11
  # BERT base model for Bangla
12
 
13
- Pretrained [BERT](https://arxiv.org/abs/1810.04805) model for Bangla. The model was trained on Masked Language Modeling (MLM) and Next Sentence Prediction (NSP) tasks.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  ## Model Details
16
 
 
 
 
 
 
 
17
  This model is based on the BERT-Base architecture with 12 layers, 768 hidden size, 12 attention heads, and 110 million parameters. The model was trained on a corpus of 39 GB Bangla text data with a vocabulary size of 50k tokens. The model was trained for 1 million steps with a batch size of 440 and a learning rate of 5e-5. The model was trained on two NVIDIA GeForce A40 GPUs.
18
 
19
  ## How to use
20
 
21
  ```python
22
- from transformers import AutoModel, AutoTokenizer
23
 
24
- model = AutoModel.from_pretrained("banglagov/banBERT-Base")
25
- tokenizer = AutoTokenizer.from_pretrained("banglagov/banBERT-Base")
26
 
27
  text = "আমি বাংলায় পড়ি।"
28
 
29
  tokenized_text = tokenizer(text, return_tensors="pt")
30
  outputs = model(**tokenized_text)
 
31
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  # BERT base model for Bangla
12
 
13
+ Pretrained [BERT](https://arxiv.org/abs/1810.04805) model for Bangla. BERT (Bidirectional Encoder Representations from Transformers) is a pre-trained language
14
+ model introduced by Google's research team. BERT has significantly advanced the
15
+ state-of-the-art in various NLP tasks. Unlike traditional language models, BERT is bidirectional,
16
+ meaning it takes into account both the left and right contexts of each word during pre-training,
17
+ enabling it to better grasp the nuances of language.
18
+
19
+
20
+ ## 2.2.1 Data Details
21
+
22
+ We used 36 GB of text data to train the model. The used corpus has the following cardinalities:
23
+
24
+ | **Type** | **Count** |
25
+ |--------------------|---------------------------------------|
26
+ | Total words | 2,202,024,981 (about 2.2 billion) |
27
+ | Unique words | 22,944,811 (about 22.94 million) |
28
+ | Total sentences | 181,447,732 (about 181.45 million) |
29
+ | Total documents | 17,516,890 (about 17.52 million) |
30
+
31
+ The raw crawled text is pre-processed in several steps to produce the final 36 GB of data. The pre-processing contains the following steps:
32
+
33
+ - Normalization of text
34
+ - Cleaning text Text cleaning removes URLs, HTML tags, emojis, and multiple spaces.
35
+ - Splitting the text into sentences
36
+ - Removing sentences with fewer than 3 words or more than 50 words.
37
+ - Removing sentences containing any non-Bangla characters.
38
+ - Deduplicating the corpus at the document level.
39
+ - Ensuring each text file contains one sentence per line, with each document separated by a blank line.
40
+
41
 
42
  ## Model Details
43
 
44
+ The core architecture of BERT is based on the Transformer model, which utilizes self-attention
45
+ mechanisms to capture long-range dependencies in text efficiently. During pre-training, BERT
46
+ learns contextualized word embeddings by predicting missing words within sentences, a
47
+ process known as masked language modeling. This allows BERT to understand words in the
48
+ context of their surrounding words, leading to more meaningful and context-aware embeddings.
49
+
50
  This model is based on the BERT-Base architecture with 12 layers, 768 hidden size, 12 attention heads, and 110 million parameters. The model was trained on a corpus of 39 GB Bangla text data with a vocabulary size of 50k tokens. The model was trained for 1 million steps with a batch size of 440 and a learning rate of 5e-5. The model was trained on two NVIDIA GeForce A40 GPUs.
51
 
52
  ## How to use
53
 
54
  ```python
55
+ from transformers import BertModel, BertTokenizer
56
 
57
+ model = BertModel.from_pretrained("banglagov/banBERT-Base")
58
+ tokenizer = BertTokenizer.from_pretrained("banglagov/banBERT-Base")
59
 
60
  text = "আমি বাংলায় পড়ি।"
61
 
62
  tokenized_text = tokenizer(text, return_tensors="pt")
63
  outputs = model(**tokenized_text)
64
+ print(outputs)
65
  ```
66
+
67
+
68
+ ## Results
69
+
70
+ | **Metric** | **Train Loss** | **Eval Loss** | **Perplexity** | **NER** | **POS** | **Shallow Parsing** | **QA** |
71
+ |----------------------|----------------|---------------|----------------|----------|----------|----------------------|---------|
72
+ | Precision | - | - | - | 0.8475 | 0.8838 | 0.7396 | - |
73
+ | Recall | - | - | - | 0.7390 | 0.8543 | 0.6858 | - |
74
+ | Macro F1 | - | - | - | 0.7786 | 0.8611 | 0.7117 | 0.7396 |
75
+ | Exact Match | - | - | - | - | - | - | 0.6809 |
76
+ | Loss | 1.8633 | 1.4681 | 4.3826 | - | - | - | - |
77
+
78
+
79
+