🚀 意大利语T5大模型🇮🇹
意大利语T5(IT5)模型家族是首次针对意大利语进行大规模序列到序列Transformer模型预训练的尝试,其采用了与原始 T5模型 相同的方法。该模型能够助力意大利语相关的自然语言处理任务,如文本生成、理解等,为意大利语的自然语言处理研究和应用提供了强大的工具。
🚀 快速开始
本项目由 Gabriele Sarti 和 Malvina Nissim 发起,在 Huggingface 的支持下,借助 Google 的 TPU研究云 提供的TPU资源完成训练。所有训练均在 Google Cloud 的单台 TPU3v8 - VM 机器上进行。你可以参考仓库的 Tensorboard 标签了解训练过程的概况。
推理小部件已停用,因为该模型需要在下游任务上进行特定任务的序列到序列微调才能在实际中发挥作用。
✨ 主要特性
模型变体
本仓库包含模型 base
版本的检查点。该模型在 深度清理的意大利语mC4语料库(约410亿个单词,约275GB)上使用 🤗 Datasets 和 google/t5 - v1_1 - large
改进配置进行了一个周期(105万步)的训练。训练过程可在 [Github](https://github.com/gsarti/t5 - flax - gcp) 上查看。
以下表格总结了所有可用模型的参数:
属性 |
it5-small |
it5-base |
it5-large (本模型) |
it5-base-oscar |
数据集 |
gsarti/clean_mc4_it |
gsarti/clean_mc4_it |
gsarti/clean_mc4_it |
oscar/unshuffled_deduplicated_it |
架构 |
google/t5-v1_1-small |
google/t5-v1_1-base |
google/t5-v1_1-large |
t5-base |
学习率 |
5e - 3 |
5e - 3 |
5e - 3 |
1e - 2 |
步数 |
1050000 |
1050000 |
2100000 |
258000 |
训练时间 |
36小时 |
101小时 |
370小时 |
98小时 |
前馈投影 |
gated-gelu |
gated-gelu |
gated-gelu |
relu |
绑定嵌入 |
false |
false |
false |
true |
优化器 |
adafactor |
adafactor |
adafactor |
adafactor |
最大序列长度 |
512 |
512 |
512 |
512 |
每设备批次大小 |
16 |
16 |
8 |
16 |
总批次大小 |
128 |
128 |
64 |
128 |
权重衰减 |
1e - 3 |
1e - 3 |
1e - 2 |
1e - 3 |
验证集分割大小 |
15K个示例 |
15K个示例 |
15K个示例 |
15K个示例 |
it5 - base - oscar
训练时间较长是由于 训练脚本中的一个错误 导致的。
如需查看单个模型的参数列表,请参考各自仓库中的 config.json
文件。
💻 使用示例
基础用法
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
tokenizer = AutoTokenizer.from_pretrained("gsarti/it5-large")
model = AutoModelForSeq2SeqLM.from_pretrained("gsarti/it5-large")
注意:你需要在下游序列到序列任务上对模型进行微调才能使用它。
模型的 Flax 和 Tensorflow 版本也可用:
from transformers import FlaxT5ForConditionalGeneration, TFT5ForConditionalGeneration
model_flax = FlaxT5ForConditionalGeneration.from_pretrained("gsarti/it5-large")
model_tf = TFT5ForConditionalGeneration.from_pretrained("gsarti/it5-large")
📚 详细文档
局限性
由于 IT5 模型是在网络抓取的语料库上进行训练的,其使用可能会重现并放大数据中已有的偏差,从而产生潜在的有害内容,如种族或性别刻板印象以及阴谋论观点。因此,建议对这些偏差进行研究,并且理想情况下,模型的使用应仅限于面向研究且不直接面向用户的项目。
模型维护者
如果你在使用该模型时遇到问题或需要更新,请联系 gabriele.sarti996@gmail.com。
引用信息
@inproceedings{sarti-nissim-2024-it5-text,
title = "{IT}5: Text-to-text Pretraining for {I}talian Language Understanding and Generation",
author = "Sarti, Gabriele and
Nissim, Malvina",
editor = "Calzolari, Nicoletta and
Kan, Min-Yen and
Hoste, Veronique and
Lenci, Alessandro and
Sakti, Sakriani and
Xue, Nianwen",
booktitle = "Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024)",
month = may,
year = "2024",
address = "Torino, Italia",
publisher = "ELRA and ICCL",
url = "https://aclanthology.org/2024.lrec-main.823",
pages = "9422--9433",
abstract = "We introduce IT5, the first family of encoder-decoder transformer models pretrained specifically on Italian. We document and perform a thorough cleaning procedure for a large Italian corpus and use it to pretrain four IT5 model sizes. We then introduce the ItaGen benchmark, which includes a broad range of natural language understanding and generation tasks for Italian, and use it to evaluate the performance of IT5 models and multilingual baselines. We find monolingual IT5 models to provide the best scale-to-performance ratio across tested models, consistently outperforming their multilingual counterparts and setting a new state-of-the-art for Italian language generation.",
}