How to use from
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 "ss-76/microgpt-deva" \
    --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": "ss-76/microgpt-deva",
		"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 "ss-76/microgpt-deva" \
        --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": "ss-76/microgpt-deva",
		"prompt": "Once upon a time,",
		"max_tokens": 512,
		"temperature": 0.5
	}'
Quick Links

🧠 MicroGPT-Deva: Lightweight Sanskrit Generative LLM

MicroGPT-Deva is a compact decoder-only language model trained on Sanskrit text in Devanagari script, optimized for text generation tasks. It uses a custom transformer architecture with FlashAttention for efficient GPU utilization and fast decoding.

This model is ideal for:

  • Generating Sanskrit sentences or paragraphs
  • Educational chatbots or creative writing tools
  • Deployment on resource-constrained environments (single-GPU)

🛠️ Model Details

Property Value
Architecture Decoder-only Transformer
Vocabulary Size 12,000 (SentencePiece BPE)
Hidden Size 512
Layers 8
Attention Heads 8
Sequence Length 512 tokens
Parameters ~33M
FlashAttention ✅ Yes

📖 Training

  • Data: Custom Sanskrit dataset of over 100,000+ Devanagari .txt files.
  • Tokenizer: SentencePiece BPE model trained with character_coverage=1.0.
  • Training Platform: AWS SageMaker Tesla V100 GPU
  • Framework: PyTorch with custom FlashAttention blocks
  • Training Time: ~3 epochs with dynamic batching on sharded data

💬 Usage

🧪 In Python

import torch
import sentencepiece as spm
from microgpt_deva import MicroGPT, Config

# Load tokenizer
sp = spm.SentencePieceProcessor()
sp.load("devanagari.model")

# Load config and model
with open("config.json") as f:
    config = Config(json.load(f))

model = MicroGPT(config)
model.load_state_dict(torch.load("pytorch_model.bin"))
model.eval()

# Generate text
prompt = "कस्मिंश्चिन् नगराभ्याशे "
input_ids = torch.tensor([sp.encode(prompt, out_type=int)], dtype=torch.long)
with torch.no_grad():
    output = model.generate(input_ids, max_new_tokens=30)
print(sp.decode(output[0].tolist()))
Downloads last month
1
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support