Initial release: OdiaGPT-30M trained from scratch
Browse files- README.md +76 -0
- config.json +32 -0
- generation_config.json +10 -0
- model.safetensors +3 -0
- special_tokens_map.json +6 -0
- tokenizer.model +3 -0
- tokenizer_config.json +11 -0
README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- or
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
tags:
|
| 6 |
+
- odia
|
| 7 |
+
- odiagpt
|
| 8 |
+
- transformer-from-scratch
|
| 9 |
+
- indic
|
| 10 |
+
- causal-lm
|
| 11 |
+
pipeline_tag: text-generation
|
| 12 |
+
widget:
|
| 13 |
+
- text: "ଓଡ଼ିଶାର ଲୋକମାନେ"
|
| 14 |
+
- text: "ଆଜି ସକାଳେ"
|
| 15 |
+
- text: "ଓଡ଼ିଆ ଭାଷାର"
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# OdiaGPT-30M (Pretrained from Scratch)
|
| 19 |
+
|
| 20 |
+
**OdiaGPT-30M** is an autoregressive decoder-only Transformer built and trained **completely from scratch** for the Odia language.
|
| 21 |
+
|
| 22 |
+
It does **not** use pretrained GPT-2, Llama, or Indic model weights, nor off-the-shelf tokenizers. All 31.5 million parameters began from random Gaussian initialization, and its 8,192-token BPE tokenizer was trained exclusively on a cleaned subset of the AI4Bharat Sangraha Odia corpus.
|
| 23 |
+
|
| 24 |
+
## Model Summary
|
| 25 |
+
- **Organization / Creator**: [CodeHima](https://huggingface.co/CodeHima)
|
| 26 |
+
- **Architecture**: Decoder-only Transformer (Llama-compatible)
|
| 27 |
+
- **Parameters**: 31,465,984 (~31.5M)
|
| 28 |
+
- **Layers**: 8
|
| 29 |
+
- **Hidden dimension**: 512 (8 attention heads, head dimension: 64)
|
| 30 |
+
- **Feed-Forward**: SwiGLU ($d_{ff} = 1536$)
|
| 31 |
+
- **Positional Encoding**: Rotary Position Embeddings (RoPE, base 10000.0)
|
| 32 |
+
- **Normalization**: RMSNorm ($\epsilon = 10^{-6}$)
|
| 33 |
+
- **Context Length**: 512
|
| 34 |
+
- **Vocabulary**: 8,192 (SentencePiece BPE with byte fallback)
|
| 35 |
+
- **Precision**: FP16 (Safetensors format)
|
| 36 |
+
|
| 37 |
+
## Training Dynamics
|
| 38 |
+
- **Dataset**: AI4Bharat Sangraha (`verified/ori`) — 28.5M tokens / 110M cleaned characters
|
| 39 |
+
- **Tokens Seen**: ~29.5 Million tokens (1,800 steps)
|
| 40 |
+
- **Initial Loss**: 9.07 -> **Final Validation Loss**: 4.664 (Perplexity: **106.09**)
|
| 41 |
+
- **Hardware**: Single NVIDIA Tesla T4 on Google Colab (~35,200 tokens/sec)
|
| 42 |
+
|
| 43 |
+
## Usage with Hugging Face Transformers
|
| 44 |
+
|
| 45 |
+
```python
|
| 46 |
+
import torch
|
| 47 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 48 |
+
|
| 49 |
+
model_id = "CodeHima/OdiaGPT-30M"
|
| 50 |
+
|
| 51 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 52 |
+
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16).cuda()
|
| 53 |
+
|
| 54 |
+
prompt = "ଓଡ଼ିଶାର ଲୋକମାନେ"
|
| 55 |
+
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
| 56 |
+
|
| 57 |
+
outputs = model.generate(
|
| 58 |
+
**inputs,
|
| 59 |
+
max_new_tokens=64,
|
| 60 |
+
temperature=0.8,
|
| 61 |
+
top_k=50,
|
| 62 |
+
top_p=0.9,
|
| 63 |
+
repetition_penalty=1.15,
|
| 64 |
+
do_sample=True
|
| 65 |
+
)
|
| 66 |
+
|
| 67 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
## Sample Output
|
| 71 |
+
> **Prompt**: `ଆଜି ସକାଳେ`
|
| 72 |
+
> **Completion**: *ଆଜି ସକାଳେ ସକାଳେ ଦୁଇ ଝିଅ ସହ ଆସି ଶୋଇପଡ଼ିଲା । ସେହି ସମୟରେ ବାପା ଘର ଲୋକ କୁ ଖବର ଦେଇ କହିଥିଲେ ଯେ, "ତେବେ ମାଆ, ତମେ ଆଉ କିଛି କହିଦେବୁ । ମୁଁ ଏ କଥା କିଛି ଶୁଣିନାହିଁ ।"*
|
| 73 |
+
|
| 74 |
+
## Limitations
|
| 75 |
+
- Base foundation model, not instruction-tuned.
|
| 76 |
+
- Developed as part of the OdiaGPT from-scratch educational curriculum.
|
config.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"LlamaForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 2,
|
| 8 |
+
"dtype": "float16",
|
| 9 |
+
"eos_token_id": 3,
|
| 10 |
+
"head_dim": 64,
|
| 11 |
+
"hidden_act": "silu",
|
| 12 |
+
"hidden_size": 512,
|
| 13 |
+
"initializer_range": 0.02,
|
| 14 |
+
"intermediate_size": 1536,
|
| 15 |
+
"max_position_embeddings": 512,
|
| 16 |
+
"mlp_bias": false,
|
| 17 |
+
"model_type": "llama",
|
| 18 |
+
"num_attention_heads": 8,
|
| 19 |
+
"num_hidden_layers": 8,
|
| 20 |
+
"num_key_value_heads": 8,
|
| 21 |
+
"pad_token_id": 0,
|
| 22 |
+
"pretraining_tp": 1,
|
| 23 |
+
"rms_norm_eps": 1e-06,
|
| 24 |
+
"rope_parameters": {
|
| 25 |
+
"rope_theta": 10000.0,
|
| 26 |
+
"rope_type": "default"
|
| 27 |
+
},
|
| 28 |
+
"tie_word_embeddings": true,
|
| 29 |
+
"transformers_version": "5.16.1",
|
| 30 |
+
"use_cache": true,
|
| 31 |
+
"vocab_size": 8192
|
| 32 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 2,
|
| 4 |
+
"eos_token_id": 3,
|
| 5 |
+
"output_attentions": false,
|
| 6 |
+
"output_hidden_states": false,
|
| 7 |
+
"pad_token_id": 0,
|
| 8 |
+
"transformers_version": "5.16.1",
|
| 9 |
+
"use_cache": true
|
| 10 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a00fe5d9d493cfb7b01f8bfea5e0d31f3debad2805eace598c9b523272ec101f
|
| 3 |
+
size 62940032
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": "<bos>",
|
| 3 |
+
"eos_token": "<eos>",
|
| 4 |
+
"pad_token": "<pad>",
|
| 5 |
+
"unk_token": "<unk>"
|
| 6 |
+
}
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:26b8026425d1e4f58f9acc6c7334968de2885988a824c005574e2baa079e6dfb
|
| 3 |
+
size 191665
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": true,
|
| 3 |
+
"add_eos_token": false,
|
| 4 |
+
"bos_token": "<bos>",
|
| 5 |
+
"eos_token": "<eos>",
|
| 6 |
+
"pad_token": "<pad>",
|
| 7 |
+
"unk_token": "<unk>",
|
| 8 |
+
"clean_up_tokenization_spaces": false,
|
| 9 |
+
"model_max_length": 512,
|
| 10 |
+
"tokenizer_class": "LlamaTokenizer"
|
| 11 |
+
}
|