MADLAD-400-3B-MT for Asturian, Aragonese and Aranese, CTranslate2 int8
CTranslate2 conversion (int8_float16 weights, 2.9 GB) of
Ugiat/madlad400-3b-mt-ast-an-oc_aranes, the
fine-tune of google/madlad400-3b-mt that translates into
Asturian (<2ast>), Aragonese (<2an>) and Aranese (<2oc_aranes>) from Spanish, Catalan, English and
French, and out of them with the base model's tags (<2es>, <2ca>, <2en>, <2fr>). This version is faster
and lighter than the transformers version, for production translation and CPU serving. See the
main model card for examples, the comparison with
other models, evaluation and limitations.
This model was prepared by Ugiat Technologies. It is an independent work and is not produced, reviewed or endorsed by the TAN-IBE project, by Google or by the MADLAD-400 authors.
Usage
import ctranslate2
from huggingface_hub import snapshot_download
from transformers import AutoTokenizer
path = snapshot_download("Ugiat/madlad400-3b-mt-ast-an-oc_aranes-ct2")
tokenizer = AutoTokenizer.from_pretrained(path)
translator = ctranslate2.Translator(path, device="cuda", compute_type="int8_float16") # or device="cpu", compute_type="int8"
def translate(sentences, tag):
batch = [tokenizer.convert_ids_to_tokens(tokenizer.encode(f"{tag} {s}")) for s in sentences]
return [tokenizer.decode(tokenizer.convert_tokens_to_ids(r.hypotheses[0]), skip_special_tokens=True)
for r in translator.translate_batch(batch, beam_size=4)]
for tag in ("<2ast>", "<2an>", "<2oc_aranes>"):
print(tag, translate(["The town council has approved the new budget for next year."], tag))
# <2ast> ['El conceyu aprobó\'l nuevu presupuestu pa l\'añu que viene.']
# <2an> ['O concello ha aprobau o nuevo presupuesto ta l\'anyo que viene.']
# <2oc_aranes> ['Er ajuntament a aprovat eth nau pressupòst entar an que ven.']
- Use this repository's tokenizer (
<2oc_aranes>and<2ast>are pieces 256000 and 256001 of its SentencePiece model) with transformers 4.x. - CTranslate2 4.x wheels are built for CUDA 12. If your environment only has CUDA 13 libraries (e.g. a recent PyTorch),
install
nvidia-cublas-cu12and makelibcublas.so.12loadable before importingctranslate2. - Other target tags work as in the base model (
<2fr>,<2de>,<2en>…).
Conversion
ct2-transformers-converter --model Ugiat/madlad400-3b-mt-ast-an-oc_aranes --quantization int8_float16 --output_dir ct2
(converted with CTranslate2 4.8.2 and transformers 4.57.6, which loads MADLAD-400 checkpoints correctly; 5.x does not).
License and attribution
Apache-2.0, like the base model. The training data and its licences, including the TAN-IBE corpora, are listed on the main model card. Please cite MADLAD-400 (Kudugunta et al., 2023, arXiv:2309.04662) and the main model.
Contact
Ugiat Technologies, ugiat@ugiat.com.