SAVRN
Search Contact SAVRN

Open-weight model · Translation

sanskrit-en-custom-transformer

by Praveen Kumar krpraveen/sanskrit-en-custom-transformer

A compact encoder–decoder Transformer trained from scratch on 10,000 Sanskrit–English pairs (NLU Assignment 2), with a joint SentencePiece BPE vocabulary. It is small and fast — meant to be efficient rather than to match large pretrained models.

Parameters
Context
Weights38.8 MB
Licensemit
AccessOpen weights
Monthly Downloads296.3k

Model Card

By Praveen Kumar, published under mit, revision e6dab729be0b.

A compact encoder–decoder Transformer trained from scratch on 10,000 Sanskrit–English pairs (NLU Assignment 2), with a joint SentencePiece BPE vocabulary. It is small and fast — meant to be efficient rather than to match large pretrained models. This is not a Transformers architecture, so it ships with a self-contained modeling.py. Files: pytorchmodel.bin (weights), spm.model (tokenizer), config.json (hyperparameters), modeling.py (model + load/translate helpers). pip install gradio first. To host it, create a Hugging Face Space (SDK: Gradio) with an app.py (the load + respond code) and a requirements.txt of torch sentencepiece huggingfacehub gradio. Trained only on the provided dataset…

Read Praveen Kumar's full model card

Sanskrit → English — Custom Transformer (trained from scratch)

A compact encoder–decoder Transformer trained from scratch on 10,000 Sanskrit–English pairs (NLU Assignment 2), with a joint SentencePiece BPE vocabulary. It is small and fast — meant to be efficient rather than to match large pretrained models. This is nota Transformers architecture, so it ships with a self-containedmodeling.py.

Parameters ~9.4M
Architecture 4+4 layer Transformer, d_model 256, 4 heads, tied embeddings
Vocabulary 8,000 (joint SentencePiece BPE)
Test BLEU / BERTScore-F1 0.089 / 0.346
Inference ~7 ms/sentence

Files: pytorch_model.bin (weights), spm.model (tokenizer), config.json (hyperparameters), modeling.py (model + load/translate helpers).

Install

pip install torch sentencepiece huggingface_hub

Inference

from huggingface_hub import snapshot_download
import sys

d = snapshot_download("krpraveen/sanskrit-en-custom-transformer")
sys.path.insert(0, d)
from modeling import load, translate

model, sp, cfg = load(d)                    # add device="cuda" on a GPU
print(translate(model, sp, cfg, ["बाल: भवत्सु प्रेमं प्रकटयति ।"]))
# ['Boy displays love in you.']

Use it from an open-source chat UI (Gradio)

import gradio as gr

def respond(message, history):
    return translate(model, sp, cfg, [message])[0]

gr.ChatInterface(
    respond,
    title="Sanskrit → English (custom Transformer)",
    description="Type a Sanskrit sentence in Devanagari.",
    examples=["बाल: भवत्सु प्रेमं प्रकटयति ।", "अस्तु, इदं सम्यक् दृश्यते ।"],
).launch()

pip install gradio first. To host it, create a Hugging Face Space (SDK: Gradio) with an app.py (the load + respond code) and a requirements.txt of torch sentencepiece huggingface_hub gradio.

Notes

Trained only on the provided dataset — no pretrained weights and no external data. Being a from-scratch model on 10k pairs, quality is modest; a larger model or more data would help. For higher quality see the fine-tuned IndicTrans2 model krpraveen/indictrans2-sanskrit-en-finetuned.

Configuration

Vocabulary size
8,000

Identity and Version

Repository
krpraveen/sanskrit-en-custom-transformer
Publisher
Praveen Kumar
Task
Translation
Modality
Text
Library
Not stated by the source
Parameters
Not stated by the source
Languages
sa, en
Revision
e6dab729be0bfe15e08f2008cb6f848cf8c91947
First published
2026-07-04
Last updated
2026-07-04

Files and Weights

6 files, 39.2 MB in total. The weights are 1 file totalling 38.8 MB in bin.

Weights1 file · 38.8 MB
Configuration2 files · 5.1 KB
Documentation1 file · 2.5 KB
Other1 file · 393.2 KB
Repository1 file · 1.5 KB
Every file
FileTypeSizeSHA-256
pytorch_model.binWeights38.8 MB 2a63017d3b60
config.jsonConfiguration177 B
modeling.pyConfiguration5.0 KB
README.mdDocumentation2.5 KB
spm.modelOther393.2 KB 517d54c4e726
.gitattributesRepository1.5 KB

License and Download

License
mit
Access
Open weights, no gate
Download size
38.8 MB
Download from Praveen Kumar

Released by Praveen Kumar through its official repository on Hugging Face. Read the license.

Memory Requirements

PrecisionWeights in memory
As published38.8 MB

Weights only, from the published parameter count; the key-value cache and runtime add to this.

Questions About sanskrit-en-custom-transformer

Can I use sanskrit-en-custom-transformer commercially?

Yes. sanskrit-en-custom-transformer is released under MIT License. The MIT License is a short permissive license. It permits commercial use, modification and redistribution, provided the copyright notice and permission notice are included.

Similar Models

source languages: nl; target languages: en; OPUS readme: nl-en; dataset: opus; model: transformer-align; pre-processing: normalization + SentencePiece.

Open weights apache-2.0 512 tokens transformers

Model · Translation

nllb-200-distilled-600M

AI at Meta

This is the model card of NLLB-200's distilled 600M variant. Here are the metrics for that particular checkpoint. - Information about training algorithms, parameters, fairness constraints or other applied approaches, and features. The exact training algorithm, data and the strategies to handle data imbalances for high and low resource languages that were used to train NLLB-200 is described in the paper. - Paper or other resource for more information NLLB Team et al, No Language Left Behind: Scaling Human-Centered Machine Translation, Arxiv, 2022 - Where to send questions or comments about the model: https://github.com/facebookresearch/fairseq/issues • Model performance measures: NLLB-200…

Open weights cc-by-nc-4.0 1,024 tokens transformers

source languages: en; target languages: ru; OPUS readme: en-ru; dataset: opus; model: transformer-align; pre-processing: normalization + SentencePiece.

Open weights apache-2.0 512 tokens transformers

This model can be used for translation and text-to-text generation. CONTENT WARNING: Readers should be aware this section contains content that is disturbing, offensive, and can propagate historical and current stereotypes. Significant research has explored bias and fairness issues with language models (see, e.g., Sheng et al. (2021) and Bender et al. (2021)). Further details about the dataset for this model can be found in the OPUS readme: en-de

Open weights cc-by-4.0 512 tokens transformers

hfname: kor-eng - sourcelanguages: kor - targetlanguages: eng - opusreadmeurl: https://github.com/Helsinki-NLP/Tatoeba-Challenge/tree/master/models/kor-eng/README.md - originalrepo: Tatoeba-Challenge - srcconstituents: {'korHani', 'korHang', 'korLatn', 'kor'} - tgtconstituents: {'eng'} - srcmultilingual: False - tgtmultilingual: False - urlmodel: https://object.pouta.csc.fi/Tatoeba-MT-models/kor-eng/opus-2020-06-17.zip - urltestset: https://object.pouta.csc.fi/Tatoeba-MT-models/kor-eng/opus-2020-06-17.test.txt - srcalpha3: kor - tgtalpha3: eng - shortpair: ko-en - chrF2score: 0.588 - brevitypenalty: 0.9590000000000001 - reflen: 17711.0 - srcname: Korean - tgtname: English - traindate…

Open weights apache-2.0 512 tokens transformers

source languages: de; target languages: en; OPUS readme: de-en; dataset: opus; model: transformer-align; pre-processing: normalization + SentencePiece.

Open weights apache-2.0 512 tokens transformers