/ Модель

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

Лицензия
Apache 2.0
Архитектура
marian · dense
Опубликована
17 июл 2024

opus-mt-fr-en-ctranslate2

ПереводТекст → текст5 профессий

Конверсия Opus-MT на архитектуре Marian для быстрого перевода с французского на английский через CTranslate2.

166скачиваний за 30 дней0лайковвеса обновлены18 окт 2024

Бенчмарки

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

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

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

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

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

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

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

gaudi/opus-mt-fr-en-ctranslate2 — конвертированная для CTranslate2 версия модели перевода Opus-MT с французского на английский, основанной на работе Helsinki-NLP. Она предназначена для машинного перевода текстов и ускоренного инференса на CPU и GPU через CTranslate2 и библиотеку hf-hub-ctranslate2.

Модель использует архитектуру Marian encoder-decoder. CTranslate2 поддерживает оптимизации инференса, включая квантование весов и объединение слоёв; в карточке для CPU указан тип вычислений int8, для CUDA — int8_float16. Приведённые в README внутренние замеры сообщают об ускорении инференса в 6–10 раз относительно исходных чекпойнтов через Transformers, но также отмечают возможное снижение качества перевода примерно на 5%; эти результаты зависят от конфигурации.

Репозиторий распространяется по лицензии Apache-2.0. Это конверсия существующей модели, а не самостоятельное дообучение.

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

  • перевод текстов с французского на английский
  • пакетный перевод больших наборов документов
  • встраивание перевода fr-en в CPU-сервис
  • ускоренный перевод fr-en на GPU

Ограничения

В README отмечено возможное снижение BLEU примерно на 5% относительно исходных чекпойнтов; результат зависит от конфигурации квантования и инференса. Приведённые показатели производительности получены в конкретных настройках и могут отличаться в других условиях.

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

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

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

Также подходит для

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

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

Открыть на Hugging Face

Repository General Information

Inspired by and derived from the work of Helsinki-NLP, CTranslate2, and michaelfeil!

What is CTranslate2?

CTranslate2 is a C++ and Python library for efficient inference with Transformer models.

CTranslate2 implements a custom runtime that applies many performance optimization techniques such as weights quantization, layers fusion, batch reordering, etc., to accelerate and reduce the memory usage of Transformer models on CPU and GPU.

CTranslate2 is one of the most performant ways of hosting translation models at scale. Current supported models include:

  • Encoder-decoder models: Transformer base/big, M2M-100, NLLB, BART, mBART, Pegasus, T5, Whisper
  • Decoder-only models: GPT-2, GPT-J, GPT-NeoX, OPT, BLOOM, MPT, Llama, Mistral, Gemma, CodeGen, GPTBigCode, Falcon
  • Encoder-only models: BERT, DistilBERT, XLM-RoBERTa

The project is production-oriented and comes with backward compatibility guarantees, but it also includes experimental features related to model compression and inference acceleration.

CTranslate2 Benchmarks

Please note that the results presented below are only valid for the configuration used during this benchmark: absolute and relative performance may change with different settings. Tested against newstest2014 (En -> De) dataset.

The benchmark reports the number of target tokens generated per second (higher is better). The results are aggregated over multiple runs. See the benchmark scripts for more details and reproduce these numbers.

Please note that the results presented below are only valid for the configuration used during this benchmark: absolute and relative performance may change with different settings.

CPU Benchmarks for Generic Opus-MT Models

LibraryTokens per SecondMax Memory UsageBLEU
Transformers 4.26.1 (with PyTorch 1.13.1)147.32332MB27.90
Marian 1.11.0 (int16)330.25901MB27.65
Marian 1.11.0 (int8)355.84763MB27.27
CTranslate2 3.6.0 (int16)596.1660MB27.53
CTranslate2 3.6.0 (int8)696.1516MB27.65

GPU Benchmarks for Generic Opus-MT Models

LibraryTokens per SecondMax GPU Memory UsageMax Memory UsageBLEU
Transformers 4.26.1 (with PyTorch 1.13.1)1022.94097MB2109MB27.90
Marian 1.11.0 (float16)3962.43239MB1976MB27.94
CTranslate2 3.6.0 (float16)9296.7909MB814MB27.9
CTranslate2 3.6.0 (int8 + float16)8362.7813MB766MB27.9

Executed with 4 threads on a c5.2xlarge Amazon EC2 instance equipped with an Intel(R) Xeon(R) Platinum 8275CL CPU.

Source to benchmark information can be found here. Original model BLEU scores can be found here.

Internal Benchmarks

Internal testing on our end showed inference times reduced by 6x-10x on average compared the vanilla checkpoints using the transformers library. A slight reduction on BLEU scores (~5%) was also identified in comparison to the vanilla checkpoints with a few exceptions. This is likely due to several factors, one being the quantization applied. Further testing is needed from our end to better assess the reduction in translation quality. The command used to compile the vanilla checkpoint into a CTranslate2 model can be found below. Modifying this command can yield differing balances between inferencing performance and translation quality.

CTranslate2 Installation

pip install hf-hub-ctranslate2>=1.0.0 ctranslate2>=3.13.0

ct2-transformers-converter Command Used:

ct2-transformers-converter --model Helsinki-NLP/opus-mt-fr-en --output_dir ./ctranslate2/opus-mt-fr-en-ctranslate2 --force --copy_files README.md generation_config.json tokenizer_config.json vocab.json source.spm .gitattributes target.spm --quantization float16

CTranslate2 Converted Checkpoint Information:

Compatible With:

Compute Type:

  • compute_type=int8_float16 for device="cuda"
  • compute_type=int8 for device="cpu"

Sample Code - ctranslate2

Clone the repository to the working directory or wherever you wish to store the model artifacts.

git clone https://huggingface.co/gaudi/opus-mt-fr-en-ctranslate2

Take the python code below and update the 'model_dir' variable to the location of the cloned repository.

from ctranslate2 import Translator
import transformers

model_dir = "./opus-mt-fr-en-ctranslate2" # Path to model directory.
translator = Translator(
            model_path=model_dir,
            device="cuda", # cpu, cuda, or auto.
            inter_threads=1, # Maximum number of parallel translations.
            intra_threads=4, # Number of OpenMP threads per translator.
            compute_type="int8_float16", # int8 for cpu or int8_float16 for cuda.
)

tokenizer = transformers.AutoTokenizer.from_pretrained(model_dir)

source = tokenizer.convert_ids_to_tokens(tokenizer.encode("XXXXXX, XXX XX XXXXXX."))
results = translator.translate_batch([source])
target = results[0].hypotheses[0]

print(tokenizer.decode(tokenizer.convert_tokens_to_ids(target)))

Sample Code - hf-hub-ctranslate2

Derived From michaelfeil:

from hf_hub_ctranslate2 import TranslatorCT2fromHfHub, GeneratorCT2fromHfHub
from transformers import AutoTokenizer

model_name = "gaudi/opus-mt-fr-en-ctranslate2"
model = TranslatorCT2fromHfHub(
        model_name_or_path=model_name,
        device="cuda",
        compute_type="int8_float16",
        tokenizer=AutoTokenizer.from_pretrained(model_name)
)
outputs = model.generate(
    text=["XXX XX XXX XXXXXXX XXXX?", "XX XX XXXX XX XXX!"],
)
print(outputs)

License and other remarks:

License conditions are intended to be idential to original huggingface repository by Helsinki-NLP.

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

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

GPU в ailist

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

Можно запустить

Подбираем GPU…

Ревизия весов
b88efd0

0 моделей