A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 15, 11:00 UTC
[Bugfix] Add revision to `transformers.Auto*.from_pretrained` processors (#17948)
Signed-off-by: Xin Li <xin@centml.ai>
xinli-centml committed
May 11, 2025 at 03:52 UTC
90d0a74b605bf0e757db175fb89f2ec200a92be1
1 file changed
+10
-1
vllm/transformers_utils/processor.py
+10
-1
@@ -1,7 +1,7 @@
1
# SPDX-License-Identifier: Apache-2.0
2
3
from functools import lru_cache
4
-from typing import TYPE_CHECKING, Any, Union, cast
4
+from typing import TYPE_CHECKING, Any, Optional, Union, cast
5
6
from transformers.processing_utils import ProcessorMixin
7
from typing_extensions import TypeVar
@@ -54,6 +54,7 @@ def _merge_mm_kwargs(model_config: "ModelConfig", **kwargs):
54
def get_processor(
55
processor_name: str,
56
*args: Any,
57
+ revision: Optional[str] = None,
58
trust_remote_code: bool = False,
59
processor_cls: Union[type[_P], tuple[type[_P], ...]] = ProcessorMixin,
60
**kwargs: Any,
@@ -70,6 +71,7 @@ def get_processor(
71
processor = processor_factory.from_pretrained(
72
processor_name,
73
*args,
74
+ revision=revision,
75
trust_remote_code=trust_remote_code,
76
**kwargs,
77
)
@@ -106,6 +108,7 @@ def cached_processor_from_config(
108
) -> _P:
109
return cached_get_processor(
110
model_config.model,
111
+ revision=model_config.revision,
112
trust_remote_code=model_config.trust_remote_code,
113
processor_cls=processor_cls, # type: ignore[arg-type]
114
**_merge_mm_kwargs(model_config, **kwargs),
@@ -115,6 +118,7 @@ def cached_processor_from_config(
118
def get_feature_extractor(
119
processor_name: str,
120
*args: Any,
121
+ revision: Optional[str] = None,
122
trust_remote_code: bool = False,
123
**kwargs: Any,
124
):
@@ -128,6 +132,7 @@ def get_feature_extractor(
132
feature_extractor = AutoFeatureExtractor.from_pretrained(
133
processor_name,
134
*args,
135
+ revision=revision,
136
trust_remote_code=trust_remote_code,
137
**kwargs)
138
except ValueError as e:
@@ -156,6 +161,7 @@ def cached_feature_extractor_from_config(
161
):
162
return cached_get_feature_extractor(
163
model_config.model,
164
+ revision=model_config.revision,
165
trust_remote_code=model_config.trust_remote_code,
166
**_merge_mm_kwargs(model_config, **kwargs),
167
)
@@ -164,6 +170,7 @@ def cached_feature_extractor_from_config(
170
def get_image_processor(
171
processor_name: str,
172
*args: Any,
173
+ revision: Optional[str] = None,
174
trust_remote_code: bool = False,
175
**kwargs: Any,
176
):
@@ -177,6 +184,7 @@ def get_image_processor(
184
processor = AutoImageProcessor.from_pretrained(
185
processor_name,
186
*args,
187
+ revision=revision,
188
trust_remote_code=trust_remote_code,
189
**kwargs)
190
except ValueError as e:
@@ -206,6 +214,7 @@ def cached_image_processor_from_config(
214
):
215
return cached_get_image_processor(
216
model_config.model,
217
+ revision=model_config.revision,
218
trust_remote_code=model_config.trust_remote_code,
219
**_merge_mm_kwargs(model_config, **kwargs),
220
)