Text Generation
Transformers
Safetensors
Telugu
llama
telugu
causal-lm
sentencepiece
gqa
weight-sharing
from-scratch
text-generation-inference
Instructions to use dvitvaai/pothana-sp-base-300M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dvitvaai/pothana-sp-base-300M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="dvitvaai/pothana-sp-base-300M")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("dvitvaai/pothana-sp-base-300M") model = AutoModelForCausalLM.from_pretrained("dvitvaai/pothana-sp-base-300M", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use dvitvaai/pothana-sp-base-300M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "dvitvaai/pothana-sp-base-300M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dvitvaai/pothana-sp-base-300M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/dvitvaai/pothana-sp-base-300M
- SGLang
How to use dvitvaai/pothana-sp-base-300M with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "dvitvaai/pothana-sp-base-300M" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dvitvaai/pothana-sp-base-300M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "dvitvaai/pothana-sp-base-300M" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dvitvaai/pothana-sp-base-300M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use dvitvaai/pothana-sp-base-300M with Docker Model Runner:
docker model run hf.co/dvitvaai/pothana-sp-base-300M
Upload folder using huggingface_hub
Browse files- README.md +9 -7
- tokenizer_class.py +19 -0
- tokenizer_config.json +6 -0
README.md
CHANGED
|
@@ -16,7 +16,7 @@ pipeline_tag: text-generation
|
|
| 16 |
|
| 17 |
# Pothana Base 300M
|
| 18 |
|
| 19 |
-
A **
|
| 20 |
|
| 21 |
Named after [Bammera Pothana](https://en.wikipedia.org/wiki/Bammera_Pothana), the celebrated 15th-century Telugu poet who authored the *Andhra Maha Bhagavatamu*.
|
| 22 |
|
|
@@ -28,9 +28,9 @@ Developed by **[Dvitva AI](https://dvitva.ai)**.
|
|
| 28 |
|---|---|
|
| 29 |
| **Model** | pothana-base-300M |
|
| 30 |
| **Architecture** | LLaMA (RoPE + SwiGLU + RMSNorm + GQA) |
|
| 31 |
-
| **Parameters** |
|
| 32 |
| **Hidden size** | 1024 |
|
| 33 |
-
| **Layers** | 60 |
|
| 34 |
| **Attention heads** | 16 Q / 4 KV (Grouped Query Attention) |
|
| 35 |
| **Intermediate size** | 2816 |
|
| 36 |
| **Context length** | 2048 |
|
|
@@ -46,11 +46,13 @@ Developed by **[Dvitva AI](https://dvitva.ai)**.
|
|
| 46 |
```python
|
| 47 |
from transformers import pipeline
|
| 48 |
|
| 49 |
-
pipe = pipeline("text-generation", model="dvitvaai/pothana-base-300M")
|
| 50 |
result = pipe("తెలుగు భాష", max_new_tokens=50, do_sample=True, temperature=0.8)
|
| 51 |
print(result[0]["generated_text"])
|
| 52 |
```
|
| 53 |
|
|
|
|
|
|
|
| 54 |
### Manual loading
|
| 55 |
|
| 56 |
```python
|
|
@@ -58,7 +60,7 @@ from transformers import AutoModelForCausalLM, AutoTokenizer
|
|
| 58 |
import torch
|
| 59 |
|
| 60 |
model = AutoModelForCausalLM.from_pretrained("dvitvaai/pothana-base-300M")
|
| 61 |
-
tokenizer = AutoTokenizer.from_pretrained("dvitvaai/pothana-base-300M")
|
| 62 |
|
| 63 |
text = "తెలుగు భాష చాలా అందమైనది"
|
| 64 |
inputs = tokenizer(text, return_tensors="pt")
|
|
@@ -88,7 +90,7 @@ This model uses a **SentencePiece Unigram** tokenizer with a 48K vocabulary, tra
|
|
| 88 |
|
| 89 |
Key features:
|
| 90 |
- **Grouped Query Attention (GQA)**: 16 query heads, 4 KV heads — 4x KV cache reduction
|
| 91 |
-
- **Block-wise Weight Sharing**:
|
| 92 |
- **SwiGLU MLP** with 2816 intermediate size
|
| 93 |
- **RoPE** positional encoding (theta=10000.0)
|
| 94 |
- **RMSNorm** (no bias in any linear layer)
|
|
@@ -106,7 +108,7 @@ Key features:
|
|
| 106 |
|
| 107 |
- This is a **base model** (not instruction-tuned) — it performs text completion, not instruction following
|
| 108 |
- Trained primarily on Telugu text; limited multilingual capability
|
| 109 |
-
- Small model size (
|
| 110 |
|
| 111 |
## License
|
| 112 |
|
|
|
|
| 16 |
|
| 17 |
# Pothana Base 300M
|
| 18 |
|
| 19 |
+
A **387M parameter** LLaMA-style language model trained **from scratch** on Telugu text.
|
| 20 |
|
| 21 |
Named after [Bammera Pothana](https://en.wikipedia.org/wiki/Bammera_Pothana), the celebrated 15th-century Telugu poet who authored the *Andhra Maha Bhagavatamu*.
|
| 22 |
|
|
|
|
| 28 |
|---|---|
|
| 29 |
| **Model** | pothana-base-300M |
|
| 30 |
| **Architecture** | LLaMA (RoPE + SwiGLU + RMSNorm + GQA) |
|
| 31 |
+
| **Parameters** | 387M (unique) |
|
| 32 |
| **Hidden size** | 1024 |
|
| 33 |
+
| **Layers** | 30 unique (60 effective via weight sharing) |
|
| 34 |
| **Attention heads** | 16 Q / 4 KV (Grouped Query Attention) |
|
| 35 |
| **Intermediate size** | 2816 |
|
| 36 |
| **Context length** | 2048 |
|
|
|
|
| 46 |
```python
|
| 47 |
from transformers import pipeline
|
| 48 |
|
| 49 |
+
pipe = pipeline("text-generation", model="dvitvaai/pothana-base-300M", trust_remote_code=True)
|
| 50 |
result = pipe("తెలుగు భాష", max_new_tokens=50, do_sample=True, temperature=0.8)
|
| 51 |
print(result[0]["generated_text"])
|
| 52 |
```
|
| 53 |
|
| 54 |
+
> **Note**: `trust_remote_code=True` is required for the custom tokenizer that cleans up SentencePiece word boundary markers for readable output.
|
| 55 |
+
|
| 56 |
### Manual loading
|
| 57 |
|
| 58 |
```python
|
|
|
|
| 60 |
import torch
|
| 61 |
|
| 62 |
model = AutoModelForCausalLM.from_pretrained("dvitvaai/pothana-base-300M")
|
| 63 |
+
tokenizer = AutoTokenizer.from_pretrained("dvitvaai/pothana-base-300M", trust_remote_code=True)
|
| 64 |
|
| 65 |
text = "తెలుగు భాష చాలా అందమైనది"
|
| 66 |
inputs = tokenizer(text, return_tensors="pt")
|
|
|
|
| 90 |
|
| 91 |
Key features:
|
| 92 |
- **Grouped Query Attention (GQA)**: 16 query heads, 4 KV heads — 4x KV cache reduction
|
| 93 |
+
- **Block-wise Weight Sharing**: 30 unique blocks, each used twice = 60 effective layers (MobileLLM-LS)
|
| 94 |
- **SwiGLU MLP** with 2816 intermediate size
|
| 95 |
- **RoPE** positional encoding (theta=10000.0)
|
| 96 |
- **RMSNorm** (no bias in any linear layer)
|
|
|
|
| 108 |
|
| 109 |
- This is a **base model** (not instruction-tuned) — it performs text completion, not instruction following
|
| 110 |
- Trained primarily on Telugu text; limited multilingual capability
|
| 111 |
+
- Small model size (387M) limits reasoning and knowledge capacity
|
| 112 |
|
| 113 |
## License
|
| 114 |
|
tokenizer_class.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Custom Telugu SentencePiece tokenizer with clean decode output."""
|
| 2 |
+
from transformers import LlamaTokenizer
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
class TeluguSPTokenizer(LlamaTokenizer):
|
| 6 |
+
"""Telugu SentencePiece tokenizer that produces clean decoded text.
|
| 7 |
+
|
| 8 |
+
Extends LlamaTokenizer to clean up SentencePiece's ▁ (U+2581) word
|
| 9 |
+
boundary markers, producing natural text output.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
def decode(self, token_ids, skip_special_tokens=False, **kwargs):
|
| 13 |
+
text = super().decode(token_ids, skip_special_tokens=skip_special_tokens, **kwargs)
|
| 14 |
+
# SentencePiece uses ▁ (U+2581) as word boundary marker
|
| 15 |
+
# Replace with space, then clean up
|
| 16 |
+
text = text.replace("\u2581", " ")
|
| 17 |
+
# Clean up extra whitespace
|
| 18 |
+
text = " ".join(text.split())
|
| 19 |
+
return text
|
tokenizer_config.json
CHANGED
|
@@ -1,5 +1,11 @@
|
|
| 1 |
{
|
| 2 |
"tokenizer_class": "LlamaTokenizer",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
"model_max_length": 2048,
|
| 4 |
"bos_token": "<bos>",
|
| 5 |
"eos_token": "<eos>",
|
|
|
|
| 1 |
{
|
| 2 |
"tokenizer_class": "LlamaTokenizer",
|
| 3 |
+
"auto_map": {
|
| 4 |
+
"AutoTokenizer": [
|
| 5 |
+
"tokenizer_class.TeluguSPTokenizer",
|
| 6 |
+
"tokenizer_class.TeluguSPTokenizer"
|
| 7 |
+
]
|
| 8 |
+
},
|
| 9 |
"model_max_length": 2048,
|
| 10 |
"bos_token": "<bos>",
|
| 11 |
"eos_token": "<eos>",
|