Downloads · 30 days
0
xiefff/zh-en-transformer
zh-en-transformer is a translation model from xiefff. Use it when you need text moved from one language to another. The card lists the license as other.
A Chinese-to-English machine translation model trained from scratch with a standard four-layer Pre-LN Transformer and separate SentencePiece BPE tokenizers.
Downloads · 30 days
0
Access
Public
Updated Aug 9, 2026
Repo size
79.8 MB
Likes
0
Public
Click a slice to open those files.
.safetensors78.8 MB · 99%
From the Hugging Face model README
A Chinese-to-English machine translation model trained from scratch with a standard four-layer Pre-LN Transformer and separate SentencePiece BPE tokenizers.
The model was trained on 94,644 filtered Chinese-English sentence pairs from the OPUS-100 training split. The official OPUS-100 validation and test splits were kept separate. Users should review the licenses of the underlying OPUS corpora before redistribution or commercial use.
Evaluation uses greedy decoding with SacreBLEU on the complete filtered official splits.
| Split | Decoder | Samples | BLEU | chrF |
|---|---|---|---|---|
| Validation | Greedy | 1,905 | 22.75 | 49.28 |
| Validation | Beam 4 / LP 1.2 | 1,905 | 24.73 | 50.88 |
| Test | Greedy | 1,915 | 23.69 | 49.48 |
| Test | Beam 4 / LP 1.2 | 1,915 | 25.26 | 51.06 |
On an NVIDIA GeForce RTX 5060 Laptop GPU, cached decoding measured 21.8 ms per sentence at batch size 1 and 111.0 ms per batch at batch size 16 (median, maximum output length 64). This is approximately 1.22x and 1.70x faster than the uncached reference implementation, respectively.
Beam 4 / LP 1.2 measured 26.6 ms P50 and 34.4 ms P95 at batch size 1. At batch size 16 it measured 189.4 ms P50 and 223.6 ms P95.
pip install -r requirements.txt
python evaluate_mt.py --text "今天天气很好。"
Install the serving dependencies and start one model worker:
pip install -r requirements.txt
python serve.py --host 0.0.0.0 --port 8000
POST /translate accepts either one string or a list. The response always
contains a list in the same order as the input:
curl -X POST http://127.0.0.1:8000/translate \
-H "Content-Type: application/json" \
-d '{"texts":["你好。","今天天气很好。"]}'
Concurrent requests are dynamically coalesced for up to 8 ms, with a default
maximum batch size of 16. Tune MT_DEVICE, MT_MAX_BATCH_SIZE,
MT_BATCH_WAIT_MS, MT_MAX_QUEUE_SIZE, MT_REQUEST_TIMEOUT_S,
MT_MAX_TEXT_CHARS, and MT_MAX_REQUEST_ITEMS through environment variables.
Use MT_DECODE=greedy for the lower-latency mode; the default accurate mode
uses MT_DECODE=beam, MT_NUM_BEAMS=4, and MT_LENGTH_PENALTY=1.2.
Set MT_API_TOKEN to require Authorization: Bearer <token> on translation
requests. GET /health reports queue depth and observed batch statistics.
The service returns 413 for oversized input, 429 when the inference queue
is full, and 504 when a request exceeds the inference timeout.
The implementation and checkpoint use a custom PyTorch model rather than the
Transformers AutoModel API.