Skip to content
Projects

keon/seq2seq has 706 GitHub stars and 166 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-15 07:46 UTC. Last push 2026-05-18.

How these counts are measured

Measured star growth

in 24h
0
in 7 days
Collecting history
in 15 days
Collecting history
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

About

Minimal Seq2Seq model with Attention for Neural Machine Translation in PyTorch

Machine Learning

README.md

Original

mini seq2seq

Minimal Seq2Seq model with attention for neural machine translation in PyTorch.

This implementation focuses on the following features:

  • Modular structure to be used in other projects
  • Minimal code for readability
  • Full utilization of batches and GPU.

Dataset (Multi30k DE→EN) is loaded via HuggingFace datasets; tokenization uses spaCy.

Model description

Requirements

  • Python 3.9+
  • PyTorch >= 2.0 (CPU, CUDA, or Apple MPS)
  • datasets (HuggingFace, replaces torchtext)
  • Spacy >= 3.7
pip install -r requirements.txt
python -m spacy download de_core_news_sm
python -m spacy download en_core_web_sm

Train

python train.py -epochs 30 -batch_size 32 -lr 3e-4

Device is auto-detected (CUDA → MPS → CPU). Smaller -hidden_size / -embed_size flags are useful for CPU smoke runs.

Sanity check (CPU, 500 batches, hidden=128/embed=64):

step train loss perplexity
init 9.19 9803
50 6.98 1071
100 5.48 239
250 5.15 173
500 4.84 127

Final val loss: 4.93 (random-init prior is log(|V|) ≈ 9.19).

References

Based on the following implementations