Downloads · 30 days
0
atahanuz/rnn-translator-tr-en-63M
rnn-translator-tr-en-63M is a translation model from atahanuz. Use it when you need text moved from one language to another. The card lists the license as cc-by-4.0.
An attentional RNN (bi-GRU encoder / GRU decoder) neural machine translation model that translates Turkish → English, trained with the Nematus toolkit on a ~142k-sentence news-domain parallel corpus using a joint 32k…
Downloads · 30 days
0
Access
Public
Updated May 27, 2026
Repo size
1 GB
Likes
0
Public
Click a slice to open those files.
.data-00000-of-00001758 MB · 75%
From the Hugging Face model README
An attentional RNN (bi-GRU encoder / GRU decoder) neural machine translation model that translates Turkish → English, trained with the Nematus toolkit on a ~142k-sentence news-domain parallel corpus using a joint 32k BPE subword vocabulary.
This is the RNN baseline for the machine translation models collection. Siblings:
the stronger Transformer atahanuz/transformers-translator-tr-en-75M
and the reverse-direction RNN atahanuz/rnn-translator-en-tr-63M.
| Toolkit | Nematus (TensorFlow), commit 49d050863bc9644b8c0a9d9ab6e54ccd30f927dd |
| Architecture | Attentional RNN — single-layer bi-GRU encoder, single-layer GRU decoder with attention (conditional GRU, dec_base_transition_depth=2) |
| Direction | Turkish (tr) → English (en) |
| Embedding size | 512 |
| Hidden / state size | 1000 |
| Dropout | none (0.0) |
| Embedding tying | none (untied) |
| Subword model | joint 32k BPE (subword-nmt) |
| Vocab caps | source 24,000 / target 18,000 |
| Parameters | ~63M |
mt_datasets_vol2 — 144,065 Turkish–English sentence pairs (news / current affairs).tokenizer.perl -l <lang> -no-escape.(The BPE model is identical to the Transformer siblings — BPE is architecture-independent.)
maxlen 120, label smoothing 0.0.BLEU via multi-bleu.perl on the merged-BPE (Moses-tokenized) hypothesis vs the tokenized reference; beam 12, length-normalized.
Architecture × direction matrix (same 1,000 mirrored test pairs):
| Architecture | TR → EN | EN → TR |
|---|---|---|
| Transformer (~75M) | 42.78 | 42.04 |
| RNN (~63M) | 35.10 | 33.93 |
This model = RNN TR→EN = 35.10 (n-gram 65.5 / 41.3 / 28.2 / 19.9, BP 1.00). The Transformer beats the RNN by ~7–8 BLEU in both directions. The RNN produces fluent translations (unlike the project's earlier word-level RNN that mode-collapsed on a tiny corpus) but degrades on long / complex sentences.
Example
| Turkish (input) | Model output | Reference |
|---|---|---|
ABD'nin BH Büyükelçiliği Irak'a asker gönderme teklifini memnuniyetle karşıladı. | The US Embassy in BiH welcomed the offer to send troops to Iraq. | The US Embassy in Bosnia and Herzegovina welcomed the offer to send soldiers to Iraq. |
model.npz.* — Nematus/TensorFlow checkpoint (best-validation, update 22,200).train.bpe.tr.json, train.bpe.en.json — Nematus source/target vocabularies (referenced by model.npz.json).tr-en.bpe.codes, vocab.tr, vocab.en — the joint BPE model, used to segment new input.nematus_tf220_compat.patch — makes Nematus run on TensorFlow ≥ 2.16 / NumPy ≥ 2 / Python 3.12.git clone https://github.com/EdinburghNLP/nematus.git
cd nematus && git checkout 49d050863bc9644b8c0a9d9ab6e54ccd30f927dd
git apply /path/to/nematus_tf220_compat.patch
pip install "tensorflow>=2.16" "numpy>=2" subword-nmt sacremoses
cd ..
The patch fixes graph-mode tf.debugging.assert_shapes (incl. the RNN beam-search path), NumPy-2
dtype=object, a numpy-float JSON encoder, the softmax-projection layer args, and the Keras-3
Dropout training-flag handling.
# 0. download this model
python3 -c "from huggingface_hub import snapshot_download; \
snapshot_download('atahanuz/rnn-translator-tr-en-63M', local_dir='tr_en_rnn')"
# 1. preprocess a Turkish input file (one sentence per line)
perl nematus/data/tokenizer.perl -l tr -no-escape < input.tr > input.tok.tr
subword-nmt apply-bpe -c tr_en_rnn/tr-en.bpe.codes < input.tok.tr > input.bpe.tr
# 2. translate — run from the model dir so the dict paths in model.npz.json resolve
cd tr_en_rnn
python3 ../nematus/nematus/translate.py -m model.npz -i ../input.bpe.tr -o ../out.bpe.en -k 12 -n -b 50
cd ..
# 3. postprocess: undo BPE, then detokenize
sed -E 's/(@@ )|(@@ ?$)//g' out.bpe.en > out.tok.en
python3 - <<'EOF'
from sacremoses import MosesDetokenizer
d = MosesDetokenizer(lang='en')
print('\n'.join(d.detokenize(l.split()) for l in open('out.tok.en', encoding='utf-8')))
EOF
(The model architecture is read from model.npz.json, so the exact same commands work as for the
Transformer models — only the checkpoint differs.)
multi-bleu.perl BLEU — for citable numbers use sacreBLEU on detokenized output.cc-by-4.0 placeholder — set to match your training-data terms.
Nematus; subword-nmt. GRU attentional NMT: Bahdanau et al. (2015) / Sennrich et al. (Nematus).