Update README.md
Browse files
README.md
CHANGED
@@ -92,9 +92,7 @@ import json
|
|
92 |
import os
|
93 |
from typing import Any, Literal
|
94 |
|
95 |
-
from PIL import Image
|
96 |
from transformers import AutoModelForImageTextToText, AutoProcessor
|
97 |
-
from transformers.models.qwen2_vl.image_processing_qwen2_vl import smart_resize
|
98 |
|
99 |
# default: Load the model on the available device(s)
|
100 |
# We recommend enabling flash_attention_2 for better acceleration and memory saving.
|
@@ -131,7 +129,12 @@ def run_inference(messages: list[dict[str, Any]]) -> str:
|
|
131 |
|
132 |
### Prepare image and instruction
|
133 |
|
|
|
|
|
134 |
```python
|
|
|
|
|
|
|
135 |
# Prepare image and instruction
|
136 |
image_url = "https://huggingface.co/Hcompany/Holo1-7B/resolve/main/calendar_example.jpg"
|
137 |
image = Image.open(requests.get(image_url, stream=True).raw)
|
|
|
92 |
import os
|
93 |
from typing import Any, Literal
|
94 |
|
|
|
95 |
from transformers import AutoModelForImageTextToText, AutoProcessor
|
|
|
96 |
|
97 |
# default: Load the model on the available device(s)
|
98 |
# We recommend enabling flash_attention_2 for better acceleration and memory saving.
|
|
|
129 |
|
130 |
### Prepare image and instruction
|
131 |
|
132 |
+
WARNING: Holo1 is using absolute coordinates (number of pixels) and HuggingFace processor is doing image resize. To have matching coordinates, one needs to smart_resize the image.
|
133 |
+
|
134 |
```python
|
135 |
+
from PIL import Image
|
136 |
+
from transformers.models.qwen2_vl.image_processing_qwen2_vl import smart_resize
|
137 |
+
|
138 |
# Prepare image and instruction
|
139 |
image_url = "https://huggingface.co/Hcompany/Holo1-7B/resolve/main/calendar_example.jpg"
|
140 |
image = Image.open(requests.get(image_url, stream=True).raw)
|