This repository contains a BERT-based model,
medBERT-base
, fine-tuned on the
gayanin/pubmed-gastro-maskfilling
dataset for the task of
Masked Language Modeling (MLM)
. The model is trained to predict masked tokens in medical and gastroenterological texts. The goal of this project is to improve the model's understanding and generation of medical-related information in natural language contexts.
Model Architecture
Base Model
:
bert-base-uncased
Task
: Masked Language Modeling (MLM) for medical texts
Tokenizer
: BERT's WordPiece tokenizer
Usage
Loading the Pre-trained Model
You can load the pre-trained
medBERT-base
model using the Hugging Face
transformers
library:
from transformers import BertTokenizer, BertForMaskedLM
import torch
tokenizer = BertTokenizer.from_pretrained('suayptalha/medBERT-base')
model = BertForMaskedLM.from_pretrained('suayptalha/medBERT-base').to("cuda")
input_text = "Response to neoadjuvant chemotherapy best predicts survival [MASK] curative resection of gastric cancer."
inputs = tokenizer(input_text, return_tensors='pt').to("cuda")
outputs = model(**inputs)
masked_index = (inputs['input_ids'][0] == tokenizer.mask_token_id).nonzero(as_tuple=True)[0].item()
top_k = 5
logits = outputs.logits[0, masked_index]
top_k_ids = torch.topk(logits, k=top_k).indices.tolist()
top_k_tokens = tokenizer.convert_ids_to_tokens(top_k_ids)
print("Top 5 prediction:")
for i, token inenumerate(top_k_tokens):
print(f"{i + 1}: {token}")
Top 5 prediction:
1: from
2: of
3: after
4: by
5: through
Fine-tuning the Model
To fine-tune the
medBERT-base
model on your own medical dataset, follow these steps:
Prepare your dataset (e.g., medical texts or gastroenterology-related information) in text format.
Task
: Masked Language Modeling (MLM) on medical texts
Acknowledgements
The
gayanin/pubmed-gastro-maskfilling
dataset is available on the Hugging Face dataset hub and provides a rich collection of medical and gastroenterology-related information for training.
This model uses the Hugging Face
transformers
library, which is a state-of-the-art library for NLP models
Support:
Runs of suayptalha medBERT-base on huggingface.co
13
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs
More Information About medBERT-base huggingface.co Model
medBERT-base huggingface.co is an AI model on huggingface.co that provides medBERT-base's model effect (), which can be used instantly with this suayptalha medBERT-base model. huggingface.co supports a free trial of the medBERT-base model, and also provides paid use of the medBERT-base. Support call medBERT-base model through api, including Node.js, Python, http.
medBERT-base huggingface.co is an online trial and call api platform, which integrates medBERT-base's modeling effects, including api services, and provides a free online trial of medBERT-base, you can try medBERT-base online for free by clicking the link below.
suayptalha medBERT-base online free url in huggingface.co:
medBERT-base is an open source model from GitHub that offers a free installation service, and any user can find medBERT-base on GitHub to install. At the same time, huggingface.co provides the effect of medBERT-base install, users can directly use medBERT-base installed effect in huggingface.co for debugging and trial. It also supports api for free installation.