[Bugfix] Standardize getting number of image patches/tokens (#34358)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
@@ -217,28 +217,13 @@ class PixtralProcessingInfo(BaseProcessingInfo):
|
||||
def get_supported_mm_limits(self) -> Mapping[str, int | None]:
|
||||
return {"image": None}
|
||||
|
||||
def get_vision_config(
|
||||
self,
|
||||
processor: PixtralProcessorAdapter | None = None,
|
||||
):
|
||||
if processor is None:
|
||||
processor = self.get_hf_processor()
|
||||
|
||||
return PixtralVisionConfig(
|
||||
image_size=processor.image_size,
|
||||
patch_size=processor.patch_size,
|
||||
)
|
||||
|
||||
def get_num_image_tokens(
|
||||
self,
|
||||
*,
|
||||
image_width: int,
|
||||
image_height: int,
|
||||
processor: PixtralProcessorAdapter | None = None,
|
||||
processor: PixtralProcessorAdapter,
|
||||
) -> int:
|
||||
if processor is None:
|
||||
processor = self.get_hf_processor()
|
||||
|
||||
ncols, nrows = processor.image_processor._image_to_num_tokens(
|
||||
Image.new("RGB", (image_width, image_height))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user