模型概述
模型特點
模型能力
使用案例
🚀 RoBERTa大模型:基於西班牙國家圖書館(BNE)數據訓練
本項目基於Transformer架構,利用西班牙國家圖書館(BNE)的大規模西班牙語語料,對RoBERTa大模型進行預訓練,得到了適用於西班牙語的掩碼語言模型roberta-large-bne。該模型可用於填空任務,也可針對問答、文本分類、命名實體識別等下游任務進行微調。
🚀 快速開始
基礎用法
>>> from transformers import pipeline
>>> from pprint import pprint
>>> unmasker = pipeline('fill-mask', model='PlanTL-GOB-ES/roberta-large-bne')
>>> pprint(unmasker("Gracias a los datos de la BNE se ha podido <mask> este modelo del lenguaje."))
[{'score': 0.0664491355419159,
'sequence': ' Gracias a los datos de la BNE se ha podido conocer este modelo del lenguaje.',
'token': 1910,
'token_str': ' conocer'},
{'score': 0.0492338091135025,
'sequence': ' Gracias a los datos de la BNE se ha podido realizar este modelo del lenguaje.',
'token': 2178,
'token_str': ' realizar'},
{'score': 0.03890657424926758,
'sequence': ' Gracias a los datos de la BNE se ha podido reconstruir este modelo del lenguaje.',
'token': 23368,
'token_str': ' reconstruir'},
{'score': 0.03662774711847305,
'sequence': ' Gracias a los datos de la BNE se ha podido desarrollar este modelo del lenguaje.',
'token': 3815,
'token_str': ' desarrollar'},
{'score': 0.030557377263903618,
'sequence': ' Gracias a los datos de la BNE se ha podido estudiar este modelo del lenguaje.',
'token': 6361,
'token_str': ' estudiar'}]
高級用法
>>> from transformers import RobertaTokenizer, RobertaModel
>>> tokenizer = RobertaTokenizer.from_pretrained('PlanTL-GOB-ES/roberta-large-bne')
>>> model = RobertaModel.from_pretrained('PlanTL-GOB-ES/roberta-large-bne')
>>> text = "Gracias a los datos de la BNE se ha podido desarrollar este modelo del lenguaje."
>>> encoded_input = tokenizer(text, return_tensors='pt')
>>> output = model(**encoded_input)
>>> print(output.last_hidden_state.shape)
torch.Size([1, 19, 1024])
✨ 主要特性
- 架構:roberta-large
- 語言:西班牙語
- 任務:填空任務(fill-mask)
- 數據:BNE
📦 安裝指南
文檔未提及安裝步驟,暫不提供。
📚 詳細文檔
模型描述
roberta-large-bne 是一個基於Transformer的西班牙語掩碼語言模型。它基於 RoBERTa 大模型,並使用了截至目前已知的最大西班牙語語料庫進行預訓練。該語料庫由 西班牙國家圖書館(Biblioteca Nacional de España) 在2009年至2019年期間進行的網絡爬取數據編譯而成,總共處理了570GB的乾淨且去重的文本。
預期用途和限制
roberta-large-bne 模型僅可直接用於掩碼語言建模以執行填空任務(您可以嘗試推理API或閱讀下一節內容)。不過,它旨在針對非生成式下游任務進行微調,例如問答、文本分類或命名實體識別。您可以使用原始模型進行填空任務,也可以將其微調以用於下游任務。
侷限性和偏差
在提交時,尚未採取任何措施來評估模型中嵌入的偏差和毒性。然而,我們深知由於語料庫是通過對多個網絡源進行爬取技術收集的,我們的模型可能存在偏差。我們打算在未來對這些領域進行研究,如果研究完成,此模型卡片將進行更新。
訓練
訓練數據
西班牙國家圖書館(Biblioteca Nacional de España) 每年對所有 .es 域名進行一次爬取。訓練語料庫由2009年至2019年期間這些爬取得到的59TB的WARC文件組成。
為了獲得高質量的訓練語料庫,語料庫經過了一系列操作的預處理,包括句子分割、語言檢測、過濾格式錯誤的句子以及去重重複內容等。在處理過程中,文檔邊界得以保留。這最終得到了2TB的乾淨西班牙語語料庫。進一步對語料庫進行全局去重,得到了570GB的文本。
語料庫的一些統計信息如下:
語料庫 | 文檔數量 | 標記數量 | 大小(GB) |
---|---|---|---|
BNE | 201,080,084 | 135,733,450,668 | 570GB |
訓練過程
訓練語料庫使用了原始 RoBERTa 模型中使用的字節版本的字節對編碼(BPE)進行分詞,詞彙表大小為50,262個標記。
roberta-large-bne 的預訓練包括掩碼語言模型訓練,遵循了RoBERTa大模型的訓練方法。訓練總共持續了96小時,使用了32個計算節點,每個節點配備4個16GB VRAM的NVIDIA V100 GPU。
評估
當在下游任務上進行微調時,該模型取得了以下結果:
數據集 | 指標 | RoBERTa-large |
---|---|---|
MLDoc | F1 | 0.9702 |
CoNLL-NERC | F1 | 0.8823 |
CAPITEL-NERC | F1 | 0.9051 |
PAWS-X | F1 | 0.9150 |
UD-POS | F1 | 0.9904 |
CAPITEL-POS | F1 | 0.9856 |
SQAC | F1 | 0.8202 |
STS | 綜合 | 0.8411 |
XNLI | 準確率 | 0.8263 |
附加信息
作者
巴塞羅那超級計算中心的文本挖掘單元(TeMU)(bsc-temu@bsc.es)
聯繫信息
如需進一步信息,請發送電子郵件至 plantl-gob-es@bsc.es
版權
版權歸 西班牙數字化與人工智能國務秘書處(SEDIA) 所有(2022年)
許可信息
本作品根據 Apache許可證,版本2.0 進行許可。
資金支持
本工作由 西班牙數字化與人工智能國務秘書處(SEDIA) 在Plan-TL框架內提供資金支持。
引用信息
如果您使用此模型,請引用我們的 論文:
@article{,
abstract = {We want to thank the National Library of Spain for such a large effort on the data gathering and the Future of Computing Center, a
Barcelona Supercomputing Center and IBM initiative (2020). This work was funded by the Spanish State Secretariat for Digitalization and Artificial
Intelligence (SEDIA) within the framework of the Plan-TL.},
author = {Asier Gutiérrez Fandiño and Jordi Armengol Estapé and Marc Pàmies and Joan Llop Palao and Joaquin Silveira Ocampo and Casimiro Pio Carrino and Carme Armentano Oller and Carlos Rodriguez Penagos and Aitor Gonzalez Agirre and Marta Villegas},
doi = {10.26342/2022-68-3},
issn = {1135-5948},
journal = {Procesamiento del Lenguaje Natural},
keywords = {Artificial intelligence,Benchmarking,Data processing.,MarIA,Natural language processing,Spanish language modelling,Spanish language resources,Tractament del llenguatge natural (Informàtica),Àrees temàtiques de la UPC::Informàtica::Intel·ligència artificial::Llenguatge natural},
publisher = {Sociedad Española para el Procesamiento del Lenguaje Natural},
title = {MarIA: Spanish Language Models},
volume = {68},
url = {https://upcommons.upc.edu/handle/2117/367156#.YyMTB4X9A-0.mendeley},
year = {2022},
}
免責聲明
本倉庫中發佈的模型旨在用於通用目的,並可供第三方使用。這些模型可能存在偏差和/或任何其他不良扭曲。
當第三方使用這些模型(或基於這些模型的系統)向其他方部署或提供系統和/或服務,或成為模型的用戶時,他們應注意,減輕使用這些模型所產生的風險並在任何情況下遵守適用法規(包括有關人工智能使用的法規)是他們的責任。
在任何情況下,模型的所有者(SEDIA - 數字化與人工智能國務秘書處)和創建者(BSC - 巴塞羅那超級計算中心)均不對第三方使用這些模型所產生的任何結果負責。



