Instructions to use ReFocus/Trained_Model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ReFocus/Trained_Model with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="ReFocus/Trained_Model")# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ReFocus/Trained_Model", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ReFocus/Trained_Model with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ReFocus/Trained_Model" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ReFocus/Trained_Model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ReFocus/Trained_Model
- SGLang
How to use ReFocus/Trained_Model 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 "ReFocus/Trained_Model" \ --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": "ReFocus/Trained_Model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "ReFocus/Trained_Model" \ --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": "ReFocus/Trained_Model", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ReFocus/Trained_Model with Docker Model Runner:
docker model run hf.co/ReFocus/Trained_Model
Add relevant metadata, link to code and paper
Browse filesThis PR adds the `library_name` and `pipeline_tag` for this model card, so that it can be found using the filters on the hub.
It also links the model to the corresponding Github repository and paper page.
README.md
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# <img src="assets/icon.png" width="35" /> ReFocus
|
| 2 |
|
| 3 |
This repo contains the model for the paper "ReFocus: Visual Editing as a Chain of Thought for Structured Image Understanding"
|
| 4 |
|
| 5 |
-
[**π Homepage**](https://zeyofu.github.io/ReFocus/) |[**π Paper**](https://
|
| 6 |
|
| 7 |
|
| 8 |
# Introduction
|
|
@@ -22,8 +27,4 @@ This model is finetuned based on Phi-3.5-vision, and we used the following promp
|
|
| 22 |
To enforce the model to generate bounding box coordinates to refocus, you could try this prompt:
|
| 23 |
```
|
| 24 |
<|image_1|>\n{question}\nThought: The areas to focus on in the image have bounding box coordinates:
|
| 25 |
-
```
|
| 26 |
-
|
| 27 |
-
---
|
| 28 |
-
license: apache-2.0
|
| 29 |
-
---
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
pipeline_tag: image-text-to-text
|
| 5 |
+
---
|
| 6 |
# <img src="assets/icon.png" width="35" /> ReFocus
|
| 7 |
|
| 8 |
This repo contains the model for the paper "ReFocus: Visual Editing as a Chain of Thought for Structured Image Understanding"
|
| 9 |
|
| 10 |
+
[**π Homepage**](https://zeyofu.github.io/ReFocus/) |[**π Paper**](https://huggingface.co/papers/2501.05452) | [**π Code**](https://github.com/zeyofu/ReFocus_Code)
|
| 11 |
|
| 12 |
|
| 13 |
# Introduction
|
|
|
|
| 27 |
To enforce the model to generate bounding box coordinates to refocus, you could try this prompt:
|
| 28 |
```
|
| 29 |
<|image_1|>\n{question}\nThought: The areas to focus on in the image have bounding box coordinates:
|
| 30 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|