suayptalha / medBERT-base

huggingface.co
Total runs: 13
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: December 25 2024
fill-mask

Introduction of medBERT-base

Model Details of medBERT-base

medBERT-logo

medBERT-base

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 in enumerate(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:

  1. Prepare your dataset (e.g., medical texts or gastroenterology-related information) in text format.
  2. Tokenize the dataset and apply masking.
  3. Train the model using the provided training loop.

Here's the training code:

https://github.com/suayptalha/medBERT-base/blob/main/medBERT-base.ipynb

Training Details
Hyperparameters
  • Batch Size : 16
  • Learning Rate : 5e-5
  • Number of Epochs : 1
  • Max Sequence Length : 512 tokens
Dataset
  • Dataset Name : gayanin/pubmed-gastro-maskfilling
  • 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:

suayptalha



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

More medBERT-base license Visit here:

https://choosealicense.com/licenses/apache-2.0

medBERT-base huggingface.co

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.

suayptalha medBERT-base online free

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:

https://huggingface.co/suayptalha/medBERT-base

medBERT-base install

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.

medBERT-base install url in huggingface.co:

https://huggingface.co/suayptalha/medBERT-base

Url of medBERT-base

medBERT-base huggingface.co Url

Provider of medBERT-base huggingface.co

suayptalha
ORGANIZATIONS

Other API from suayptalha

huggingface.co

Total runs: 71
Run Growth: 0
Growth Rate: 0.00%
Updated:June 28 2025
huggingface.co

Total runs: 23
Run Growth: 0
Growth Rate: 0.00%
Updated:December 27 2024
huggingface.co

Total runs: 20
Run Growth: 9
Growth Rate: 45.00%
Updated:January 15 2025
huggingface.co

Total runs: 8
Run Growth: 0
Growth Rate: 0.00%
Updated:December 19 2024
huggingface.co

Total runs: 6
Run Growth: 1
Growth Rate: 16.67%
Updated:October 18 2024
huggingface.co

Total runs: 2
Run Growth: 0
Growth Rate: 0.00%
Updated:December 12 2024