A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 8, 10:00 UTC
Fix DeepSeek-OCR tensor validation for all size variants (#34085)
Co-authored-by: Cursor <cursoragent@cursor.com>
Yichuan Wang committed
Feb 11, 2026 at 22:50 UTC
80f2ba6ea6cbda0da56da65cee8402e7b5bf2aa0
1 file changed
+11
-1
vllm/model_executor/models/deepseek_ocr.py
+11
-1
@@ -448,7 +448,16 @@ class DeepseekOCRForCausalLM(nn.Module, SupportsMultiModal, SupportsPP, Supports
448
if pixel_values is None or torch.sum(pixel_values).item() == 0:
449
return None
450
451
- base_size = self.vision_config.image_size
451
+ # Use actual tensor spatial dim instead of hardcoded
452
+ # vision_config.image_size (1024). The vision encoders (SAM & CLIP)
453
+ # support arbitrary resolutions via pos-encoding interpolation,
454
+ # so Tiny/Small/Base/Large variants all work with the same weights.
455
+ base_size = pixel_values.shape[-1]
456
+ if images_crop is not None and images_crop.numel() > 0:
457
+ image_size = images_crop.shape[-1]
458
+ else:
459
+ image_size = base_size
460
+
461
return DeepseekOCRImagePixelInputs(
462
type="pixel_values",
463
data=pixel_values,
@@ -456,6 +465,7 @@ class DeepseekOCRForCausalLM(nn.Module, SupportsMultiModal, SupportsPP, Supports
465
images_spatial_crop=images_spatial_crop,
466
resolve_bindings={
467
"base_size": base_size,
468
+ "image_size": image_size,
469
},
470
)
471