|
1 | 1 | # SPDX-License-Identifier: Apache-2.0
|
2 | 2 |
|
3 | 3 | from collections.abc import Iterable, Mapping, Sequence
|
4 |
| -from functools import cached_property |
5 | 4 | from typing import Literal, Optional, Set, Tuple, TypedDict, Union
|
6 | 5 |
|
7 | 6 | import torch
|
|
12 | 11 | from vllm.config import CacheConfig, VllmConfig
|
13 | 12 | from vllm.model_executor.layers.activation import get_act_fn
|
14 | 13 | from vllm.model_executor.layers.quantization import QuantizationConfig
|
15 |
| -from vllm.model_executor.layers.sampler import SamplerOutput, get_sampler |
16 | 14 | from vllm.model_executor.sampling_metadata import SamplingMetadata
|
17 | 15 | from vllm.multimodal import MULTIMODAL_REGISTRY
|
18 | 16 | from vllm.multimodal.inputs import (MultiModalDataDict, MultiModalFieldConfig,
|
@@ -530,13 +528,6 @@ def __init__(self, *, vllm_config: VllmConfig, prefix: str = ""):
|
530 | 528 | self.make_empty_intermediate_tensors = (
|
531 | 529 | self.language_model.make_empty_intermediate_tensors)
|
532 | 530 |
|
533 |
| - @cached_property |
534 |
| - def sampler(self): |
535 |
| - if hasattr(self.language_model, "sampler"): |
536 |
| - return self.language_model.sampler |
537 |
| - |
538 |
| - return get_sampler() |
539 |
| - |
540 | 531 | def _validate_pixel_values(self, data: torch.Tensor) -> torch.Tensor:
|
541 | 532 | h = w = self.config.vision_config.image_size
|
542 | 533 | expected_dims = (3, h, w)
|
@@ -649,7 +640,7 @@ def forward(
|
649 | 640 | intermediate_tensors: Optional[IntermediateTensors] = None,
|
650 | 641 | inputs_embeds: Optional[torch.Tensor] = None,
|
651 | 642 | **kwargs: object,
|
652 |
| - ) -> Union[SamplerOutput, IntermediateTensors]: |
| 643 | + ) -> IntermediateTensors: |
653 | 644 | """Run forward pass for BLIP-2.
|
654 | 645 |
|
655 | 646 | One key thing to understand is the `input_ids` already accounts for the
|
@@ -707,13 +698,6 @@ def compute_logits(
|
707 | 698 | return self.language_model.compute_logits(hidden_states,
|
708 | 699 | sampling_metadata)
|
709 | 700 |
|
710 |
| - def sample( |
711 |
| - self, |
712 |
| - logits: torch.Tensor, |
713 |
| - sampling_metadata: SamplingMetadata, |
714 |
| - ) -> Optional[SamplerOutput]: |
715 |
| - return self.language_model.sample(logits, sampling_metadata) |
716 |
| - |
717 | 701 | def load_weights(self, weights: Iterable[Tuple[str,
|
718 | 702 | torch.Tensor]]) -> Set[str]:
|
719 | 703 | loader = AutoWeightsLoader(self)
|
|
0 commit comments