Upload 9 files
Browse files- .gitattributes +2 -0
- README.md +95 -1
- config.json +60 -0
- generation_config.json +16 -0
- source.spm +3 -0
- special_tokens_map.json +5 -0
- target.spm +3 -0
- tf_model.h5 +3 -0
- tokenizer_config.json +13 -0
- vocab.json +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
source.spm filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
target.spm filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,3 +1,97 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Helsinki-NLP/opus-mt-ar-en
|
| 4 |
+
tags:
|
| 5 |
+
- machine-translation
|
| 6 |
+
- marian
|
| 7 |
+
- mcwc
|
| 8 |
+
- legal-nlp
|
| 9 |
+
- constitutional-texts
|
| 10 |
+
- generated_from_keras_callback
|
| 11 |
+
model-index:
|
| 12 |
+
- name: marian-finetuned-mcwc-ara-to-en
|
| 13 |
+
results: []
|
| 14 |
---
|
| 15 |
+
|
| 16 |
+
# Marian MT fine-tuned on the Multilingual Corpus of World’s Constitutions (MCWC)
|
| 17 |
+
This model is a fine-tuned version of [Helsinki-NLP/opus-mt-es-en](https://huggingface.co/Helsinki-NLP/opus-mt-es-en), adapted using high-quality sentence-aligned constitutional text from the **Multilingual Corpus of World’s Constitutions (MCWC)**
|
| 18 |
+
📄 MCWC paper (OSACT 2024): https://aclanthology.org/2024.osact-1.7/
|
| 19 |
+
|
| 20 |
+
**This variant handles: _Arabic → English_ translation.**
|
| 21 |
+
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
## Overview
|
| 25 |
+
The MCWC provides a curated multilingual collection of constitutional texts from countries across the world. The corpus emphasises data cleanliness, high-quality sentence alignment, and detailed metadata (including country and continent mappings). It supports research in:
|
| 26 |
+
|
| 27 |
+
- legal and constitutional NLP
|
| 28 |
+
- comparative constitutional studies
|
| 29 |
+
- multilingual machine translation
|
| 30 |
+
- cross-lingual semantic analysis
|
| 31 |
+
|
| 32 |
+
This model was fine-tuned on the Arabic-English segment of the MCWC, enabling translation that is more attuned to legal and constitutional language than general-purpose MT systems.
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## Intended use
|
| 37 |
+
This model is suitable for tasks such as:
|
| 38 |
+
|
| 39 |
+
- translating constitutional or legal documents
|
| 40 |
+
- cross-lingual legal text comparison
|
| 41 |
+
- multilingual information extraction
|
| 42 |
+
- downstream legal NLP tasks requiring domain-specific MT
|
| 43 |
+
|
| 44 |
+
It is **not** intended for casual or conversational translation, as it is optimised for formal and legal text.
|
| 45 |
+
|
| 46 |
+
---
|
| 47 |
+
|
| 48 |
+
## Training data
|
| 49 |
+
The model was trained on the MCWC’s Arabic-English aligned sentence pairs.
|
| 50 |
+
The MCWC dataset includes:
|
| 51 |
+
|
| 52 |
+
- cleaned constitutional text
|
| 53 |
+
- high-quality sentence segmentation
|
| 54 |
+
- pairwise alignments
|
| 55 |
+
- country and regional metadata
|
| 56 |
+
|
| 57 |
+
More details may be found in the accompanying paper:
|
| 58 |
+
> *El-Haj, M. & Ezzini, S. (2024). “The Multilingual Corpus of World’s Constitutions (MCWC).”*
|
| 59 |
+
> OSACT @ LREC-COLING 2024.
|
| 60 |
+
> https://aclanthology.org/2024.osact-1.7/
|
| 61 |
+
|
| 62 |
+
---
|
| 63 |
+
|
| 64 |
+
## Training procedure
|
| 65 |
+
|
| 66 |
+
### Training hyperparameters
|
| 67 |
+
|
| 68 |
+
The following hyperparameters were used during training:
|
| 69 |
+
- optimizer: {'name': 'AdamWeightDecay', 'learning_rate': {'module': 'keras.optimizers.schedules', 'class_name': 'PolynomialDecay', 'config': {'initial_learning_rate': 5e-05, 'decay_steps': 384, 'end_learning_rate': 0.0, 'power': 1.0, 'cycle': False, 'name': None}, 'registered_name': None}, 'decay': 0.0, 'beta_1': 0.9, 'beta_2': 0.999, 'epsilon': 1e-08, 'amsgrad': False, 'weight_decay_rate': 0.01}
|
| 70 |
+
- training_precision: mixed_float16
|
| 71 |
+
|
| 72 |
+
### Training results
|
| 73 |
+
|
| 74 |
+
| Train Loss | Validation Loss | Epoch |
|
| 75 |
+
|:----------:|:---------------:|:-----:|
|
| 76 |
+
| 1.3918 | 1.1473 | 0 |
|
| 77 |
+
| 1.0745 | 1.1021 | 1 |
|
| 78 |
+
| 0.9486 | 1.0908 | 2 |
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
### Framework versions
|
| 82 |
+
|
| 83 |
+
- Transformers 4.33.3
|
| 84 |
+
- TensorFlow 2.13.0
|
| 85 |
+
- Datasets 2.14.5
|
| 86 |
+
- Tokenizers 0.13.3
|
| 87 |
+
|
| 88 |
+
---
|
| 89 |
+
|
| 90 |
+
## Citation
|
| 91 |
+
|
| 92 |
+
If you use this model, please cite the MCWC paper:
|
| 93 |
+
|
| 94 |
+
**El-Haj, M. & Ezzini, S. (2024).**
|
| 95 |
+
*The Multilingual Corpus of World’s Constitutions (MCWC).*
|
| 96 |
+
Proceedings of OSACT @ LREC-COLING 2024.
|
| 97 |
+
https://aclanthology.org/2024.osact-1.7/
|
config.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "Helsinki-NLP/opus-mt-ar-en",
|
| 3 |
+
"_num_labels": 3,
|
| 4 |
+
"activation_dropout": 0.0,
|
| 5 |
+
"activation_function": "swish",
|
| 6 |
+
"add_bias_logits": false,
|
| 7 |
+
"add_final_layer_norm": false,
|
| 8 |
+
"architectures": [
|
| 9 |
+
"MarianMTModel"
|
| 10 |
+
],
|
| 11 |
+
"attention_dropout": 0.0,
|
| 12 |
+
"bad_words_ids": [
|
| 13 |
+
[
|
| 14 |
+
62833
|
| 15 |
+
]
|
| 16 |
+
],
|
| 17 |
+
"bos_token_id": 0,
|
| 18 |
+
"classif_dropout": 0.0,
|
| 19 |
+
"classifier_dropout": 0.0,
|
| 20 |
+
"d_model": 512,
|
| 21 |
+
"decoder_attention_heads": 8,
|
| 22 |
+
"decoder_ffn_dim": 2048,
|
| 23 |
+
"decoder_layerdrop": 0.0,
|
| 24 |
+
"decoder_layers": 6,
|
| 25 |
+
"decoder_start_token_id": 62833,
|
| 26 |
+
"decoder_vocab_size": 62834,
|
| 27 |
+
"dropout": 0.1,
|
| 28 |
+
"encoder_attention_heads": 8,
|
| 29 |
+
"encoder_ffn_dim": 2048,
|
| 30 |
+
"encoder_layerdrop": 0.0,
|
| 31 |
+
"encoder_layers": 6,
|
| 32 |
+
"eos_token_id": 0,
|
| 33 |
+
"forced_eos_token_id": 0,
|
| 34 |
+
"id2label": {
|
| 35 |
+
"0": "LABEL_0",
|
| 36 |
+
"1": "LABEL_1",
|
| 37 |
+
"2": "LABEL_2"
|
| 38 |
+
},
|
| 39 |
+
"init_std": 0.02,
|
| 40 |
+
"is_encoder_decoder": true,
|
| 41 |
+
"label2id": {
|
| 42 |
+
"LABEL_0": 0,
|
| 43 |
+
"LABEL_1": 1,
|
| 44 |
+
"LABEL_2": 2
|
| 45 |
+
},
|
| 46 |
+
"max_length": 512,
|
| 47 |
+
"max_position_embeddings": 512,
|
| 48 |
+
"model_type": "marian",
|
| 49 |
+
"normalize_before": false,
|
| 50 |
+
"normalize_embedding": false,
|
| 51 |
+
"num_beams": 4,
|
| 52 |
+
"num_hidden_layers": 6,
|
| 53 |
+
"pad_token_id": 62833,
|
| 54 |
+
"scale_embedding": true,
|
| 55 |
+
"share_encoder_decoder_embeddings": true,
|
| 56 |
+
"static_position_embeddings": true,
|
| 57 |
+
"transformers_version": "4.33.3",
|
| 58 |
+
"use_cache": true,
|
| 59 |
+
"vocab_size": 62834
|
| 60 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bad_words_ids": [
|
| 4 |
+
[
|
| 5 |
+
62833
|
| 6 |
+
]
|
| 7 |
+
],
|
| 8 |
+
"bos_token_id": 0,
|
| 9 |
+
"decoder_start_token_id": 62833,
|
| 10 |
+
"eos_token_id": 0,
|
| 11 |
+
"forced_eos_token_id": 0,
|
| 12 |
+
"max_length": 512,
|
| 13 |
+
"num_beams": 4,
|
| 14 |
+
"pad_token_id": 62833,
|
| 15 |
+
"transformers_version": "4.33.3"
|
| 16 |
+
}
|
source.spm
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:484f7210e5f4466f7e5b99b660717c6ef2a6f90746196daba507795b69dc02a2
|
| 3 |
+
size 917407
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"eos_token": "</s>",
|
| 3 |
+
"pad_token": "<pad>",
|
| 4 |
+
"unk_token": "<unk>"
|
| 5 |
+
}
|
target.spm
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:156cae4f035ba812224e79d71626802a07296a3ad2ea5c6bc1f2cb35420dfeb4
|
| 3 |
+
size 801886
|
tf_model.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4adec1e6a5da2ac097d51bc7bed3d2e207bf1ee4ae453c4afc3facf40419a718
|
| 3 |
+
size 307873912
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"clean_up_tokenization_spaces": true,
|
| 3 |
+
"eos_token": "</s>",
|
| 4 |
+
"model_max_length": 512,
|
| 5 |
+
"pad_token": "<pad>",
|
| 6 |
+
"return_tensors": "pt",
|
| 7 |
+
"separate_vocabs": false,
|
| 8 |
+
"source_lang": "ar",
|
| 9 |
+
"sp_model_kwargs": {},
|
| 10 |
+
"target_lang": "en",
|
| 11 |
+
"tokenizer_class": "MarianTokenizer",
|
| 12 |
+
"unk_token": "<unk>"
|
| 13 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|