๐Ÿ”๏ธ Himachali โ†’ Hindi Multilingual Translator (mT5)

A specialized multilingual NLP model designed to translate local Himachali dialects into standard Hindi.
This is one of the first open-source attempts to build a unified translator for:

  • Bilaspuri
  • Mandeali
  • Kangri
  • Kulluvi

Built using google/mt5-small, the model uses a sequence-to-sequence architecture fine-tuned on parallel dialect โ†’ Hindi pairs.


๐Ÿš€ Features

  • Translate 4+ Himachali dialects into Hindi
  • Unified multilingual translation architecture
  • Full ML workflow:
    • Dataset preprocessing
    • Training
    • Evaluation
    • Inference
    • API + UI
  • Gradio demo interface
  • FastAPI server endpoint
  • Apache 2.0 license (commercial-friendly)
  • HuggingFace model card included
  • Extensible for future dialects

๐Ÿ“ Project Structure

himachali2hindi-multilingual-mt5/
โ”‚
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ raw/
โ”‚   โ”‚   โ””โ”€โ”€ parallel.csv
โ”‚   โ”œโ”€โ”€ processed/
โ”‚   โ”‚   โ””โ”€โ”€ dataset_clean.jsonl
โ”‚   โ””โ”€โ”€ README.md
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ config.py
โ”‚   โ”œโ”€โ”€ dataset_preprocessing.py
โ”‚   โ”œโ”€โ”€ train.py
โ”‚   โ”œโ”€โ”€ evaluate.py
โ”‚   โ”œโ”€โ”€ inference.py
โ”‚   โ””โ”€โ”€ model_utils.py
โ”‚
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ api.py
โ”‚   โ””โ”€โ”€ ui.py
โ”‚
โ”œโ”€โ”€ huggingface/
โ”‚   โ”œโ”€โ”€ model_card.md
โ”‚   โ”œโ”€โ”€ sample_inputs.txt
โ”‚   โ””โ”€โ”€ sample_outputs.txt
โ”‚
โ”œโ”€โ”€ notebooks/
โ”‚   โ”œโ”€โ”€ 01-data-exploration.ipynb
โ”‚   โ”œโ”€โ”€ 02-training.ipynb
โ”‚   โ””โ”€โ”€ 03-evaluation.ipynb
โ”‚
โ”œโ”€โ”€ model/
โ”‚   โ”œโ”€โ”€ tokenizer/
โ”‚   โ””โ”€โ”€ checkpoints/
โ”‚       โ””โ”€โ”€ best-model/
โ”‚
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ test_preprocessing.py
โ”‚   โ”œโ”€โ”€ test_inference.py
โ”‚   โ””โ”€โ”€ test_training.py
โ”‚
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ requirements.txt

โœจ Supported Dialects

Dialect Region
Bilaspuri Bilaspur district
Mandeali Mandi district
Kangri Kangra district
Kulluvi Kullu valley

You can add more dialects (e.g., Sirmauri, Chambeali) simply by adding datapoints.


๐Ÿ“ก Input Prompt Format

The model expects a standardized prompt:

dialect: <dialect> | translate: <sentence>

Example:

dialect: bilaspuri | translate: mai khet jaa reha

Model Output:

เคฎเฅˆเค‚ เค–เฅ‡เคค เคœเคพ เคฐเคนเคพ เคนเฅ‚เค

๐Ÿงพ Dataset Format

CSV (raw)

source_dialect,text,target_hindi
bilaspuri,mai khet jaa reha,เคฎเฅˆเค‚ เค–เฅ‡เคค เคœเคพ เคฐเคนเคพ เคนเฅ‚เค
mandeali,tus kinne jaande ho?,เคคเฅเคฎ เค•เคนเคพเค เคœเคพ เคฐเคนเฅ‡ เคนเฅ‹?

Processed JSONL

{
  "input": "dialect: bilaspuri | translate: mai khet jaa reha",
  "target": "เคฎเฅˆเค‚ เค–เฅ‡เคค เคœเคพ เคฐเคนเคพ เคนเฅ‚เค"
}

Convert CSV โ†’ JSONL:

python -m src.dataset_preprocessing   --input data/raw/parallel.csv   --output data/processed/dataset_clean.jsonl

๐Ÿ‹๏ธ Train the Model

python -m src.train

Outputs saved to:

model/checkpoints/best-model/

๐Ÿงช Evaluate

python -m src.evaluate

Metrics: ROUGE-1, ROUGE-L, and optionally BLEU / chrF.


๐Ÿค– Inference (Python)

from src.inference import translate

out = translate("mai khet jaa reha", dialect="bilaspuri")
print(out)  # Expected: เคฎเฅˆเค‚ เค–เฅ‡เคค เคœเคพ เคฐเคนเคพ เคนเฅ‚เค

๐ŸŒ FastAPI Server

Start server:

uvicorn app.api:app --reload --port 8000

Send request:

POST /translate
{
  "text": "mai khet jaa reha",
  "dialect": "bilaspuri"
}

๐ŸŽจ Gradio Demo

python app/ui.py

UI lets users type dialect text + select dialect.


๐Ÿ“ฆ Installation

pip install -r requirements.txt

Or create a virtual environment:

python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for hmnshudhmn24/himachali2hindi-multilingual-mt5

Base model

google/mt5-small
Finetuned
(599)
this model