[Bugfix] Fix broken phi3-v mm_processor_kwargs tests (#11263)
Signed-off-by: Isotr0py <2037008807@qq.com>
This commit is contained in:
@@ -302,11 +302,18 @@ class Phi3HDImageEmbedding(Phi3ImageEmbeddingBase):
|
||||
return image_features_hd_newline
|
||||
|
||||
|
||||
def get_max_phi3v_image_tokens(ctx: InputContext) -> int:
|
||||
processor = ctx.get_hf_processor()
|
||||
image_processor = processor.image_processor # type: ignore
|
||||
def get_max_phi3v_image_tokens(
|
||||
ctx: InputContext,
|
||||
*,
|
||||
num_crops: Optional[int] = None,
|
||||
) -> int:
|
||||
mm_processor_kwargs = {}
|
||||
if num_crops:
|
||||
mm_processor_kwargs["num_crops"] = num_crops
|
||||
|
||||
return image_processor.calc_num_image_tokens_from_image_size(
|
||||
processor = ctx.get_hf_processor(**mm_processor_kwargs)
|
||||
|
||||
return processor.calc_num_image_tokens_from_image_size(
|
||||
width=MAX_IMAGE_FEATURE_SIZE_WIDTH,
|
||||
height=MAX_IMAGE_FEATURE_SIZE_HEIGHT,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user