Update README.md
Browse files
README.md
CHANGED
@@ -1,61 +1,120 @@
|
|
1 |
---
|
2 |
-
|
3 |
-
|
4 |
-
base_model: google/gemma-2-2b
|
5 |
tags:
|
6 |
-
-
|
7 |
-
-
|
8 |
-
-
|
9 |
-
|
10 |
-
-
|
11 |
-
|
|
|
|
|
|
|
|
|
12 |
---
|
13 |
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
-
|
18 |
|
19 |
-
|
20 |
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
More information needed
|
24 |
|
25 |
-
##
|
26 |
|
27 |
-
|
28 |
|
29 |
-
|
|
|
30 |
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
###
|
36 |
|
37 |
-
|
38 |
-
-
|
39 |
-
-
|
40 |
-
-
|
41 |
-
-
|
42 |
-
- distributed_type: multi-GPU
|
43 |
-
- num_devices: 8
|
44 |
-
- gradient_accumulation_steps: 8
|
45 |
-
- total_train_batch_size: 192
|
46 |
-
- total_eval_batch_size: 64
|
47 |
-
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
48 |
-
- lr_scheduler_type: cosine
|
49 |
-
- lr_scheduler_warmup_ratio: 0.01
|
50 |
-
- num_epochs: 1.0
|
51 |
|
52 |
-
|
|
|
|
|
|
|
|
|
|
|
53 |
|
|
|
54 |
|
|
|
55 |
|
56 |
-
### Framework versions
|
57 |
|
58 |
-
|
59 |
-
-
|
60 |
-
-
|
61 |
-
-
|
|
|
1 |
---
|
2 |
+
language:
|
3 |
+
- bn
|
|
|
4 |
tags:
|
5 |
+
- hishab
|
6 |
+
- titulm
|
7 |
+
- pytorch
|
8 |
+
- gemma
|
9 |
+
- gemma-2
|
10 |
+
license: gemma
|
11 |
+
library_name: transformers
|
12 |
+
pipeline_tag: text-generation
|
13 |
+
base_model:
|
14 |
+
- google/gemma-2-2b
|
15 |
---
|
16 |
|
17 |
+
## Model Information
|
18 |
+
|
19 |
+
This model is a continually pretrained version of the [google/gemma-2-2b](https://huggingface.co/google/gemma-2-2b) architecture, fine-tuned on extensive Bangla datasets. The primary goal of the continual pretraining was to enhance the model's ability to generate high-quality Bangla text. By extending the pretraining process specifically on Bangla data, the model has demonstrated superior performance in tasks related to Bangla language understanding evaluation benchmarks and text generation.
|
20 |
+
|
21 |
+
**Model Architecture:** Gemma 2 is an auto-regressive language model that uses an optimized transformer architecture.
|
22 |
+
|
23 |
+
| | Training Data | Params | Input modalities | Output modalities | Context Length | Token count |
|
24 |
+
| :---- | :---- | :---- | :---- | :---- | :---- | :---- |
|
25 |
+
| Gemma 2 | Hishab curated Bangla text corpus | 2B | Monolingual Text(Bangla) | Monolingual Text(Bangla) | 4096 | 4.4B tokens | |
|
26 |
+
|
27 |
+
### How To Use
|
28 |
+
|
29 |
+
Below we share some code snippets on how to get quickly started with running the model. First, install the Transformers library with:
|
30 |
+
```sh
|
31 |
+
pip install -U transformers
|
32 |
+
```
|
33 |
+
|
34 |
+
Then, copy the snippet from the section that is relevant for your usecase.
|
35 |
+
|
36 |
+
#### Running with the `pipeline` API
|
37 |
+
|
38 |
+
```python
|
39 |
+
import torch
|
40 |
+
from transformers import pipeline
|
41 |
+
|
42 |
+
pipe = pipeline(
|
43 |
+
"text-generation",
|
44 |
+
model="titulm-gemma-2-2b-v1.1",
|
45 |
+
device="cuda", # replace with "mps" to run on a Mac device
|
46 |
+
)
|
47 |
+
|
48 |
+
text = "আমাদের দেশের নাম"
|
49 |
+
outputs = pipe(text, max_new_tokens=256)
|
50 |
+
response = outputs[0]["generated_text"]
|
51 |
+
print(response)
|
52 |
+
```
|
53 |
+
|
54 |
+
|
55 |
+
## Hardware and Software
|
56 |
+
|
57 |
+
**Training Factors:** We used [llama-factory]() training library, Cloud GPU cluster, and production infrastructure for pretraining. Fine-tuning, annotation, and evaluation were also performed on cloud infrastructure.
|
58 |
+
|
59 |
|
60 |
+
## Training Data
|
61 |
|
62 |
+
**Overview:** We have collected a large Bangla raw dataset of text data from a wide variety of sources. Our collected data so far includes a mix of web documents, books, translated text, transliterated text, transcribe text, code-mixed text, conversations, and open sources raw data. The dataset is cleaned and filtered by different filtering criteria to ensure the quality of the data. Our collected data size roughly around 268 GB. We separated __33GB__ data from that using a ratio of the data actual data size. Total trained tokens are __4.4B__ tokens.
|
63 |
|
64 |
+
Data sources summary:
|
65 |
+
- Web documents: Extract, clean, filter common crawl data
|
66 |
+
- Books: Extract, clean, filter books data
|
67 |
+
- Transcribed text: Used in-house Bangla ASR model to transcribe Bangla audio data
|
68 |
+
- Translation data: We trained a Bangla-English translation LLM model and used it to translate English data to Bangla
|
69 |
+
- Code-mixed data: We trained a Bangla-English code-mixed LLM model and used it to generate code-mixed data
|
70 |
+
- Transliteration data: We trained a Bangla-English transliteration LLM model and used it to generate transliterated data
|
71 |
+
- Synthetic data: We generated synthetic data using a Bangla LLM model
|
72 |
+
- Others: We scrap some selected websites data, used open-sources data, and used some other data sources
|
73 |
|
|
|
74 |
|
75 |
+
## Benchmarks
|
76 |
|
77 |
+
In this section, we report the results for __titulm-gemma-2-2b-v1.1__ models on standard automatic benchmarks. For all these evaluations, we used [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness) evaluations library.
|
78 |
|
79 |
+
### Evaluation Datasets
|
80 |
+
We evaluated our pretrained models on both Bangla and English benchmark datasets. Although the model is trained on Bangla data, it's English capability is also evaluated on English benchmark datasets. The evaluation datasets are as follows:
|
81 |
|
82 |
+
#### Bangla Benchmark datasets
|
83 |
+
We evaluated the models on the following datasets:
|
84 |
+
- [Bangla MMLU](): A privated multiple choice questions datasets developed by Hishab curated from various sources.
|
85 |
+
- [CommonsenseQa Bangla](https://huggingface.co/datasets/hishab/commonsenseqa-bn): A Bangla translation of the CommonsenseQA dataset. The dataset was translated using a new method called Expressive Semantic Translation (EST), which combines Google Machine Translation with LLM-based rewriting modifications.
|
86 |
+
- [OpenbookQA Bangla](https://huggingface.co/datasets/hishab/openbookqa-bn): A Bangla translation of the OpenbookQA dataset. The dataset was translated using a new method called Expressive Semantic Translation (EST), which combines Google Machine Translation with LLM-based rewriting modifications.
|
87 |
+
- [Piqa Bangla](https://huggingface.co/datasets/hishab/piqa-bn): A Bangla translation of the Piqa dataset. The dataset was translated using a new method called Expressive Semantic Translation (EST), which combines Google Machine Translation with LLM-based rewriting modifications.
|
88 |
+
- [BoolQ Bangla](https://huggingface.co/datasets/hishab/boolq_bn): The dataset contains 15,942 examples, with each entry consisting of a triplet: (question, passage, answer). The questions are naturally occurring, generated from unprompted and unconstrained settings. Input passages were sourced from Bangla Wikipedia, Banglapedia, and News Articles, and GPT-4 was used to generate corresponding yes/no questions with answers.
|
89 |
|
90 |
+
#### English Benchmark datasets
|
91 |
+
- [MMLU](https://huggingface.co/datasets/cais/mmlu): This is a massive multitask test consisting of multiple-choice questions from various branches of knowledge.
|
92 |
+
- [CommonseQa](https://huggingface.co/datasets/tau/commonsense_qa): CommonsenseQA is a new multiple-choice question answering dataset that requires different types of commonsense knowledge to predict the correct answers .
|
93 |
+
- [OpenbookQA](https://huggingface.co/datasets/allenai/openbookqa): OpenBookQA aims to promote research in advanced question-answering, probing a deeper understanding of both the topic (with salient facts summarized as an open book, also provided with the dataset) and the language it is expressed in.
|
94 |
+
- [Piqa](https://huggingface.co/datasets/ybisk/piqa): The PIQA dataset focuses on physical commonsense reasoning, challenging AI to handle everyday situations requiring practical knowledge and unconventional solutions. Inspired by instructables.com, it aims to enhance AI's ability to understand and reason about physical interactions.
|
95 |
+
- [BoolQ](https://huggingface.co/datasets/google/boolq): BoolQ is a question answering dataset for yes/no questions containing 15942 examples. These questions are naturally occurring ---they are generated in unprompted and unconstrained settings. Each example is a triplet of (question, passage, answer), with the title of the page as optional additional context. The text-pair classification setup is similar to existing natural language inference tasks.
|
96 |
|
97 |
+
### Evaluation Results
|
98 |
|
99 |
+
#### Evaluation on Bangla Benchmark datasets
|
100 |
+
- **gemma-2-2b** shows stronger performance in **Bangla MMLU** and **BoolQ BN** in the 0-shot setting.
|
101 |
+
- **titulm-gemma-2-2b-v1.1** performs better in **Commonsense QA BN**, **OpenBook QA BN**, and **PIQA BN** across both 0-shot and 5-shot settings.
|
102 |
+
- In the 5-shot setting, **titulm-gemma-2-2b-v1.1** leads in **BoolQ BN**, **Commonsense QA BN**, and **OpenBook QA BN**.
|
103 |
+
- **PIQA BN** scores are close, with **titulm-gemma-2-2b-v1.1** having a slight edge in the 0-shot setting.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
+
| Model | Shots | Bangla MMLU | BoolQ BN | Commonsense QA BN | OpenBook QA BN | PIQA BN |
|
106 |
+
|--------------------------|---------|-------------|----------|-------------------|----------------|---------|
|
107 |
+
| gemma-2-2b | 0-shot | **0.32** | **0.63** | 0.26 | 0.34 | 0.56 |
|
108 |
+
| | 5-shot | **0.35** | 0.46 | 0.28 | 0.33 | **0.56**|
|
109 |
+
| titulm-gemma-2-2b-v1.1 | 0-shot | 0.30 | 0.61 | **0.31** | **0.35** | **0.62**|
|
110 |
+
| | 5-shot | 0.35 | **0.57** | **0.40** | **0.38** | 0.60 |
|
111 |
|
112 |
+
#### Evaluation on English Benchmark datasets
|
113 |
|
114 |
+
### Instruction Tuned Models
|
115 |
|
|
|
116 |
|
117 |
+
### Intended Use
|
118 |
+
- Bangla text generation
|
119 |
+
- Bangla language understanding tasks
|
120 |
+
- Bangla instruction fine-tuning tasks
|