/ Модель

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

Контекст
514 токенов
Параметры
138 млн
Лицензия
Apache 2.0
Архитектура
camembert · dense
Библиотека
transformers
Опубликована
25 дек 2022

DrBERT-4GB

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

Производная модели Dr-BERT/DrBERT-7GB. Франкоязычная CamemBERT-модель, обученная на медицинских текстах для заполнения пропусков и адаптации к биомедицинским NLP-задачам.

129скачиваний за 30 дней1лайквеса обновлены28 мая 2023

Бенчмарки

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

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

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

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

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

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

Карточка модели Dr-BERT/DrBERT-4GB на Hugging Face совпадает с карточкой Dr-BERT/DrBERT-7GB, поэтому описание составлено по ней.

DrBERT-7GB — франкоязычная языковая модель для биомедицинской и клинической областей, разработанная авторами проекта DrBERT. Это модель архитектуры CamemBERT/RoBERTa с 137,8 млн параметров, обученная на открытом корпусе французских медицинских текстов NACHOS объёмом 7 ГБ. Она предназначена прежде всего для предсказания пропущенных слов и может служить основой для дообучения под другие задачи обработки медицинских текстов. Модель принимает текст и выдаёт вероятности токенов для заполнения маски; максимальная длина последовательности составляет около 512 токенов. Обучение на специализированных французских данных ориентирует её на медицинскую лексику, но не гарантирует клиническую точность и не заменяет экспертную проверку. Веса опубликованы под лицензией Apache-2.0.

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

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

Ограничения

Модель рассчитана на французские медицинские тексты и имеет контекст около 512 токенов. Предсказания требуют проверки специалистом и не должны использоваться как самостоятельные клинические рекомендации.

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

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

Открыть на Hugging Face

DrBERT: A Robust Pre-trained Model in French for Biomedical and Clinical domains

In recent years, pre-trained language models (PLMs) achieve the best performance on a wide range of natural language processing (NLP) tasks. While the first models were trained on general domain data, specialized ones have emerged to more effectively treat specific domains. In this paper, we propose an original study of PLMs in the medical domain on French language. We compare, for the first time, the performance of PLMs trained on both public data from the web and private data from healthcare establishments. We also evaluate different learning strategies on a set of biomedical tasks. Finally, we release the first specialized PLMs for the biomedical field in French, called DrBERT, as well as the largest corpus of medical data under free license on which these models are trained.

1. DrBERT models

DrBERT is a French RoBERTa trained on a open source corpus of French medical crawled textual data called NACHOS. Models with different amount of data from differents public and private sources are trained using the CNRS (French National Centre for Scientific Research) Jean Zay French supercomputer. Only the weights of the models trained using exclusively open-sources data are publicly released to prevent any personnal information leak and to follow the european GDPR laws :

Model nameCorpusNumber of layersAttention HeadsEmbedding DimensionSequence LengthModel URL
DrBERT-7-GB-cased-LargeNACHOS 7 GB24161024512HuggingFace
DrBERT-7-GB-casedNACHOS 7 GB1212768512HuggingFace
DrBERT-4-GB-casedNACHOS 4 GB1212768512HuggingFace
DrBERT-4-GB-cased-CP-CamemBERTNACHOS 4 GB1212768512HuggingFace
DrBERT-4-GB-cased-CP-PubMedBERTNACHOS 4 GB1212768512HuggingFace

2. Using DrBERT

You can use DrBERT with Hugging Face's Transformers library as follow.

Loading the model and tokenizer :

from transformers import AutoModel, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("Dr-BERT/DrBERT-7GB")
model = AutoModel.from_pretrained("Dr-BERT/DrBERT-7GB")

Perform the mask filling task :

from transformers import pipeline 

fill_mask  = pipeline("fill-mask", model="Dr-BERT/DrBERT-7GB", tokenizer="Dr-BERT/DrBERT-7GB")
results = fill_mask("La patiente est atteinte d'une <mask>")

3. Pre-training DrBERT tokenizer and model from scratch by using HuggingFace Transformers Library

3.1 Install dependencies

accelerate @ git+https://github.com/huggingface/accelerate@66edfe103a0de9607f9b9fdcf6a8e2132486d99b
datasets==2.6.1
sentencepiece==0.1.97
protobuf==3.20.1
evaluate==0.2.2
tensorboard==2.11.0
torch >= 1.3

3.2 Download NACHOS Dataset text file

Download the full NACHOS dataset from Zenodo and place it the the from_scratch or continued_pretraining directory.

3.3 Build your own tokenizer from scratch based on NACHOS

Note : This step is required only in the case of an from scratch pre-training, if you want to do a continued pre-training you just have to download the model and the tokenizer that correspond to the model you want to continue the training from. In this case, you simply have to go to the HuggingFace Hub, select a model (for example RoBERTa-base). Finally, you have to download the entire model / tokenizer repository by clicking on the Use In Transformers button and get the Git link git clone https://huggingface.co/roberta-base.

Build the tokenizer from scratch on your data of the file ./corpus.txt by using ./build_tokenizer.sh.

3.4 Preprocessing and tokenization of the dataset

First, replace the field tokenizer_path of the shell script to match the path of your tokenizer directory downloaded before using HuggingFace Git or the one you have build.

Run ./preprocessing_dataset.sh to generate the tokenized dataset by using the givent tokenizer.

3.5 Model training

First, change the number of GPUs --ntasks=128 you are needing to match your computational capabilities in the shell script called run_training.sh. In our case, we used 128 V100 32 GB GPUs from 32 nodes of 4 GPUs (--ntasks-per-node=4 and --gres=gpu:4) during 20 hours (--time=20:00:00).

If you are using Jean Zay, you also need to change the -A flag to match one of your @gpu profile capable of running the job. You also need to move ALL of your datasets, tokenizer, script and outputs on the $SCRATCH disk space to preserve others users of suffuring of IO issues.

3.5.1 Pre-training from scratch

Once the SLURM parameters updated, you have to change name of the model architecture in the flag --model_type="camembert" and to update the --config_overrides= according to the specifications of the architecture you are trying to train. In our case, RoBERTa had a 514 sequence length, a vocabulary of 32005 (32K tokens of the tokenizer and 5 of the model architecture) tokens, the identifier of the beginning-of-sentence token (BOS) and end-of-sentence token (EOS) are respectivly 5 and 6. Change the

Then, go to ./from_scratch/ directory.

Run sbatch ./run_training.sh to send the training job in the SLURM queue.

3.5.2 continue pre-training

Once the SLURM parameters updated, you have to change path of the model / tokenizer you want to start from --model_name_or_path= / --tokenizer_name= to the path of the model downloaded from HuggingFace's Git in the section 3.3.

Then, go to ./continued_pretraining/ directory.

Run sbatch ./run_training.sh to send the training job in the SLURM queue.

4. Fine-tuning on a downstream task

You just need to change the name of the model to Dr-BERT/DrBERT-7GB in any of the examples given by HuggingFace's team here.

Citation BibTeX

@inproceedings{labrak2023drbert,
    title = {{DrBERT: A Robust Pre-trained Model in French for Biomedical and Clinical domains}},
    author = {Labrak, Yanis and Bazoge, Adrien and Dufour, Richard and Rouvier, Mickael and Morin, Emmanuel and Daille, Béatrice and Gourraud, Pierre-Antoine},
    booktitle = {Proceedings of the 61th Annual Meeting of the Association for Computational Linguistics (ACL'23), Long Paper},
    month = july,
    year = 2023,
    address = {Toronto, Canada},
    publisher = {Association for Computational Linguistics}
}

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

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

GPU в ailist

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

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

Подбираем GPU…

Класс архитектуры
CamembertForMaskedLM
Ревизия весов
fdeb8b9

0 моделей