Image-Text-to-Text
Transformers
Safetensors
English
qwen2_5_vl
medical
multimodal
vqa
visual-grounding
chain-of-thought
reinforcement-learning
grpo
conversational
text-generation-inference
Instructions to use IQuestLab/UniReason-Med with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IQuestLab/UniReason-Med with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="IQuestLab/UniReason-Med") 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("IQuestLab/UniReason-Med") model = AutoModelForMultimodalLM.from_pretrained("IQuestLab/UniReason-Med") 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 IQuestLab/UniReason-Med with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "IQuestLab/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": "IQuestLab/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/IQuestLab/UniReason-Med
- SGLang
How to use IQuestLab/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 "IQuestLab/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": "IQuestLab/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 "IQuestLab/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": "IQuestLab/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 IQuestLab/UniReason-Med with Docker Model Runner:
docker model run hf.co/IQuestLab/UniReason-Med
Add model card and Apache-2.0 license
#3
by RobinChen2001 - opened
README.md
CHANGED
|
@@ -32,6 +32,7 @@ injection under a common grounded reasoning policy.
|
|
| 32 |
|
| 33 |
- **Base model:** [Qwen/Qwen2.5-VL-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct)
|
| 34 |
- **Training data:** [IQuestLab/UniReason-Med-Data](https://huggingface.co/datasets/IQuestLab/UniReason-Med-Data)
|
|
|
|
| 35 |
- **Modalities:** image + text → text
|
| 36 |
- **License:** Apache-2.0
|
| 37 |
|
|
@@ -63,36 +64,6 @@ This checkpoint is the merged Hugging Face model exported from the GRPO stage.
|
|
| 63 |
Training code (LLaMA-Factory for SFT, verl for GRPO) and configs are released at:
|
| 64 |
<https://github.com/IQuestLab/unireason-med>.
|
| 65 |
|
| 66 |
-
## Usage
|
| 67 |
-
|
| 68 |
-
```python
|
| 69 |
-
from transformers import AutoModelForImageTextToText, AutoProcessor
|
| 70 |
-
from PIL import Image
|
| 71 |
-
|
| 72 |
-
model_id = "IQuestLab/UniReason-Med"
|
| 73 |
-
processor = AutoProcessor.from_pretrained(model_id)
|
| 74 |
-
model = AutoModelForImageTextToText.from_pretrained(model_id, device_map="auto")
|
| 75 |
-
|
| 76 |
-
image = Image.open("medical_image.png")
|
| 77 |
-
messages = [
|
| 78 |
-
{
|
| 79 |
-
"role": "user",
|
| 80 |
-
"content": [
|
| 81 |
-
{"type": "image"},
|
| 82 |
-
{"type": "text", "text": "What is the most likely diagnosis? Reason step by step."},
|
| 83 |
-
],
|
| 84 |
-
}
|
| 85 |
-
]
|
| 86 |
-
prompt = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 87 |
-
inputs = processor(text=[prompt], images=[image], return_tensors="pt").to(model.device)
|
| 88 |
-
output = model.generate(**inputs, max_new_tokens=1024)
|
| 89 |
-
print(processor.batch_decode(output, skip_special_tokens=True)[0])
|
| 90 |
-
```
|
| 91 |
-
|
| 92 |
-
The model produces interleaved reasoning with bounding boxes over the input image. Reproducing
|
| 93 |
-
the full grounded crop-and-continue loop (crop the predicted region and feed it back as visual
|
| 94 |
-
input) follows the agent/rollout logic in the released training code.
|
| 95 |
-
|
| 96 |
## Intended Use and Limitations
|
| 97 |
|
| 98 |
- **Intended use:** research on medical multimodal reasoning, visual grounding, and 2D-to-3D
|
|
|
|
| 32 |
|
| 33 |
- **Base model:** [Qwen/Qwen2.5-VL-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct)
|
| 34 |
- **Training data:** [IQuestLab/UniReason-Med-Data](https://huggingface.co/datasets/IQuestLab/UniReason-Med-Data)
|
| 35 |
+
- **Code:** [github.com/IQuestLab/unireason-med](https://github.com/IQuestLab/unireason-med)
|
| 36 |
- **Modalities:** image + text → text
|
| 37 |
- **License:** Apache-2.0
|
| 38 |
|
|
|
|
| 64 |
Training code (LLaMA-Factory for SFT, verl for GRPO) and configs are released at:
|
| 65 |
<https://github.com/IQuestLab/unireason-med>.
|
| 66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
## Intended Use and Limitations
|
| 68 |
|
| 69 |
- **Intended use:** research on medical multimodal reasoning, visual grounding, and 2D-to-3D
|