🚀 legal_t5_small_trans_en_cs模型
这是一个用于将英文法律文本翻译成捷克语的模型,在多个平行语料库上训练得到,为法律文本的翻译提供了有效的解决方案。
🚀 快速开始
legal_t5_small_trans_en_cs 模型可用于将英文法律文本翻译成捷克语。它首次发布于 此仓库,并在来自 jrc - acquis、europarl 和 dcep 的三个平行语料库上进行训练。
✨ 主要特性
- 基于
t5 - small
模型构建,通过特定参数设置(dmodel = 512
,dff = 2,048
,8 头注意力机制,编码器和解码器各 6 层)缩小了 t5 基线模型的规模,参数约 6000 万。
- 可用于英文到捷克语的法律文本翻译。
📦 安装指南
暂未提及安装相关内容。
💻 使用示例
基础用法
以下是在 PyTorch 中使用该模型将英文法律文本翻译成捷克语的示例:
from transformers import AutoTokenizer, AutoModelWithLMHead, TranslationPipeline
pipeline = TranslationPipeline(
model=AutoModelWithLMHead.from_pretrained("SEBIS/legal_t5_small_trans_en_cs"),
tokenizer=AutoTokenizer.from_pretrained(pretrained_model_name_or_path = "SEBIS/legal_t5_small_trans_en_cs", do_lower_case=False,
skip_special_tokens=True),
device=0
)
en_text = "1 In the countries concerned, this certainly affects the priority assigned to making progress on the issue of final disposal, particularly of highly radioactive waste and irradiated fuel elements."
pipeline([en_text], max_length=512)
📚 详细文档
模型描述
legal_t5_small_trans_en_cs 基于 t5 - small
模型,在大量平行文本语料库上进行训练。这是一个较小的模型,通过使用 dmodel = 512
,dff = 2,048
,8 头注意力机制,且编码器和解码器各只有 6 层,缩小了 t5 基线模型的规模。该变体约有 6000 万个参数。
预期用途与限制
该模型可用于将英文法律文本翻译成捷克语。
训练数据
legal_t5_small_trans_en_cs 模型在 [JRC - ACQUIS](https://wt - public.emm4u.eu/Acquis/index_2.2.html)、EUROPARL 和 [DCEP](https://ec.europa.eu/jrc/en/language - technologies/dcep) 数据集上进行训练,这些数据集包含 500 万条平行文本。
训练过程
- 模型在单个 TPU Pod V3 - 8 上总共训练了 250K 步,使用序列长度 512(批量大小 4096)。
- 它总共有约 2.2 亿个参数,采用编码器 - 解码器架构进行训练。
- 优化器使用 AdaFactor,并在预训练时采用逆平方根学习率调度。
预处理
使用从平行语料库(所有可能的语言对)中的 8800 万行文本训练的 unigram 模型来获取词汇表(使用字节对编码),该词汇表用于此模型。
评估结果
当模型用于翻译测试数据集时,取得了以下结果:
模型 |
BLEU 分数 |
legal_t5_small_trans_en_cs |
50.177 |
BibTeX 引用和引用信息
由 Ahmed Elnaggar/@Elnaggar_AI 创建 | [领英](https://www.linkedin.com/in/prof - ahmed - elnaggar/)