[Refactor] Separate sequence and token pooling types (#32026)
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
This commit is contained in:
@@ -145,7 +145,7 @@ class CLIPProcessingInfo(BaseProcessingInfo):
|
||||
image_width=image_width,
|
||||
image_height=image_height,
|
||||
),
|
||||
_get_vision_feature_select_strategy(pooler_config.pooling_type),
|
||||
_get_vision_feature_select_strategy(pooler_config.seq_pooling_type),
|
||||
)
|
||||
|
||||
def get_image_size_with_most_features(self) -> ImageSize:
|
||||
@@ -819,7 +819,7 @@ class CLIPVisionModel(nn.Module):
|
||||
|
||||
|
||||
# Assume EOS token corresponds to LAST token in text model
|
||||
@default_pooling_type("LAST")
|
||||
@default_pooling_type(seq_pooling_type="LAST")
|
||||
@MULTIMODAL_REGISTRY.register_processor(
|
||||
CLIPMultiModalProcessor,
|
||||
info=CLIPProcessingInfo,
|
||||
@@ -908,7 +908,7 @@ class CLIPEmbeddingModel(nn.Module, SupportsMultiModal, SupportsQuant):
|
||||
) -> torch.Tensor:
|
||||
if feature_select_strategy is None:
|
||||
feature_select_strategy = _get_vision_feature_select_strategy(
|
||||
self.pooler_config.pooling_type
|
||||
self.pooler_config.seq_pooling_type
|
||||
)
|
||||
|
||||
pooled_output = self.vision_model(
|
||||
|
||||
Reference in New Issue
Block a user