Instructions to use Ra-Is/medical-gen-small-CoT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Ra-Is/medical-gen-small-CoT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Ra-Is/medical-gen-small-CoT")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("Ra-Is/medical-gen-small-CoT") model = AutoModelForSeq2SeqLM.from_pretrained("Ra-Is/medical-gen-small-CoT") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Ra-Is/medical-gen-small-CoT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Ra-Is/medical-gen-small-CoT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ra-Is/medical-gen-small-CoT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Ra-Is/medical-gen-small-CoT
- SGLang
How to use Ra-Is/medical-gen-small-CoT with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Ra-Is/medical-gen-small-CoT" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ra-Is/medical-gen-small-CoT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Ra-Is/medical-gen-small-CoT" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ra-Is/medical-gen-small-CoT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Ra-Is/medical-gen-small-CoT with Docker Model Runner:
docker model run hf.co/Ra-Is/medical-gen-small-CoT
Medical Generation Model (CoT Fine-Tuned)
Overview
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.
Model Details
- Base Model: Ra-Is/medical-gen-small
- Fine-tuning Technique: Complex Chain of Thought (CoT)
- Tokenizer: T5 tokenizer
- Training Data: Clinical scenarios, structured medical datasets
- Use Case: Medical diagnosis and treatment recommendation
Installation
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)
- Downloads last month
- -