Instructions to use projecte-aina/aina-translator-es-ca-legal with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Fairseq
How to use projecte-aina/aina-translator-es-ca-legal with Fairseq:
from fairseq.checkpoint_utils import load_model_ensemble_and_task_from_hf_hub models, cfg, task = load_model_ensemble_and_task_from_hf_hub( "projecte-aina/aina-translator-es-ca-legal" ) - Notebooks
- Google Colab
- Kaggle
Aina Project's Spanish to Catalan MT model specialized on the legal domain
Table of Contents
Click to expand
Model description
aina-translator-es-ca-legal is a bilingual MT model specialized in the translation of texts from the legal domain. The base model from which it is derived is aina-translator-es-ca.
Intended uses and limitations
The model is intended to be used for the translation of legal, juridical and forensic Spanish texts into Catalan.
How to use
Usage
Required libraries:
pip install ctranslate2 pyonmttok
Translate a sentence using python
import ctranslate2
import pyonmttok
from huggingface_hub import snapshot_download
model_dir = snapshot_download(repo_id="projecte-aina/aina-translator-es-ca-legal", revision="main")
tokenizer=pyonmttok.Tokenizer(mode="none", sp_model_path = model_dir + "/spm.model")
tokenized=tokenizer.tokenize("¡Este es el traductor automático de textos legales del proyecto Aina!")
translator = ctranslate2.Translator(model_dir)
translated = translator.translate_batch([tokenized[0]])
print(tokenizer.detokenize(translated[0][0]['tokens']))
Limitations and bias
At the time of submission, no measures have been taken to estimate the bias and toxicity embedded in the model. However, we are well aware that our models may be biased. We intend to conduct research in these areas in the future, and if completed, this model card will be updated.
Training
This model is a fine-tuned version of the base model aina-translator-es-ca. Detailed information about the pre-training can be found in the model card of the latter. The fine-tuned model was trained for a further 34 epochs on a domain-specific dataset.
Fine-tuning data
Information about the pre-training data con be found in the model card of aina-translator-es-ca. The fine-tuning corpus consists of 6.8M es-ca parallel sentences. This corpus was built from legal, juridical and forensic texts provided by various representatives of the Generalitat de Catalunya. The corpus may contain synthetically generated text on the target side (in this case, Catalan). The data was partially extracted from pdf and docx documents, semi-manually cleaned, filtered and aligned to obtain the final corpus.
Evaluation
Variable and metrics
We use the BLEU score for evaluation on various domain-specific testsets:
AAPP Corpus of texts from the Public Administrations of Catalonia
CAJG - Corpus of resolutions of the Comissió d'Assistència Jurídica Gratuïta de Catalunya (CAJG): Internal, domain-specific evaluation set, specifically created for evaluation purposes.
Actas2020 - Corpus of proceedings of the Sala de Govern of the Tribunal Superior de Justicia de Catalunya: Internal, domain-specific evaluation set, specifically created for evaluation purposes.
Evaluation results
Below are the evaluation results expressed in BLEU for machine translation from Catalan to Spanish compared to Google Translate and our generalist model aina-translator-es-ca:
| Test set | Google Translate | aina-translator-es-ca | aina-translator-es-ca-legal |
|---|---|---|---|
| AAPP | 76,9 | 79,5 | 79,8 |
| CAJG | 60,7 | 63,7 | 62,9 |
| Actas2020 | 58,7 | 52,0 | 66,6 |
| Average | 65,4 | 65,1 | 69,8 |
Additional information
Author
The Language Technologies Unit from Barcelona Supercomputing Center.
Contact
For further information, please send an email to langtech@bsc.es.
Copyright
Copyright(c) 2024 by Language Technologies Unit, Barcelona Supercomputing Center.
License
Funding
This work/research has been promoted and financed by the Government of Catalonia through the Aina project.
Disclaimer
Click to expand
The model published in this repository is intended for a generalist purpose and is available to third parties under a permissive Apache License, Version 2.0.
Be aware that the model may have biases and/or any other undesirable distortions.
When third parties deploy or provide systems and/or services to other parties using this model (or any system based on it) or become users of the model, they should note that it is their responsibility to mitigate the risks arising from its use and, in any event, to comply with applicable regulations, including regulations regarding the use of Artificial Intelligence.
In no event shall the owner and creator of the model (Barcelona Supercomputing Center) be liable for any results arising from the use made by third parties.
- Downloads last month
- 11
Model tree for projecte-aina/aina-translator-es-ca-legal
Base model
projecte-aina/aina-translator-es-ca