/ Модель

Характеристики

Контекст
512 токенов
Параметры
162 млн
Архитектура
bert · dense
Опубликована
2 мар 2022

bert-base-arabertv2

Заполнение пропусковТекст → текст3 профессии

AraBERTv2 — арабоязычная BERT-модель для заполнения пропусков и адаптации к задачам понимания текста.

13 150скачиваний за 30 дней46лайковвеса обновлены3 авг 2023

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

AraBERTv2 — предварительно обученная языковая модель для арабского языка, разработанная командой AUB MIND Lab на архитектуре Google BERT. Репозиторий содержит вариант BERT-Base с примерно 162,4 млн параметров и контекстом до 512 токенов; модель предсказывает замаскированные токены и служит основой для адаптации к downstream-задачам понимания арабского текста.

AraBERTv2 обучена на крупном арабоязычном корпусе, включающем Википедию, OSCAR, OSIAN и другие источники. Для варианта v2 в карточке указана предварительная сегментация слов с помощью Farasa; README рекомендует применять соответствующую функцию предобработки текста перед использованием. Семейство оценивалось на задачах анализа тональности, распознавания именованных сущностей и ответов на вопросы, однако эти сценарии обычно требуют дополнительной настройки модели.

Модель предназначена для работы с арабским текстом и доступна в форматах PyTorch, TensorFlow и Flax. Лицензия в предоставленных данных не указана.

Сценарии применения

  • предсказание пропущенного слова в арабском предложении
  • дообучение классификатора тональности арабских текстов
  • дообучение модели распознавания именованных сущностей на арабском языке
  • адаптация системы ответов на вопросы по арабским текстам

Ограничения

Для AraBERTv2 рекомендуется предварительная обработка и сегментация арабского текста с помощью ArabertPreprocessor и Farasa. Для прикладных задач, включая анализ тональности, распознавание сущностей и ответы на вопросы, может потребоваться дообучение.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

AraBERT v1 & v2 : Pre-training BERT for Arabic Language Understanding

AraBERT is an Arabic pretrained lanaguage model based on Google's BERT architechture. AraBERT uses the same BERT-Base config. More details are available in the AraBERT Paper and in the AraBERT Meetup

There are two versions of the model, AraBERTv0.1 and AraBERTv1, with the difference being that AraBERTv1 uses pre-segmented text where prefixes and suffixes were splitted using the Farasa Segmenter.

We evalaute AraBERT models on different downstream tasks and compare them to mBERT, and other state of the art models (To the extent of our knowledge). The Tasks were Sentiment Analysis on 6 different datasets (HARD, ASTD-Balanced, ArsenTD-Lev, LABR), Named Entity Recognition with the ANERcorp, and Arabic Question Answering on Arabic-SQuAD and ARCD

AraBERTv2

What's New!

AraBERT now comes in 4 new variants to replace the old v1 versions:

More Detail in the AraBERT folder and in the README and in the AraBERT Paper

ModelHuggingFace Model NameSize (MB/Params)Pre-SegmentationDataSet (Sentences/Size/nWords)
AraBERTv0.2-basebert-base-arabertv02543MB / 136MNo200M / 77GB / 8.6B
AraBERTv0.2-largebert-large-arabertv021.38G 371MNo200M / 77GB / 8.6B
AraBERTv2-basebert-base-arabertv2543MB 136MYes200M / 77GB / 8.6B
AraBERTv2-largebert-large-arabertv21.38G 371MYes200M / 77GB / 8.6B
AraBERTv0.1-basebert-base-arabertv01543MB 136MNo77M / 23GB / 2.7B
AraBERTv1-basebert-base-arabert543MB 136MYes77M / 23GB / 2.7B

All models are available in the HuggingFace model page under the aubmindlab name. Checkpoints are available in PyTorch, TF2 and TF1 formats.

Better Pre-Processing and New Vocab

We identified an issue with AraBERTv1's wordpiece vocabulary. The issue came from punctuations and numbers that were still attached to words when learned the wordpiece vocab. We now insert a space between numbers and characters and around punctuation characters.

The new vocabulary was learnt using the BertWordpieceTokenizer from the tokenizers library, and should now support the Fast tokenizer implementation from the transformers library.

P.S.: All the old BERT codes should work with the new BERT, just change the model name and check the new preprocessing dunction Please read the section on how to use the preprocessing function

Bigger Dataset and More Compute

We used ~3.5 times more data, and trained for longer. For Dataset Sources see the Dataset Section

ModelHardwarenum of examples with seq len (128 / 512)128 (Batch Size/ Num of Steps)512 (Batch Size/ Num of Steps)Total StepsTotal Time (in Days)
AraBERTv0.2-baseTPUv3-8420M / 207M2560 / 1M384/ 2M3M-
AraBERTv0.2-largeTPUv3-128420M / 207M13440 / 250K2056 / 300K550K7
AraBERTv2-baseTPUv3-8420M / 207M2560 / 1M384/ 2M3M-
AraBERTv2-largeTPUv3-128520M / 245M13440 / 250K2056 / 300K550K7
AraBERT-base (v1/v0.1)TPUv2-8-512 / 900K128 / 300K1.2M4

Dataset

The pretraining data used for the new AraBERT model is also used for Arabic AraGPT2 and AraELECTRA.

The dataset consists of 77GB or 200,095,961 lines or 8,655,948,860 words or 82,232,988,358 chars (before applying Farasa Segmentation)

For the new dataset we added the unshuffled OSCAR corpus, after we thoroughly filter it, to the previous dataset used in AraBERTv1 but with out the websites that we previously crawled:

Preprocessing

It is recommended to apply our preprocessing function before training/testing on any dataset. Install farasapy to segment text for AraBERT v1 & v2 pip install farasapy

from arabert.preprocess import ArabertPreprocessor

model_name="bert-base-arabertv2"
arabert_prep = ArabertPreprocessor(model_name=model_name)

text = "ولن نبالغ إذا قلنا إن هاتف أو كمبيوتر المكتب في زمننا هذا ضروري"
arabert_prep.preprocess(text)
>>>"و+ لن نبالغ إذا قل +نا إن هاتف أو كمبيوتر ال+ مكتب في زمن +نا هذا ضروري"

Accepted_models

bert-base-arabertv01
bert-base-arabert
bert-base-arabertv02
bert-base-arabertv2
bert-large-arabertv02
bert-large-arabertv2
araelectra-base
aragpt2-base
aragpt2-medium
aragpt2-large
aragpt2-mega

TensorFlow 1.x models

The TF1.x model are available in the HuggingFace models repo. You can download them as follows:

  • via git-lfs: clone all the models in a repo
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
git lfs install
git clone https://huggingface.co/aubmindlab/MODEL_NAME
tar -C ./MODEL_NAME -zxvf /content/MODEL_NAME/tf1_model.tar.gz

where MODEL_NAME is any model under the aubmindlab name

  • via wget:
    • Go to the tf1_model.tar.gz file on huggingface.co/models/aubmindlab/MODEL_NAME.
    • copy the oid sha256
    • then run wget https://cdn-lfs.huggingface.co/aubmindlab/aragpt2-base/INSERT_THE_SHA_HERE (ex: for aragpt2-base: wget https://cdn-lfs.huggingface.co/aubmindlab/aragpt2-base/3766fc03d7c2593ff2fb991d275e96b81b0ecb2098b71ff315611d052ce65248)

If you used this model please cite us as :

Google Scholar has our Bibtex wrong (missing name), use this instead

@inproceedings{antoun2020arabert,
  title={AraBERT: Transformer-based Model for Arabic Language Understanding},
  author={Antoun, Wissam and Baly, Fady and Hajj, Hazem},
  booktitle={LREC 2020 Workshop Language Resources and Evaluation Conference 11--16 May 2020},
  pages={9}
}

Acknowledgments

Thanks to TensorFlow Research Cloud (TFRC) for the free access to Cloud TPUs, couldn't have done it without this program, and to the AUB MIND Lab Members for the continous support. Also thanks to Yakshof and Assafir for data and storage access. Another thanks for Habib Rahal (https://www.behance.net/rahalhabib), for putting a face to AraBERT.

Contacts

Wissam Antoun: Linkedin | Twitter | Github | wfa07@mail.aub.edu | wissam.antoun@gmail.com

Fady Baly: Linkedin | Twitter | Github | fgb06@mail.aub.edu | baly.fady@gmail.com

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · fill-mask

Можно запустить

Подбираем GPU…

Класс архитектуры
BertForMaskedLM
Ревизия весов
97522ef

0 моделей