Skip to content

English-Hindi neural machine translation using sequence-to-sequence models with attention mechanism, implemented in PyTorch

Notifications You must be signed in to change notification settings

vishalpatel72/English-Hindi-NMT-Seq2Seq-Attention

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English-Hindi Neural Machine Translation

This repository contains implementations of Sequence-to-Sequence (Seq2Seq) neural models for English → Hindi Neural Machine Translation (NMT), including a baseline architecture and an improved attention-based model.


Project Overview

  • Dataset: 100k parallel English–Hindi sentences

    • 70k for training, 30k for testing
  • Epochs: 15

  • Batch Size: 64

  • Framework: PyTorch

  • Loss Function: Negative Log Likelihood Loss (NLLLoss)

  • Optimizer: Adam


Models Implemented

  1. Seq2Seq Architecture Based on Sequence to Sequence Learning with Neural Networks (Sutskever et al.), comprising:

    • Encoder (LSTM) → Context Vector → Decoder (LSTM) → Word Predictor.
  2. Seq2Seq with Attention Based on Neural Machine Translation by Jointly Learning to Align and Translate (Bahdanau et al.), which introduces an attention mechanism for better alignment and handling of long sentences.


Key Findings

  • Baseline Seq2Seq Model: Produces syntactically correct outputs but often repetitive or contextually weak.
  • Attention-based Model: Better at focusing on important input words, resulting in translations more relevant to the target sentence, especially for longer sequences.
  • Observation: Attention improves translation quality and contextual accuracy compared to plain Seq2Seq.

Repository Contents

  • seq2seq.ipynb → Basic Seq2Seq model implementation
  • seq2seq_attention.ipynb → Seq2Seq model with attention mechanism
  • Paper2.csv → Sample dataset used for experiments
  • report → Explaining project with few tested examples and observations

Usage

  1. Open and run notebooks:

    seq2seq.ipynb
    seq2seq_attention.ipynb
    
  2. Adjust dataset path and training hyperparameters as needed.


Technologies & Libraries

  • Python 3.x
  • PyTorch
  • NumPy, Matplotlib
  • Jupyter Notebook

License

This project is licensed under the MIT License.

About

English-Hindi neural machine translation using sequence-to-sequence models with attention mechanism, implemented in PyTorch

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published