Views
No views yet
| Property | Value |
|---|---|
| Original model | Helsinki-NLP/opus-mt-es-ar |
| Architecture | MarianMT (encoder-decoder) |
| Encoder layers | 6 |
| Decoder layers | 6 |
| Attention heads | 8 |
| d_model | 512 |
| FFN dimension | 2048 |
| Activation function | swish |
| Vocabulary size | 62518 |
| Max sequence length | 512 |
| Beam size | 4 |
| Quantization | int8 |
| Format | CTranslate2 |
| Tokenizer | SentencePiece (source.spm / target.spm) |
1import ctranslate2
2import sentencepiece as spm
3
4model_path = "mijuanlo/opus-mt-es-ar-ct2-int8"
5sp_source = spm.SentencePieceProcessor(f"{model_path}/source.spm")
6sp_target = spm.SentencePieceProcessor(f"{model_path}/target.spm")
7
8translator = ctranslate2.Translator(model_path)
9
10def translate(text: str) -> str:
11 input_ids = sp_source.encode(text, out_type=str)
12 results = translator.translate_batch([input_ids], beam_size=4)
13 output_ids = results[0].hypotheses[0]
14 return sp_target.decode(output_ids)
15
16print(translate("¡Hola, mundo!"))1from huggingface_hub import snapshot_download
2import ctranslate2
3import sentencepiece as spm
4
5model_id = "mijuanlo/opus-mt-es-ar-ct2-int8"
6model_path = snapshot_download(repo_id=model_id)
7translator = ctranslate2.Translator(model_path)
8sp_source = spm.SentencePieceProcessor(f"{model_path}/source.spm")
9sp_target = spm.SentencePieceProcessor(f"{model_path}/target.spm")1ct2-transformers-converter \
2 --model Helsinki-NLP/opus-mt-es-ar \
3 --output_dir opus-mt-es-ar-ct2-int8 \
4 --quantization int8 \
5 --force1@inproceedings{tiedemann-2020-tatoeba,
2 title = {The Tatoeba Translation Challenge – Realistic Data Sets for Low Resource and Multilingual MT},
3 author = {Tiedemann, J{\"o}rg},
4 booktitle = {Proceedings of the Fifth Conference on Machine Translation (WMT)},
5 year = {2020},
6 publisher = {Association for Computational Linguistics},
7}