Instructions to use ahmed-farhanur-rashid/bangla-gamba with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ahmed-farhanur-rashid/bangla-gamba with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ahmed-farhanur-rashid/bangla-gamba", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("ahmed-farhanur-rashid/bangla-gamba", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ahmed-farhanur-rashid/bangla-gamba with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ahmed-farhanur-rashid/bangla-gamba" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ahmed-farhanur-rashid/bangla-gamba", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/ahmed-farhanur-rashid/bangla-gamba
- SGLang
How to use ahmed-farhanur-rashid/bangla-gamba 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 "ahmed-farhanur-rashid/bangla-gamba" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ahmed-farhanur-rashid/bangla-gamba", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "ahmed-farhanur-rashid/bangla-gamba" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ahmed-farhanur-rashid/bangla-gamba", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use ahmed-farhanur-rashid/bangla-gamba with Docker Model Runner:
docker model run hf.co/ahmed-farhanur-rashid/bangla-gamba
BanglaGamba
Huggingface compatible version of Bangla-Gamba Base model.
Model Details
| Property | Value |
|---|---|
| Parameters | ~200M |
| Context Length | 2048 |
| Architecture | Hybrid Mamba-3 + GQA (1:1 interleaved) |
| Primary Language | Bengali |
| Secondary Language | English |
| Training Tokens | ~9.62B |
| Training Dataset | ahmed-farhanur-rashid/bn-foundational-pretrain-corpus |
| License | CC BY-NC-SA 4.0 |
Resources
- GitHub Repository: ahmed-farhanur-rashid/bangla-gamba
- Training Dataset: datasets/ahmed-farhanur-rashid/bn-foundational-pretrain-corpus
Requirements
This model uses a custom architecture and tokenizer implementation. Loading requires enabling trust_remote_code=True.
Install the required dependencies:
pip install transformers torch mamba-ssm causal-conv1d bnunicodenormalizer
Note: The model was trained on text normalized using
bnunicodenormalizerin data pipeline. Running without it may significantly degrade generation quality.
Usage
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "ahmed-farhanur-rashid/bangla-gamba"
tokenizer = AutoTokenizer.from_pretrained(
model_id,
trust_remote_code=True,
)
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
torch_dtype=torch.bfloat16,
device_map="auto",
)
model.eval()
prompt = "বাংলাদেশের রাজধানী"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=50,
do_sample=True,
temperature=0.7,
top_p=0.9,
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Architecture
Unlike conventional Transformer-only language models, BanglaGamba combines state-space modeling with attention mechanisms:
- Mamba-3 (State Space Model): Efficient linear-time sequential modeling and long-range state recurrence without quadratic attention overhead.
- Grouped Query Attention (GQA): Improves inference efficiency through optimized key-value caching, enhanced with per-head QK-Norm and RoPE.
- SwiGLU FFN: Interleaved in every block for non-linear representation capacity.
This hybrid design aims to balance computational efficiency with strong language modeling performance.
Related Models
BanglaGamba is part of a family of Bengali foundation language models.
| Model | Architecture | Description |
|---|---|---|
| BanglaGamba | Mamba-3 + GQA | Hybrid state-space and GQA architecture optimized for efficient Bengali language modeling. |
| BanglaGSG | GDN + SWA + GQA | Sibling hybrid architecture trained on the same corpus. |
- BanglaGSG: tasmin-jahan/bangla-gsg
Limitations
- The model expects text normalized using
bnunicodenormalizer, consistent with the preprocessing pipeline used during training. - Loading requires execution of custom Python modules (
modeling_banglagamba.py,configuration_banglagamba.py,tokenization_banglagamba.py) viatrust_remote_code=True. - While primarily trained for Bengali, English support is intended mainly for multilingual understanding and translation-related capabilities.
- As with other large language models, outputs may occasionally be inaccurate or reflect biases present in the training data.
Citation
If you use BanglaGamba in your research, please cite the model:
@misc{banglagamba2026,
title = {BanglaGamba},
author = {Ahmed Farhanur Rashid},
year = {2026},
howpublished = {\url{https://huggingface.co/ahmed-farhanur-rashid/bangla-gamba}}
}
- Downloads last month
- 807
Model tree for ahmed-farhanur-rashid/bangla-gamba
Base model
ahmed-farhanur-rashid/bangla-gamba-base