Commit 9c91a54
fix: use list input format for Outlines multimodal generation (#205)
TransformersMultiModal.format_input is a singledispatch that only
accepts `list` and `Chat` types. A `dict` raises TypeError.
Correct format: [prompt_text, outlines.Image(pil_image)]
Wrong format: {"text": prompt, "images": [image]}
Also fixes PIL .format being dropped by .convert("RGB") — outlines.Image
requires .format to be set. Restored after conversion.
New test: test_outlines_multimodal_input_format verifies:
- list is a registered dispatch type (dict is NOT)
- outlines.Image wraps PIL images correctly
- This test would have caught both the dict and format bugs
36/36 tests pass in 0.10s.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 1a0bebc commit 9c91a54
2 files changed
Lines changed: 55 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
203 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
204 | 208 | | |
205 | 209 | | |
206 | 210 | | |
| |||
215 | 219 | | |
216 | 220 | | |
217 | 221 | | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
222 | 229 | | |
223 | 230 | | |
224 | 231 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
206 | 249 | | |
207 | 250 | | |
208 | 251 | | |
| |||
0 commit comments