Image-Text-to-Text
Transformers
Safetensors
English
qwen2_5_vl
fundus
ophthalmology
retinal-imaging
medical-vlm
multimodal-large-language-model
reasoning
rag
rlvr
qwen2.5-vl
conversational
text-generation-inference
Instructions to use Kimokcheon/Fundus-R1-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Kimokcheon/Fundus-R1-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Kimokcheon/Fundus-R1-7B") 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("Kimokcheon/Fundus-R1-7B") model = AutoModelForMultimodalLM.from_pretrained("Kimokcheon/Fundus-R1-7B", 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 Kimokcheon/Fundus-R1-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Kimokcheon/Fundus-R1-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kimokcheon/Fundus-R1-7B", "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/Kimokcheon/Fundus-R1-7B
- SGLang
How to use Kimokcheon/Fundus-R1-7B 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 "Kimokcheon/Fundus-R1-7B" \ --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": "Kimokcheon/Fundus-R1-7B", "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 "Kimokcheon/Fundus-R1-7B" \ --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": "Kimokcheon/Fundus-R1-7B", "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 Kimokcheon/Fundus-R1-7B with Docker Model Runner:
docker model run hf.co/Kimokcheon/Fundus-R1-7B
Update README.md
Browse files
README.md
CHANGED
|
@@ -159,9 +159,7 @@ Keep this terminal running. Once the server is ready, check it from another term
|
|
| 159 |
curl http://127.0.0.1:8000/v1/models
|
| 160 |
```
|
| 161 |
|
| 162 |
-
This configuration allows one image per request, limits concurrency to one sequence, and disables CUDA graphs to reduce startup memory pressure.
|
| 163 |
-
|
| 164 |
-
The server is bound to the local machine. Do not expose an unauthenticated endpoint containing medical images to a public network.
|
| 165 |
|
| 166 |
### Query a local image
|
| 167 |
|
|
@@ -275,8 +273,6 @@ ollama create fundus-r1-7b -f ./Modelfile
|
|
| 275 |
ollama show fundus-r1-7b
|
| 276 |
```
|
| 277 |
|
| 278 |
-
Check that `ollama show` lists the `vision` capability before querying images. If your version rejects the two-file import or shows only text capabilities, update Ollama and check the import logs; use the vLLM route above rather than dropping the projector.
|
| 279 |
-
|
| 280 |
### Query a local image
|
| 281 |
|
| 282 |
```bash
|
|
@@ -314,8 +310,6 @@ ollama run fundus-r1-7b ./fundus_image.jpg "Describe the retinal findings in thi
|
|
| 314 |
|
| 315 |
See the [Ollama Modelfile reference](https://docs.ollama.com/modelfile), [Ollama vision guide](https://docs.ollama.com/capabilities/vision), and [llama.cpp multimodal conversion guide](https://github.com/ggml-org/llama.cpp/blob/master/tools/mtmd/README.md).
|
| 316 |
|
| 317 |
-
**Validation status:** These deployment recipes are based on the checkpoint architecture and upstream documentation/code. They have not been end-to-end tested with this checkpoint. Validate image-conditioned outputs in your environment before relying on either integration; do not assume converted or quantized outputs reproduce the paper's reported results. The medical-use disclaimer above applies to both backends.
|
| 318 |
-
|
| 319 |
## Download Through HF Mirror
|
| 320 |
|
| 321 |
For users in regions where the official Hugging Face endpoint is slow, the checkpoints can be downloaded through the Hugging Face mirror endpoint. Install the CLI with `python -m pip install --upgrade huggingface_hub` if it is not already available:
|
|
|
|
| 159 |
curl http://127.0.0.1:8000/v1/models
|
| 160 |
```
|
| 161 |
|
| 162 |
+
This configuration allows one image per request, limits concurrency to one sequence, and disables CUDA graphs to reduce startup memory pressure.
|
|
|
|
|
|
|
| 163 |
|
| 164 |
### Query a local image
|
| 165 |
|
|
|
|
| 273 |
ollama show fundus-r1-7b
|
| 274 |
```
|
| 275 |
|
|
|
|
|
|
|
| 276 |
### Query a local image
|
| 277 |
|
| 278 |
```bash
|
|
|
|
| 310 |
|
| 311 |
See the [Ollama Modelfile reference](https://docs.ollama.com/modelfile), [Ollama vision guide](https://docs.ollama.com/capabilities/vision), and [llama.cpp multimodal conversion guide](https://github.com/ggml-org/llama.cpp/blob/master/tools/mtmd/README.md).
|
| 312 |
|
|
|
|
|
|
|
| 313 |
## Download Through HF Mirror
|
| 314 |
|
| 315 |
For users in regions where the official Hugging Face endpoint is slow, the checkpoints can be downloaded through the Hugging Face mirror endpoint. Install the CLI with `python -m pip install --upgrade huggingface_hub` if it is not already available:
|