CoolFace
Modelpublic

quickmt/quickmt-en-he

sourceHugging Facecc-by-4.0updated 6mo agoView on Hugging Face
0likes105downloads
README.md111 linesDownload Raw Back to root
1---2language:3- en4- he5tags:6- translation7license: cc-by-4.08datasets:9- quickmt/quickmt-train.he-en10model-index:11- name: quickmt-en-he12  results:13  - task:14      name: Translation eng-heb15      type: translation16      args: eng-heb17    dataset:18      name: flores101-devtest19      type: flores_10120      args: eng_Latn heb_Hebr devtest21    metrics:22    - name: BLEU23      type: bleu24      value: 34.3225    - name: CHRF26      type: chrf27      value: 62.3728    - name: COMET29      type: comet30      value: 87.9131---32 33<a href="https://huggingface.co/spaces/quickmt/quickmt-gui"><img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/open-in-hf-spaces-lg-dark.svg" alt="Open in Spaces"></a>34 35# `quickmt-en-he` Neural Machine Translation Model 36 37`quickmt-en-he` is a reasonably fast and reasonably accurate neural machine translation model for translation from `en` into `he`.38 39 40## Try it on our Huggingface Space41 42Give it a try before downloading here: https://huggingface.co/spaces/quickmt/QuickMT-gui43 44 45## Model Information46 47* Trained using [`eole`](https://github.com/eole-nlp/eole) 48* 200M parameter transformer 'big' with 8 encoder layers and 2 decoder layers49* 32k separate Sentencepiece vocabs50* Expested for fast inference to [CTranslate2](https://github.com/OpenNMT/CTranslate2) format51* Training data: https://huggingface.co/datasets/quickmt/quickmt-train.he-en/tree/main52 53See the `eole` model configuration in this repository for further details and the `eole-model` for the raw `eole` (pytorch) model.54 55 56## Usage with `quickmt`57 58You must install the Nvidia cuda toolkit first, if you want to do GPU inference.59 60Next, install the `quickmt` [python library](github.com/quickmt/quickmt). 61 62```bash63git clone https://github.com/quickmt/quickmt.git64pip install ./quickmt/65```66 67Finally, use the model in python:68 69```python70from quickmt import Translator71from huggingface_hub import snapshot_download72 73# Download Model (if not downloaded already) and return path to local model74# Device is either 'auto', 'cpu' or 'cuda'75t = Translator(76    snapshot_download("quickmt/quickmt-en-he", ignore_patterns="eole-model/*"),77    device="cpu"78)79 80# Translate - set beam size to 1 for faster speed (but lower quality)81sample_text = 'Dr. Ehud Ur, professor of medicine at Dalhousie University in Halifax, Nova Scotia and chair of the clinical and scientific division of the Canadian Diabetes Association cautioned that the research is still in its early days.'82 83t(sample_text, beam_size=5)84```85 86> 'ד"ר אהוד אור, פרופסור לרפואה באוניברסיטת דלהוזי בהליפקס, נובה סקוטיה ויו"ר המחלקה הקלינית והמדעית של האגודה הקנדית לסוכרת, הזהיר כי המחקר נמצא עדיין בימיו הראשונים.'87 88```python89# Get alternative translations by sampling90# You can pass any cTranslate2 `translate_batch` arguments91t([sample_text], sampling_temperature=1.2, beam_size=1, sampling_topk=50, sampling_topp=0.9)92```93 94> 'פרופסור לרפואה באוניברסיטת דלהוסרה בהליפקס בנובה סקוטיה ויו"ר החטיבה הקלינית והמחקרית של אגודת הסוכרת הקנדית הזהיר כי המחקר נמצא כיום בתחילתו.'95 96The model is in `ctranslate2` format, and the tokenizers are `sentencepiece`, so you can use `ctranslate2` directly instead of through `quickmt`. It is also possible  to get this model to work with e.g. [LibreTranslate](https://libretranslate.com/) which also uses `ctranslate2` and `sentencepiece`. A model in safetensors format to be used with `eole` is also provided.97 98 99## Metrics100 101`bleu` and `chrf2` are calculated with [sacrebleu](https://github.com/mjpost/sacrebleu) on the [Flores200 `devtest` test set](https://huggingface.co/datasets/facebook/flores) ("eng_Latn"->"heb_Hebr"). `comet22` with the [`comet`](https://github.com/Unbabel/COMET) library and the [default model](https://huggingface.co/Unbabel/wmt22-comet-da). "Time (s)" is the time in seconds to translate the flores-devtest dataset (1012 sentences) on an Nvidia RTX 4070s GPU with batch size 32.102 103 104|                                  |   bleu |   chrf2 |   comet22 |   Time (s) |105|:---------------------------------|-------:|--------:|----------:|-----------:|106| quickmt/quickmt-en-he            |  34.32 |   62.37 |     87.91 |       1.15 |107| facebook/nllb-200-distilled-600M |  23.83 |   53.98 |     84.12 |      25.78 |108| facebook/nllb-200-distilled-1.3B |  29    |   58.64 |     87.23 |      44.79 |109| facebook/m2m100_418M             |  20.53 |   50.74 |     81.38 |      21.7  |110| facebook/m2m100_1.2B             |  23.78 |   53.73 |     83.81 |      41.71 |111