[Chore] Remove outdated transformers check (#20989)
Signed-off-by: Brayden Zhong <b8zhong@uwaterloo.ca>
This commit is contained in:
@@ -22,8 +22,8 @@ from typing import Literal, Optional, TypedDict, Union
|
|||||||
|
|
||||||
import torch
|
import torch
|
||||||
from torch import nn
|
from torch import nn
|
||||||
from transformers import (AddedToken, BatchFeature, Idefics3Config,
|
from transformers import (BatchFeature, Idefics3Config, Idefics3ImageProcessor,
|
||||||
Idefics3ImageProcessor, Idefics3Processor)
|
Idefics3Processor)
|
||||||
|
|
||||||
from vllm.config import VllmConfig
|
from vllm.config import VllmConfig
|
||||||
from vllm.model_executor.layers.linear import ReplicatedLinear
|
from vllm.model_executor.layers.linear import ReplicatedLinear
|
||||||
@@ -199,21 +199,14 @@ class Idefics3ProcessingInfo(BaseProcessingInfo):
|
|||||||
|
|
||||||
return grid_w * grid_h + 1
|
return grid_w * grid_h + 1
|
||||||
|
|
||||||
# TODO: Remove after requiring transformers>=4.52
|
|
||||||
def _get_content(self, token: Union[AddedToken, str]) -> str:
|
|
||||||
if isinstance(token, str):
|
|
||||||
return token
|
|
||||||
|
|
||||||
return token.content
|
|
||||||
|
|
||||||
def _get_image_token(
|
def _get_image_token(
|
||||||
self,
|
self,
|
||||||
processor: Optional[Idefics3Processor]) -> tuple[str, str, str]:
|
processor: Optional[Idefics3Processor]) -> tuple[str, str, str]:
|
||||||
if processor is None:
|
if processor is None:
|
||||||
processor = self.get_hf_processor()
|
processor = self.get_hf_processor()
|
||||||
|
|
||||||
image_token = self._get_content(processor.image_token)
|
image_token = processor.image_token
|
||||||
fake_image_token = self._get_content(processor.fake_image_token)
|
fake_image_token = processor.fake_image_token
|
||||||
global_image_token = processor.global_image_tag
|
global_image_token = processor.global_image_tag
|
||||||
return image_token, fake_image_token, global_image_token
|
return image_token, fake_image_token, global_image_token
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user