Instructions to use ifms111/UniReason-Med with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ifms111/UniReason-Med with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="ifms111/UniReason-Med", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("ifms111/UniReason-Med") model = AutoModelForMultimodalLM.from_pretrained("ifms111/UniReason-Med", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ifms111/UniReason-Med with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ifms111/UniReason-Med" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ifms111/UniReason-Med", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/ifms111/UniReason-Med
- SGLang
How to use ifms111/UniReason-Med 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 "ifms111/UniReason-Med" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ifms111/UniReason-Med", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "ifms111/UniReason-Med" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ifms111/UniReason-Med", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use ifms111/UniReason-Med with Docker Model Runner:
docker model run hf.co/ifms111/UniReason-Med
UniReason-Med
UniReason-Med is a medical multimodal model for grounded reasoning over 2D medical images and slice-serialized 3D volumes.
It studies whether grounded reasoning supervision from abundant 2D medical images can improve 3D medical VQA when both modalities share a common reasoning interface. A single checkpoint processes either a 2D image or a 3D volume serialized as ordered slices, generating interleaved textual reasoning and localized visual evidence through shared bounding-box syntax and region-token injection.
- Base model: Qwen/Qwen2.5-VL-7B-Instruct
- Training data: ifms111/UniReason-Med-Data
- Modalities: image + text -> text
- License: Apache-2.0
Model Description
UniReason-Med is trained to interleave free-form reasoning with localized visual evidence. During reasoning, the model emits bounding boxes over the input image; the referenced region is cropped and re-injected as additional visual context for the next reasoning step. The same shared interface is applied to 2D images and to 3D volumes serialized as ordered slice sequences.
Training
The model is built with supervised fine-tuning followed by GRPO reinforcement learning. RL uses answer-correctness and format rewards rather than ground-truth localization-overlap rewards such as IoU or Dice.
Intended Use and Limitations
- Intended use: research on medical multimodal reasoning, visual grounding, and 2D-to-3D transfer.
- Out of scope: this is a research artifact and is not a medical device. It must not be used for clinical diagnosis, treatment decisions, or real patient care.
- Limitations: outputs may be incorrect, incomplete, or biased; predicted bounding boxes are reasoning aids, not validated localization.
License
Released under the Apache License 2.0, consistent with the base model Qwen2.5-VL-7B-Instruct.
- Downloads last month
- 23
Model tree for ifms111/UniReason-Med
Base model
Qwen/Qwen2.5-VL-7B-Instruct