|
30 | 30 | from transformers import BartConfig |
31 | 31 | from transformers.utils import logging |
32 | 32 |
|
33 | | -from vllm.model_executor.layers.attention import Attention |
34 | | -from vllm.v1.attention.backend import AttentionType |
35 | 33 | from vllm.config import CacheConfig, VllmConfig |
36 | 34 | from vllm.config.lora import LoRAConfig |
37 | 35 | from vllm.config.multimodal import BaseDummyOptions |
38 | 36 | from vllm.distributed import get_tensor_model_parallel_world_size |
39 | 37 | from vllm.model_executor.layers.activation import get_act_fn |
40 | 38 |
|
| 39 | +IS_LEGACY=False |
41 | 40 | try: |
| 41 | + from vllm.v1.attention.backend import AttentionType |
| 42 | + from vllm.model_executor.layers.attention import Attention |
42 | 43 | from vllm.model_executor.layers.attention.cross_attention import CrossAttention |
43 | 44 | from vllm.model_executor.layers.attention.mm_encoder_attention import MMEncoderAttention |
| 45 | + from vllm.multimodal.processing.dummy_inputs import BaseDummyInputsBuilder |
44 | 46 | except ImportError: |
45 | 47 | # These were moved after vLLM 0.13; try the legacy path |
| 48 | + from vllm.attention.backends.abstract import AttentionType |
| 49 | + from vllm.attention.layer import Attention |
46 | 50 | from vllm.attention.layers.cross_attention import CrossAttention |
47 | 51 | from vllm.attention.layers.mm_encoder_attention import MMEncoderAttention |
| 52 | + from vllm.multimodal.profiling import BaseDummyInputsBuilder |
| 53 | + IS_LEGACY=True |
48 | 54 |
|
49 | 55 | from vllm.model_executor.layers.linear import ( |
50 | 56 | ColumnParallelLinear, |
|
87 | 93 | EncDecMultiModalProcessor, |
88 | 94 | PromptUpdate, |
89 | 95 | ) |
90 | | -from vllm.multimodal.processing.dummy_inputs import BaseDummyInputsBuilder |
91 | 96 | from vllm.sequence import IntermediateTensors |
92 | 97 | from vllm.utils.collection_utils import is_list_of |
93 | 98 |
|
@@ -1011,6 +1016,15 @@ def _get_subparsers(self) -> Mapping[str, ModalityDataParser]: |
1011 | 1016 | class BartMultiModalProcessor(EncDecMultiModalProcessor[BartProcessingInfo]): |
1012 | 1017 | """Multimodal processor for BART encoder-decoder models.""" |
1013 | 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 | + |
1014 | 1028 | def create_encoder_prompt( |
1015 | 1029 | self, |
1016 | 1030 | prompt: str | list[int], |
|
0 commit comments