Skip to content

hashina67/NeuralMachineTranslation

Repository files navigation

Sanskrit-to-English Neural Machine Translation

Assignment 2 implementation for Sanskrit-to-English neural machine translation.

Repository Contents (for GitHub submission)

This repository contains everything required for assignment submission and evaluation:

File / Folder Purpose
Sanskrit_English_NMT_Assignment.ipynb Training and inference code (.ipynb only, as required)
Datasets/ Provided Sanskrit-English train/dev/test CSV files
submission.csv Final test-set predictions (Source_id, Sentence_en)
outputs/metrics.json Final BLEU, BERTScore, inference time, and parameter count
outputs/training_history.csv Training loss per epoch
outputs/training_curve.png Training curve plot
outputs/translation_examples.json Example translations with references
Sanskrit_English_NMT_Report.docx Assignment report
requirements.txt Python dependencies with install instructions

Pretrained Models and Methods Used

Component Pretrained? Details
Translation model (encoder-decoder GRU + attention) No Trained from scratch on the provided dataset only
BERTScore evaluation (bert-score) Yes Uses roberta-large downloaded locally for metric computation only
External translation APIs No Not used

The translation model does not use any pretrained weights. The only pretrained model is roberta-large, used exclusively by the bert-score library to compute BERTScore F1 during evaluation. It is not part of the translation pipeline.

How to Run

Use WSL and the local virtual environment:

source .venv/bin/activate
pip install -r requirements.txt
jupyter notebook Sanskrit_English_NMT_Assignment.ipynb

Run all cells in order. The notebook will:

  1. Load and preprocess the provided datasets
  2. Train the custom seq2seq model with attention
  3. Evaluate on dev and test sets (BLEU + BERTScore)
  4. Report inference time and parameter count
  5. Write submission.csv

Final Scores (Provided Test Set)

Metric Value
Dev BLEU 0.0235
Test BLEU 0.0253
Test BERTScore F1 -0.0406
Test inference time 57.34 seconds
Trainable parameters 6,629,824

Notes

  • Custom PyTorch encoder-decoder with additive attention and beam search
  • No external APIs are used
  • Only the provided assignment dataset is used for training
  • BERTScore uses rescale_with_baseline=True as required

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors