(images)
| 227 | |
| 228 | |
| 229 | def compute_poster_image_ppl(images): |
| 230 | max_ctx = 128_000 # max visual tokens for Qwen2.5-VL |
| 231 | truncated_images = truncate_images_to_fit(images, max_ctx=max_ctx) |
| 232 | img_uris = [pil_to_data_uri(image, fmt="PNG") for image in truncated_images] |
| 233 | content = [ |
| 234 | {"type": "image_url", "image_url": {"url": img_uri}} for img_uri in img_uris |
| 235 | ] |
| 236 | |
| 237 | return compute_vlm_ppl(content) |
| 238 | |
| 239 | |
| 240 | def compute_clip_embeddings(folder, model, processor, device): |
no test coverage detected