Downloads · 30 days
16
35% of all-time downloads
Ra-Is/medical-gen-small-CoT
medical-gen-small-CoT is a text generation model from Ra-Is. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This repository contains Ra-Is/medical-gen-small-CoT, a fine-tuned version of Ra-Is/medical-gen-small. This model incorporates Complex Chain of Thought (CoT) reasoning, improving medical diagnosis generation by enhanc…
Downloads · 30 days
16
35% of all-time downloads
All-time downloads
46
Public
Repo size
375 MB
Likes
0
Public
Click a slice to open those files.
.h5374 MB · 100%
From the Hugging Face model README
This repository contains Ra-Is/medical-gen-small-CoT, a fine-tuned version of Ra-Is/medical-gen-small. This model incorporates Complex Chain of Thought (CoT) reasoning, improving medical diagnosis generation by enhancing logical and step-by-step reasoning in clinical scenarios.
Fine-tuned on structured medical datasets, this model is optimized to provide more contextually aware and clinically relevant responses, making it useful for medical professionals and AI-assisted healthcare solutions.
To use this model, install the required libraries with pip:
pip install transformers
pip install tensorflow
# Load the fine-tuned model and tokenizer
from transformers import T5Tokenizer, TFT5ForConditionalGeneration
model_id = "Ra-Is/medical-gen-small-CoT"
model = TFT5ForConditionalGeneration.from_pretrained(model_id)
tokenizer = T5Tokenizer.from_pretrained(model_id)
# Prepare a sample input prompt
input_prompt = ("A 35-year-old female presents with a 2-week history of "
"persistent cough, shortness of breath, and fatigue. She has "
"a history of asthma and has recently been exposed to a sick "
"family member with a respiratory infection. Chest X-ray shows "
"bilateral infiltrates. What is the likely diagnosis, and what "
"should be the treatment?")
# Tokenize the input
input_ids = tokenizer(input_prompt, return_tensors="tf").input_ids
# Generate the output (diagnosis)
outputs = model.generate(
input_ids,
max_length=512,
num_beams=5,
temperature=1,
top_k=50,
top_p=0.9,
do_sample=True, # Enable sampling
early_stopping=True
)
# Decode and print the output
generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated_text)