🚀 ALBERT - 波斯语版
ALBERT - 波斯语版是用于波斯语语言表征自监督学习的轻量级BERT模型,能助力波斯语相关的自然语言处理任务,为波斯语的语义理解和分析提供强大支持。
🚀 快速开始
安装依赖
- 若要使用任意类型的Albert模型,你需要安装
sentencepiece
。
- 在你的笔记本中运行以下命令:
!pip install -q sentencepiece
代码示例
TensorFlow 2.0
from transformers import AutoConfig, AutoTokenizer, TFAutoModel
config = AutoConfig.from_pretrained("m3hrdadfi/albert-fa-base-v2")
tokenizer = AutoTokenizer.from_pretrained("m3hrdadfi/albert-fa-base-v2")
model = TFAutoModel.from_pretrained("m3hrdadfi/albert-fa-base-v2")
text = "ما در هوشواره معتقدیم با انتقال صحیح دانش و آگاهی، همه افراد میتوانند از ابزارهای هوشمند استفاده کنند. شعار ما هوش مصنوعی برای همه است."
tokenizer.tokenize(text)
>>> ['▁ما', '▁در', '▁هوش', 'واره', '▁معتقد', 'یم', '▁با', '▁انتقال', '▁صحیح', '▁دانش', '▁و', '▁اگاه', 'ی', '،', '▁همه', '▁افراد', '▁می', '▁توانند', '▁از', '▁ابزارهای', '▁هوشمند', '▁استفاده', '▁کنند', '.', '▁شعار', '▁ما', '▁هوش', '▁مصنوعی', '▁برای', '▁همه', '▁است', '.']
Pytorch
from transformers import AutoConfig, AutoTokenizer, AutoModel
config = AutoConfig.from_pretrained("m3hrdadfi/albert-fa-base-v2")
tokenizer = AutoTokenizer.from_pretrained("m3hrdadfi/albert-fa-base-v2")
model = AutoModel.from_pretrained("m3hrdadfi/albert-fa-base-v2")
✨ 主要特性
- 大规模语料训练:ALBERT - 波斯语版在大量公共语料库(如波斯语维基百科转储、MirasText)以及从各类网站手动爬取的六种文本数据(包括科学、生活方式、行程安排、数字杂志、通用对话等领域,还有从古至今的小说、故事书、短篇小说等书籍内容)上进行了训练。
- 多任务适用性:可用于掩码语言建模或下一句预测任务,不过主要用于下游任务的微调。
📚 详细文档
预期用途和限制
你可以将原始模型用于掩码语言建模或下一句预测,但它主要用于在下游任务上进行微调。你可以在[模型中心](https://huggingface.co/models?search=albert - fa)查找你感兴趣任务的微调版本。
训练情况
ALBERT - 波斯语版是首次针对波斯语的ALBERT尝试。该模型基于Google的ALBERT BASE Version 2.0,在超过390万份文档、7300万句话和13亿个单词的多种写作风格和主题(如科学、小说、新闻等)上进行训练,训练方式与ParsBERT类似。
训练目标
训练期间的目标如下(140K步之后):
***** Eval results *****
global_step = 140000
loss = 2.0080082
masked_lm_accuracy = 0.6141017
masked_lm_loss = 1.9963315
sentence_order_accuracy = 0.985
sentence_order_loss = 0.06908702
衍生模型
基础配置
- Albert模型:
- [m3hrdadfi/albert - fa - base - v2](https://huggingface.co/m3hrdadfi/albert - fa - base - v2)
- Albert情感分析:
- [m3hrdadfi/albert - fa - base - v2 - sentiment - digikala](https://huggingface.co/m3hrdadfi/albert - fa - base - v2 - sentiment - digikala)
- [m3hrdadfi/albert - fa - base - v2 - sentiment - snappfood](https://huggingface.co/m3hrdadfi/albert - fa - base - v2 - sentiment - snappfood)
- [m3hrdadfi/albert - fa - base - v2 - sentiment - deepsentipers - binary](https://huggingface.co/m3hrdadfi/albert - fa - base - v2 - sentiment - deepsentipers - binary)
- [m3hrdadfi/albert - fa - base - v2 - sentiment - deepsentipers - multi](https://huggingface.co/m3hrdadfi/albert - fa - base - v2 - sentiment - deepsentipers - multi)
- [m3hrdadfi/albert - fa - base - v2 - sentiment - binary](https://huggingface.co/m3hrdadfi/albert - fa - base - v2 - sentiment - binary)
- [m3hrdadfi/albert - fa - base - v2 - sentiment - multi](https://huggingface.co/m3hrdadfi/albert - fa - base - v2 - sentiment - multi)
- Albert文本分类:
- [m3hrdadfi/albert - fa - base - v2 - clf - digimag](https://huggingface.co/m3hrdadfi/albert - fa - base - v2 - clf - digimag)
- [m3hrdadfi/albert - fa - base - v2 - clf - persiannews](https://huggingface.co/m3hrdadfi/albert - fa - base - v2 - clf - persiannews)
- Albert命名实体识别:
- [m3hrdadfi/albert - fa - base - v2 - ner](https://huggingface.co/m3hrdadfi/albert - fa - base - v2 - ner)
- [m3hrdadfi/albert - fa - base - v2 - ner - arman](https://huggingface.co/m3hrdadfi/albert - fa - base - v2 - ner - arman)
评估结果
情感分析(SA)任务
数据集 |
ALBERT - fa - base - v2 |
ParsBERT - v1 |
mBERT |
DeepSentiPers |
迪吉卡拉用户评论 |
81.12 |
81.74 |
80.74 |
- |
斯纳普食品用户评论 |
85.79 |
88.12 |
87.87 |
- |
SentiPers(多分类) |
66.12 |
71.11 |
- |
69.33 |
SentiPers(二分类) |
91.09 |
92.13 |
- |
91.98 |
文本分类(TC)任务
数据集 |
ALBERT - fa - base - v2 |
ParsBERT - v1 |
mBERT |
迪吉卡拉杂志 |
92.33 |
93.59 |
90.72 |
波斯语新闻 |
97.01 |
97.19 |
95.79 |
命名实体识别(NER)任务
数据集 |
ALBERT - fa - base - v2 |
ParsBERT - v1 |
mBERT |
MorphoBERT |
Beheshti - NER |
LSTM - CRF |
基于规则的CRF |
BiLSTM - CRF |
PEYMA |
88.99 |
93.10 |
86.64 |
- |
90.59 |
- |
84.00 |
- |
ARMAN |
97.43 |
98.79 |
95.89 |
89.9 |
84.03 |
86.55 |
- |
77.45 |
BibTeX引用和引用信息
请在出版物中按以下方式引用:
@misc{ALBERT-Persian,
author = {Mehrdad Farahani},
title = {ALBERT-Persian: A Lite BERT for Self-supervised Learning of Language Representations for the Persian Language},
year = {2020},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/m3hrdadfi/albert-persian}},
}
@article{ParsBERT,
title={ParsBERT: Transformer-based Model for Persian Language Understanding},
author={Mehrdad Farahani, Mohammad Gharachorloo, Marzieh Farahani, Mohammad Manthouri},
journal={ArXiv},
year={2020},
volume={abs/2005.12515}
}
问题反馈
如果你有任何问题,请在[ALBERT - 波斯语版](https://github.com/m3hrdadfi/albert - persian)仓库中发布GitHub问题。
📄 许可证
本项目采用Apache 2.0许可证。