truehealth/medqa
Viewer • Updated • 12.7k • 288 • 5
How to use Aranya31/gpt2-medqa-ft with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Aranya31/gpt2-medqa-ft") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Aranya31/gpt2-medqa-ft")
model = AutoModelForCausalLM.from_pretrained("Aranya31/gpt2-medqa-ft")How to use Aranya31/gpt2-medqa-ft with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Aranya31/gpt2-medqa-ft"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Aranya31/gpt2-medqa-ft",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/Aranya31/gpt2-medqa-ft
How to use Aranya31/gpt2-medqa-ft with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Aranya31/gpt2-medqa-ft" \
--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": "Aranya31/gpt2-medqa-ft",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "Aranya31/gpt2-medqa-ft" \
--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": "Aranya31/gpt2-medqa-ft",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use Aranya31/gpt2-medqa-ft with Docker Model Runner:
docker model run hf.co/Aranya31/gpt2-medqa-ft
This model is a GPT-2 language model fine-tuned on the MedQA dataset for medical multiple-choice question answering. It is trained to generate relevant medical answers conditioned on clinical questions, suitable for downstream applications in automated medical education or QA systems.
gpt2This model should be used by professionals or in educational contexts only. Always verify generated information against trusted medical sources.
from transformers import AutoTokenizer, AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("Aranya31/gpt2-medqa-ft")
tokenizer = AutoTokenizer.from_pretrained("Aranya31/gpt2-medqa-ft")
prompt = "What is the recommended treatment for acute asthma?\nAnswer:"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_length=100, do_sample=True, temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
truehealth/medqa, containing USMLE-style medical multiple-choice questions@misc{gpt2-medqa-finetuned,
title={GPT-2 Fine-tuned on MedQA},
author={Aranya Saha},
year={2025},
howpublished={\url{https://huggingface.co/Aranya31/gpt2-medqa-ft}}
}
For questions or issues, contact: aranyasaha932@gmail.com
Base model
openai-community/gpt2