|
42 | 42 | from vllm.model_executor.layers.attention.cross_attention import CrossAttention |
43 | 43 | from vllm.model_executor.layers.attention.mm_encoder_attention import MMEncoderAttention |
44 | 44 | from vllm.multimodal.processing.dummy_inputs import BaseDummyInputsBuilder |
| 45 | + IS_LEGACY=False |
45 | 46 | except ImportError: |
46 | 47 | # These were moved after vLLM 0.13; try the legacy path |
47 | 48 | from vllm.attention.backends.abstract import AttentionType |
48 | 49 | from vllm.attention.layer import Attention |
49 | 50 | from vllm.attention.layers.cross_attention import CrossAttention |
50 | 51 | from vllm.attention.layers.mm_encoder_attention import MMEncoderAttention |
51 | 52 | from vllm.multimodal.profiling import BaseDummyInputsBuilder |
| 53 | + IS_LEGACY=True |
52 | 54 |
|
53 | 55 | from vllm.model_executor.layers.linear import ( |
54 | 56 | ColumnParallelLinear, |
@@ -1014,6 +1016,15 @@ def _get_subparsers(self) -> Mapping[str, ModalityDataParser]: |
1014 | 1016 | class BartMultiModalProcessor(EncDecMultiModalProcessor[BartProcessingInfo]): |
1015 | 1017 | """Multimodal processor for BART encoder-decoder models.""" |
1016 | 1018 |
|
| 1019 | + def __init__(self, *args, **kwargs): |
| 1020 | + # HACK: v13 needs to define _get_data_parser, but v16 throws in __init__ |
| 1021 | + # if this class has _get_data_parser as an attribute, so for now, |
| 1022 | + # we conditionally ist based on which import path was taken, since |
| 1023 | + # those are also changes that were needed for v13. |
| 1024 | + if IS_LEGACY: |
| 1025 | + self._get_data_parser = self.build_data_parser |
| 1026 | + super().__init__(*args, **kwargs) |
| 1027 | + |
1017 | 1028 | def create_encoder_prompt( |
1018 | 1029 | self, |
1019 | 1030 | prompt: str | list[int], |
@@ -1124,9 +1135,6 @@ def _get_prompt_updates( |
1124 | 1135 | def build_data_parser(self) -> MultiModalDataParser: |
1125 | 1136 | return TextDataParser() |
1126 | 1137 |
|
1127 | | - # Needed for compatibility with v13 |
1128 | | - def _get_data_parser(self) -> MultiModalDataParser: |
1129 | | - return self.build_data_parser() |
1130 | 1138 |
|
1131 | 1139 | @MULTIMODAL_REGISTRY.register_processor( |
1132 | 1140 | BartMultiModalProcessor, |
|
0 commit comments