Update README.md
Browse files
README.md
CHANGED
@@ -127,6 +127,56 @@ print(generated_text)
|
|
127 |
|
128 |
*Benchmarks: AI2D test, ChartQA test, VQA v2.0 test, DocQA test, InfographicVQA test, TextVQA val, RealWorldQA, MMMU val, MathVista testmini, CountBenchQA, Flickr Count (we collected this new dataset that is significantly harder than CountBenchQA).*
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
## License and Use
|
131 |
|
132 |
This model is licensed under Apache 2.0. It is intended for research and educational use.
|
|
|
127 |
|
128 |
*Benchmarks: AI2D test, ChartQA test, VQA v2.0 test, DocQA test, InfographicVQA test, TextVQA val, RealWorldQA, MMMU val, MathVista testmini, CountBenchQA, Flickr Count (we collected this new dataset that is significantly harder than CountBenchQA).*
|
129 |
|
130 |
+
|
131 |
+
### I'm getting an error a broadcast error when processing images!
|
132 |
+
|
133 |
+
Your image might not be in RGB format. You can convert it using the following code snippet:
|
134 |
+
|
135 |
+
```python
|
136 |
+
from PIL import Image
|
137 |
+
|
138 |
+
image = Image.open(...)
|
139 |
+
|
140 |
+
if image.mode != "RGB":
|
141 |
+
image = image.convert("RGB")
|
142 |
+
```
|
143 |
+
|
144 |
+
### Molmo doesn't work great with transparent images!
|
145 |
+
|
146 |
+
We received reports that Molmo models might struggle with transparent images.
|
147 |
+
For the time being, we recommend adding a white or dark background to your images before passing them to the model. The code snippet below shows how to do this using the Python Imaging Library (PIL):
|
148 |
+
|
149 |
+
```python
|
150 |
+
|
151 |
+
# Load the image
|
152 |
+
url = "..."
|
153 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
154 |
+
|
155 |
+
# Convert the image to grayscale to calculate brightness
|
156 |
+
gray_image = image.convert('L') # Convert to grayscale
|
157 |
+
|
158 |
+
# Calculate the average brightness
|
159 |
+
stat = ImageStat.Stat(gray_image)
|
160 |
+
average_brightness = stat.mean[0] # Get the average value
|
161 |
+
|
162 |
+
# Define background color based on brightness (threshold can be adjusted)
|
163 |
+
bg_color = (0, 0, 0) if average_brightness > 127 else (255, 255, 255)
|
164 |
+
|
165 |
+
# Create a new image with the same size as the original, filled with the background color
|
166 |
+
new_image = Image.new('RGB', image.size, bg_color)
|
167 |
+
|
168 |
+
# Paste the original image on top of the background (use image as a mask if needed)
|
169 |
+
new_image.paste(image, (0, 0), image if image.mode == 'RGBA' else None)
|
170 |
+
|
171 |
+
# Now you can pass the new_image to Molmo
|
172 |
+
processor = AutoProcessor.from_pretrained(
|
173 |
+
'allenai/Molmo-7B-D-0924',
|
174 |
+
trust_remote_code=True,
|
175 |
+
torch_dtype='auto',
|
176 |
+
device_map='auto'
|
177 |
+
)
|
178 |
+
```
|
179 |
+
|
180 |
## License and Use
|
181 |
|
182 |
This model is licensed under Apache 2.0. It is intended for research and educational use.
|