🚀 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許可證。