/ Модель

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

Контекст
1 024 токена
Параметры
50,3 млн
Лицензия
Apache 2.0
Архитектура
bert · dense
Опубликована
3 фев 2023

bioformer-16L

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

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

152скачиваний за 30 дней6лайковвеса обновлены2 авг 2023

Бенчмарки

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

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

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

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

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

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

Bioformer-16L — компактная BERT-модель для анализа биомедицинских текстов, разработанная авторами Bioformer. Она предназначена для языкового моделирования с заполнением пропусков и может служить основой для последующего дообучения на задачах обработки биомедицинского текста. Модель содержит 16 трансформерных слоёв, 8 голов внимания и около 50,3 млн параметров; использует регистрозависимый WordPiece-словарь из 32 768 токенов, обученный на биомедицинских корпусах.

Модель обучена с нуля на 33 млн аннотаций PubMed и 1 млн полнотекстовых статей PMC. Для предобучения применялись маскирование целых слов и задача предсказания следующего предложения. Авторы сообщают, что Bioformer-16L работает примерно вдвое быстрее BERT-base и сопоставима или превосходит BioBERT и PubMedBERT на ряде последующих NLP-задач. README указывает максимальную длину последовательности 512 токенов; метаданные каталога сообщают контекст 1024 токена. Форматы весов — PyTorch и Safetensors. Модель принимает текст и выдаёт текстовые токены для заполнения маски.

Лицензия — Apache-2.0. Модель предназначена для биомедицинских текстов, поэтому её качество на общем тексте и вне биомедицинского домена может быть ниже; заявление о скорости и сравнительном качестве относится к экспериментам авторов.

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

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

Ограничения

Модель специализирована на биомедицинском домене, и её качество на текстах других областей может быть ниже. README указывает длину последовательности до 512 токенов, тогда как метаданные каталога указывают контекст 1024 токена.

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

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

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

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

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

Открыть на Hugging Face

Bioformer-16L is a lightweight BERT model for biomedical text mining. Bioformer-16L uses a biomedical vocabulary and is pre-trained from scratch only on biomedical domain corpora. Our experiments show that Bioformer-16L is 2x as fast as BERT-base, and achieves comparable or even better performance than BioBERT/PubMedBERT on downstream NLP tasks.

Bioformer-16L has 16 layers (transformer blocks) with a hidden embedding size of 384, and the number of self-attention heads is 8. Its total number of parameters is about 42 million.

The usage of Bioformer-16L is the same as a standard BERT model. The documentation of BERT can be found here.

Vocabulary of Bioformer-16L

Bioformer-16L uses a cased WordPiece vocabulary trained from a biomedical corpus, which included all PubMed abstracts (33 million, as of Feb 1, 2021) and 1 million PMC full-text articles. PMC has 3.6 million articles but we down-sampled them to 1 million such that the total size of PubMed abstracts and PMC full-text articles are approximately equal. To mitigate the out-of-vocabulary issue and include special symbols (e.g. male and female symbols) in biomedical literature, we trained Bioformer’s vocabulary from the Unicode text of the two resources. The vocabulary size of Bioformer-16L is 32768 (2^15), which is similar to that of the original BERT.

Pre-training of Bioformer-16L

Bioformer-16L was pre-trained from scratch on the same corpus as the vocabulary (33 million PubMed abstracts + 1 million PMC full-text articles). For the masked language modeling (MLM) objective, we used whole-word masking with a masking rate of 15%. There are debates on whether the next sentence prediction (NSP) objective could improve the performance on downstream tasks. We include it in our pre-training experiment in case the prediction of the next sentence is needed by end-users. Sentence segmentation of all training text was performed using SciSpacy.

Pre-training of Bioformer-16L was performed on a single Cloud TPU device (TPUv2, 8 cores, 8GB memory per core). The maximum input sequence length was fixed to 512, and the batch size was set to 256. We pre-trained Bioformer-16L for 2 million steps, which took about 11 days.

Usage

Prerequisites: python3, pytorch, transformers and datasets

We have tested the following commands on Python v3.9.16, PyTorch v1.13.1+cu117, Datasets v2.9.0 and Transformers v4.26.

To install pytorch, please refer to instructions here.

To install the transformers and datasets library:

pip install transformers
pip install datasets

Filling mask

from transformers import pipeline
unmasker8L = pipeline('fill-mask', model='bioformers/bioformer-8L')
unmasker8L("[MASK] refers to a group of diseases that affect how the body uses blood sugar (glucose)")

unmasker16L = pipeline('fill-mask', model='bioformers/bioformer-16L')
unmasker16L("[MASK] refers to a group of diseases that affect how the body uses blood sugar (glucose)")

Output of bioformer-8L:

[{'score': 0.3207533359527588, 
'token': 13473, 
'token_str': 'Diabetes', 
'sequence': 'Diabetes refers to a group of diseases that affect how the body uses blood sugar ( glucose )'}, 

{'score': 0.19234347343444824, 
'token': 17740, 
'token_str': 'Obesity', 
'sequence': 'Obesity refers to a group of diseases that affect how the body uses blood sugar ( glucose )'}, 

{'score': 0.09200277179479599, 
'token': 10778, 
'token_str': 'T2DM', 
'sequence': 'T2DM refers to a group of diseases that affect how the body uses blood sugar ( glucose )'}, 

{'score': 0.08494312316179276, 
'token': 2228, 
'token_str': 'It', 
'sequence': 'It refers to a group of diseases that affect how the body uses blood sugar ( glucose )'}, 

{'score': 0.0412776917219162, 
'token': 22263, 
'token_str': 
'Hypertension', 
'sequence': 'Hypertension refers to a group of diseases that affect how the body uses blood sugar ( glucose )'}]

Output of bioformer-16L:

[{'score': 0.7262957692146301,
'token': 13473,
'token_str': 'Diabetes',
'sequence': 'Diabetes refers to a group of diseases that affect how the body uses blood sugar ( glucose )'},

{'score': 0.124954953789711,
'token': 10778,
'token_str': 'T2DM',
'sequence': 'T2DM refers to a group of diseases that affect how the body uses blood sugar ( glucose )'},

{'score': 0.04062706232070923,
'token': 2228,
'token_str': 'It',
'sequence': 'It refers to a group of diseases that affect how the body uses blood sugar ( glucose )'}, 

{'score': 0.022694870829582214,
'token': 17740,
'token_str': 'Obesity',
'sequence': 'Obesity refers to a group of diseases that affect how the body uses blood sugar ( glucose )'},

{'score': 0.009743048809468746,
'token': 13960,
'token_str': 'T2D',
'sequence': 'T2D refers to a group of diseases that affect how the body uses blood sugar ( glucose )'}]

Link

Bioformer-8L

Acknowledgment

Training and evaluation of Bioformer-8L is supported by the Google TPU Research Cloud (TRC) program, the Intramural Research Program of the National Library of Medicine (NLM), National Institutes of Health (NIH), and NIH/NLM grants LM012895 and 1K99LM014024-01.

Questions

If you have any questions, please submit an issue here: https://github.com/WGLab/bioformer/issues

You can also send an email to Li Fang (fangli9@mail.sysu.edu.cn, https://fangli80.github.io/).

Citation

You can cite our preprint on arXiv:

Fang L, Chen Q, Wei C-H, Lu Z, Wang K: Bioformer: an efficient transformer language model for biomedical text mining. arXiv preprint arXiv:2302.01588 (2023). DOI: https://doi.org/10.48550/arXiv.2302.01588

BibTeX format:

@ARTICLE{fangli2023bioformer,
    author = {{Fang}, Li and {Chen}, Qingyu and {Wei}, Chih-Hsuan and {Lu}, Zhiyong and {Wang}, Kai},
    title = "{Bioformer: an efficient transformer language model for biomedical text mining}",
    journal = {arXiv preprint arXiv:2302.01588},
    year = {2023}
}

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

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

GPU в ailist

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

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

Подбираем GPU…

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

0 моделей