/ Модель

Характеристики

Контекст
256 токенов
Лицензия
MIT
Архитектура
IndicTrans · dense
Базовая модель
indictrans2-en-indic-1B
Опубликована
19 янв 2025

InLegalTrans-En2Indic-1B

Генерация текстаТекст → текст3 профессии

Модель переводит юридические тексты с английского на девять языков Индии и дообучена на корпусе MILPaC.

113скачиваний за 30 дней7лайковвеса обновлены19 янв 2025

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

InLegalTrans-En2Indic-1B — модель перевода текстов, разработанная группой исследователей NLP из Индийского технологического института в Харагпуре. Это дообученная версия ai4bharat/indictrans2-en-indic-1B с архитектурой IndicTrans2 и примерно 1,12 млрд параметров; модель предназначена для перевода юридических текстов с английского на девять языков Индии: бенгальский, хинди, маратхи, тамильский, телугу, малаялам, панджаби, гуджарати и ория.

Модель дообучена на параллельном корпусе MILPaC. По результатам на тестовой части корпуса она превосходит базовую IndicTrans2 по BLEU, GLEU и chrF++ для всех указанных языковых пар; в карточке приведены подробные результаты для бенгальского и хинди. Подходит для перевода юридических документов и других правовых материалов между английским и индийскими языками. Лицензия — MIT.

Сценарии применения

  • перевод судебных решений с английского на хинди
  • перевод законов и нормативных актов на индийские языки
  • перевод юридических документов на бенгальский
  • перевод правовых материалов на маратхи, тамильский и телугу
  • локализация юридических текстов на малаялам, панджаби, гуджарати и ория

Ограничения

Модель ориентирована на перевод с английского на индийские языки; качество описано на тестовом разбиении корпуса MILPaC, поэтому результаты могут отличаться на других типах юридических текстов и вне этой языковой пары.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

InLegalTrans

This is the model card of InLegalTrans-En2Indic-1B translation model, a fine-tuned version of the IndicTrans2 model specifically tailored for translating Indian legal texts from English to Indian languages.

Training Data

We use the MILPaC (Multilingual Indian Legal Parallel Corpus) corpus for fine-tuning. It is the first high-quality Indian legal parallel corpus, containing parallel aligned text units in English (EN) and nine Indian (IN) languages -- Bengali (BN), Hindi (HI), Marathi (MR), Tamil (TA), Telugu (TE), Malayalam (ML), Panjabi (PA), Gujarati (GU), and Oriya (OR). Please refer to the paper for more details about this corpus.

For fine-tuning, we randomly split MILPaC language-wise in a 80 (train) - 10 (validation) - 10 (test) ratio. We use the 80% train split (combined 80% of each English-to-Indic language pair) to fine-tune the IndicTrans2 model and 10% validation split (combined 10% of each English-to-Indic language pair) to select the best checkpoint and to prevent overfitting.

Model Overview and Usage Instructions

This InLegalTrans model uses the same tokenizer as the IndicTrans2 model and has the same architecture with ~1.12B parameters.

import torch
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
from IndicTransToolkit import IndicProcessor # Install IndicTransToolkit from https://github.com/VarunGumma/IndicTransToolkit

device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
src_lang, tgt_lang = "eng_Latn", "ben_Beng" # Use the BCP-47 language codes used by the FLORES-200 dataset
tokenizer = AutoTokenizer.from_pretrained("ai4bharat/indictrans2-en-indic-1B", trust_remote_code=True) # Use IndicTrans2 tokenizer to enable their custom tokenization script to be run
model = AutoModelForSeq2SeqLM.from_pretrained(
    "law-ai/InLegalTrans-En2Indic-1B",
    trust_remote_code=True,
    attn_implementation="eager",
    low_cpu_mem_usage=True,
).to(device)
ip = IndicProcessor(inference=True)

input_sentences = [
    "(7) Any such allowance for the maintenance and expenses for proceeding shall be payable from the date of the order, or, if so ordered, from the date of the application for maintenance or expenses of proceeding, as the case may be.",
    "(2) Where it appears to the Tribunal that, in consequence of any decision of a competent Civil Court, any order made under section 9 should be cancelled or varied, it shall cancel the order or, as the case may be, vary the same accordingly.",
]

batch = ip.preprocess_batch(input_sentences, src_lang=src_lang, tgt_lang=tgt_lang)

input_text_encoding = tokenizer(
    batch,
    max_length=256,
    truncation=True,
    padding="longest",
    return_tensors="pt",
    return_attention_mask=True,
).to(device)

generated_tokens = model.generate(
    **input_text_encoding,
    max_length=256,
    do_sample=True,
    num_beams=4,
    num_return_sequences=1,
    early_stopping=False,
    use_cache=True,
)

with tokenizer.as_target_tokenizer():
    generated_tokens = tokenizer.batch_decode(
        generated_tokens.detach().cpu().tolist(),
        skip_special_tokens=True,
        clean_up_tokenization_spaces=True,
    )

translations = ip.postprocess_batch(generated_tokens, lang=tgt_lang)

for input_sentence, translation in zip(input_sentences, translations):
    print(f"Sentence in {src_lang} language: {input_sentence}") 
    print(f"Translated Sentence in {tgt_lang} language: {translation}") 

Fine-tuning Results

The following table contains the performance results of the InLegalTrans model compared to the IndicTrans2 model over the 10% test split of MILPaC. Performances are evaluated using BLEU, GLEU, and chrF++ metrics. For all English-to-Indic language pairs, InLegalTrans demonstrated a significant improvement over IndicTrans2, achieving consistently better performance across all evaluation metrics.

EN-to-INModelBLEUGLEUchrF++
EN-to-BNIndicTrans225.428.853.7
InLegalTrans45.847.670.9
EN-to-HIIndicTrans241.042.559.9
InLegalTrans56.957.173.8
EN-to-MRIndicTrans225.228.755.4
InLegalTrans44.446.068.9
EN-to-TAIndicTrans232.835.362.3
InLegalTrans40.042.569.9
EN-to-TEIndicTrans210.714.237.9
InLegalTrans31.331.658.5
EN-to-MLIndicTrans221.925.852.9
InLegalTrans37.440.369.7
EN-to-PAIndicTrans227.831.651.5
InLegalTrans44.345.665.5
EN-to-GUIndicTrans227.531.155.7
InLegalTrans42.845.268.8
EN-to-ORIndicTrans206.612.637.1
InLegalTrans14.219.947.5

Citation

If you use this InLegalTrans translation model or the MILPaC corpus, please cite the following paper:

@article{mahapatra2024milpacnovelbenchmarkevaluating,
      title = {MILPaC: A Novel Benchmark for Evaluating Translation of Legal Text to Indian Languages}, 
      author = {Sayan Mahapatra and Debtanu Datta and Shubham Soni and Adrijit Goswami and Saptarshi Ghosh},
      year = {2024},
      journal = {ACM Trans. Asian Low-Resour. Lang. Inf. Process.},
      publisher = {Association for Computing Machinery},
}

About Us

We are a group of Natural Language Processing (NLP) researchers from the Indian Institute of Technology (IIT) Kharagpur. Our research interests are primarily ML, DL, and NLP applications for the legal domain, with a special focus on the challenges and oppurtunites for the Indian legal scenario. Our current and past projects include:

  • Legal Statute Identification
  • Semantic segmentation of legal documents
  • Monolingual (e.g., English-to-English) and Cross-lingual (e.g., English-to-Hindi) Summarization of legal documents
  • Translation in the Indian legal domain
  • Court Judgment Prediction
  • Legal Document Matching

Explore our publicly available codes and datasets at: Law and AI, IIT Kharagpur.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм

Нельзя запустить

Модели нужен код из репозитория; автор пока не в списке доверенных организаций.

Класс архитектуры
IndicTransForConditionalGeneration
Ревизия весов
6413ed9

0 моделей