[Fix] improve aspect ratio in dummy image generation and add common VLM tests for PaddleOCR-VL (#28711)

Signed-off-by: dongbo910220 <1275604947@qq.com>
This commit is contained in:
dongbo910220
2025-11-15 00:07:20 +08:00
committed by GitHub
parent 3f8a874065
commit c934caee88
2 changed files with 19 additions and 2 deletions

View File

@@ -232,8 +232,7 @@ class PaddleOCRVLProcessingInfo(BaseProcessingInfo):
# Find factors of max_num_tokens close to its square root
# to create a dummy image with a reasonable aspect ratio.
h_patches = int(math.sqrt(max_num_tokens))
while max_num_tokens % h_patches != 0:
h_patches -= 1
max_num_tokens -= max_num_tokens % h_patches
w_patches = max_num_tokens // h_patches
return ImageSize(height=h_patches * factor, width=w_patches * factor)