Downloads · 30 days
0
atahanuz/transformers-translator-en-tr-75M
transformers-translator-en-tr-75M 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.
A Transformer ("base") neural machine translation model that translates English → Turkish, trained with the Nematus toolkit on a ~142k-sentence news-domain parallel corpus using a joint 32k BPE subword vocabulary.
Downloads · 30 days
0
Access
Public
Updated May 27, 2026
Repo size
943 MB
Likes
0
Public
Click a slice to open those files.
.data-00000-of-00001935 MB · 99%
From the Hugging Face model README
A Transformer ("base") neural machine translation model that translates English → Turkish, trained with the Nematus toolkit on a ~142k-sentence news-domain parallel corpus using a joint 32k BPE subword vocabulary.
This is the EN→TR model. The reverse direction is
atahanuz/transformers-translator-tr-en-75M.
Both belong to the machine translation models collection. The two models were trained on the
same data and the same joint BPE model — only the source/target direction and vocab caps differ
(BPE is direction-agnostic).
| Toolkit | Nematus (TensorFlow), commit 49d050863bc9644b8c0a9d9ab6e54ccd30f927dd |
| Architecture | Transformer "base" |
| Direction | English (en) → Turkish (tr) |
| Embedding / model dim | 512 / 512 |
| Encoder / decoder layers | 6 / 6 |
| Attention heads | 8 |
| FFN hidden size | 2048 |
| Dropout | 0.1 (embeddings / residual / relu / attention) |
| Embedding tying | none (untied) |
| Subword model | joint 32k BPE (subword-nmt) |
| Vocab caps | source 18,000 / target 24,000 |
| Parameters | ~75M |
mt_datasets_vol2 — 144,065 English–Turkish sentence pairs (news / current affairs).tokenizer.perl -l <lang> -no-escape.subword-nmt learn-joint-bpe-and-vocab.--vocabulary-threshold 50 over-fragments. Resulting subword vocab: TR 23,211 / EN 17,659 types.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.
| Direction | BLEU | 1/2/3/4-gram precision | BP |
|---|---|---|---|
| EN→TR (this model) | 42.04 | 69.7 / 49.1 / 36.7 / 27.8 | 0.97 |
| TR→EN (sibling model) | 42.78 | 72.9 / 49.8 / 36.4 / 27.3 | 0.98 |
Both directions are scored on the same 1,000 mirrored test pairs, so the comparison is fair. Generating Turkish is the harder direction by dev cross-entropy (agglutinative morphology), but on this formulaic news domain the BLEU gap is small (−0.74).
Example
| English (input) | Model output | Reference |
|---|---|---|
The US Embassy in Bosnia and Herzegovina welcomed the offer to send soldiers to Iraq. | ABD'nin Bosna-Hersek Büyükelçiliği Irak'a asker gönderme teklifini memnuniyetle karşıladı. | ABD'nin BH Büyükelçiliği Irak'a asker gönderme teklifini memnuniyetle karşıladı. |
model.npz.* — Nematus/TensorFlow checkpoint (best-validation, update 10,800).train.bpe.en.json, train.bpe.tr.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.# Nematus (pinned) + the compatibility patch shipped in this repo
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, NumPy-2 dtype=object, a numpy-float
JSON encoder, the softmax-projection EmbeddingLayer args, and monkey-patches
tf.keras.layers.Dropout so Keras 3 accepts the symbolic training flag.
# 0. download this model
python3 -c "from huggingface_hub import snapshot_download; \
snapshot_download('atahanuz/transformers-translator-en-tr-75M', local_dir='en_tr_model')"
# 1. preprocess an English input file (one sentence per line)
perl nematus/data/tokenizer.perl -l en -no-escape < input.en > input.tok.en
subword-nmt apply-bpe -c en_tr_model/tr-en.bpe.codes < input.tok.en > input.bpe.en
# 2. translate — run from the model dir so the dict paths in model.npz.json resolve
cd en_tr_model
python3 ../nematus/nematus/translate.py -m model.npz -i ../input.bpe.en -o ../out.bpe.tr -k 12 -n -b 50
cd ..
# 3. postprocess: undo BPE, then detokenize (Turkish)
sed -E 's/(@@ )|(@@ ?$)//g' out.bpe.tr > out.tok.tr
python3 - <<'EOF'
import re
from sacremoses import MosesDetokenizer
d = MosesDetokenizer(lang='tr')
for line in open('out.tok.tr', encoding='utf-8'):
t = d.detokenize(line.split())
print(re.sub(r"\s*'\s*", "'", t)) # join Turkish suffix apostrophes: Irak ' a -> Irak'a
EOF
multi-bleu.perl — useful for internal comparison but not
directly comparable across tokenizers/papers. For citable numbers use sacreBLEU on detokenized output.cc-by-4.0 is a placeholder — set this to whatever matches your training-data terms.
Built with Nematus and subword-nmt. BPE: Sennrich, Haddow & Birch (2016); Transformer: Vaswani et al. (2017).