Hugging Face model: ankpatil1203/transformer-eng-hin-from-scratch
Author: ankpatil1203
Created: 2025-12-01 17:52:25
Last modified: 2025-12-01 18:00:55
Likes: 0 | Downloads: 0
Tags: region:us
Card metadata:
title: Transformer (English → Hindi) — From Scratch
description: This is a Transformer encoder–decoder model implemented **fully from scratch** in PyTorch.
It was trained on the Hindi–English Parallel Corpus (Kaggle dataset).

model_details: architecture: Transformer Encoder–Decoder (Vaswani et al., 2017)
attention: Multi-Head Self-Attention + Cross-Attention
training: Custom training loop (no `torch.nn.Transformer`)
decoding: Greedy + Beam Search
dataset: Hindi–English parallel text (Kaggle)
task: Machine Translation (EN → HI)
how_to_use: ```python
from huggingface_hub import hf_hub_download
import torch
from model import Transformer # import your architecture
# download model weights
model_path = hf_hub_download(
    repo_id="<your-username>/<your-model-name>",
    filename="transformer_model.pth"
)
# load model
model = Transformer(src_vocab_size, trg_vocab_size)
model.load_state_dict(torch.load(model_path, map_location="cpu"))
model.eval()