[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:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user