Image-Text-to-Text
Transformers
Safetensors
English
qwen3_vl
medical
ophthalmology
retinal-oct
visual-grounding
vision-language
conversational
Instructions to use ronnief1/RetGrounder with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ronnief1/RetGrounder with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="ronnief1/RetGrounder") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("ronnief1/RetGrounder") model = AutoModelForMultimodalLM.from_pretrained("ronnief1/RetGrounder", 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ronnief1/RetGrounder with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ronnief1/RetGrounder" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ronnief1/RetGrounder", "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/ronnief1/RetGrounder
- SGLang
How to use ronnief1/RetGrounder 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 "ronnief1/RetGrounder" \ --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": "ronnief1/RetGrounder", "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 "ronnief1/RetGrounder" \ --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": "ronnief1/RetGrounder", "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 ronnief1/RetGrounder with Docker Model Runner:
docker model run hf.co/ronnief1/RetGrounder
|
Download README.md from ronnief1/RetGrounder: direct link, hf CLI and curl.
- Browser
- Download file 3.37 kB
-
https://huggingface.co/ronnief1/RetGrounder/resolve/main/README.md
- Command line
-
hf download hf://ronnief1/RetGrounder/README.md
-
curl -L -o README.md https://huggingface.co/ronnief1/RetGrounder/resolve/main/README.md
3.37 kB
| license: apache-2.0 | |
| base_model: Qwen/Qwen3-VL-8B-Instruct | |
| library_name: transformers | |
| pipeline_tag: image-text-to-text | |
| language: | |
| - en | |
| tags: | |
| - medical | |
| - ophthalmology | |
| - retinal-oct | |
| - visual-grounding | |
| - vision-language | |
| # RetGrounder | |
| **RetGrounder** is an 8B multimodal large language model fine-tuned for **visual grounding of biomarkers in retinal optical coherence tomography (OCT)**, introduced with the **RetinaGroundBench** benchmark. It is a LoRA fine-tune of [`Qwen/Qwen3-VL-8B-Instruct`](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct), trained with an OCT-specific strategy that integrates grounding and textual supervision, then merged into the base weights. | |
| - **Base model:** `Qwen/Qwen3-VL-8B-Instruct` | |
| - **Tasks:** biomarker visual grounding (bounding boxes) and presence VQA on retinal OCT B-scans | |
| - **Benchmark & evaluation code:** https://github.com/ronnief1/RetinaGroundBench | |
| ## Results | |
| On the RetinaGroundBench visual-grounding benchmark (13 biomarker classes, AggIoU with t₁=0.1, t₂=0.3), RetGrounder reaches a **macro F1 of 33.9%** (AggIoU 18.5%, precision 48.0%, recall 27.5%) — a **43% relative improvement** in F1 over the best general-purpose model evaluated (InternVL3.5-30B-A3B, F1 23.7%), despite its smaller size. | |
| ## Usage | |
| ```python | |
| from transformers import Qwen3VLForConditionalGeneration, AutoProcessor | |
| from PIL import Image | |
| model = Qwen3VLForConditionalGeneration.from_pretrained( | |
| "ronnief1/RetGrounder", dtype="auto", device_map="auto") | |
| processor = AutoProcessor.from_pretrained("ronnief1/RetGrounder") | |
| image = Image.open("oct_bscan.jpg").convert("RGB") | |
| prompt = ('Locate every instance that belongs to the following categories: ' | |
| '"intraretinal fluid, drusen". Report bbox coordinates in JSON format.') | |
| messages = [{"role": "user", "content": [ | |
| {"type": "image", "image": image}, | |
| {"type": "text", "text": prompt}]}] | |
| inputs = processor.apply_chat_template( | |
| messages, tokenize=True, add_generation_prompt=True, | |
| return_dict=True, return_tensors="pt").to(model.device) | |
| out = model.generate(**inputs, max_new_tokens=1024) | |
| print(processor.batch_decode( | |
| [o[len(i):] for i, o in zip(inputs.input_ids, out)], | |
| skip_special_tokens=True)[0]) | |
| ``` | |
| Predicted boxes are in a **0–1000 normalized coordinate frame** (scale back to pixels with the image width/height). | |
| ## License | |
| The RetGrounder weights are released under **Apache-2.0**, inherited from the base model [`Qwen/Qwen3-VL-8B-Instruct`](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct) (also Apache-2.0). The **RetinaGroundBench annotations** are released separately under **CC BY 4.0**, and the underlying B-scans derive from the public **OCTDL** and **OLIVES** datasets — please also observe the terms of those original datasets. | |
| ## Citation | |
| If you use RetGrounder or RetinaGroundBench, please cite the paper: | |
| ```bibtex | |
| @misc{fecso2026visualgroundingbenchmarkretinal, | |
| title={A Visual Grounding Benchmark for Retinal OCT with Multimodal Large Language Models}, | |
| author={Ronald Fecso and José Morano and Botond Fazekas and Paul Widmann-Sedlnitzky and Dorota Himel and Laetita Hinterhuber and Virginia Mares and Andreas Pollreisz and Hrvoje Bogunović}, | |
| year={2026}, | |
| eprint={2610.31205}, | |
| archivePrefix={arXiv}, | |
| primaryClass={cs.CV}, | |
| url={https://arxiv.org/abs/2610.31205}, | |
| } | |
| ``` | |