Small nit, (#22653)

* Small nit,
Fixes #21986

* Update src/transformers/pipelines/__init__.py
This commit is contained in:
Arthur 2023-04-07 17:29:23 +02:00 committed by GitHub
parent fc1ba6fd11
commit 117a0f6afa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -788,7 +788,6 @@ def pipeline(
model_config = model.config
hub_kwargs["_commit_hash"] = model.config._commit_hash
load_tokenizer = type(model_config) in TOKENIZER_MAPPING or model_config.tokenizer_class is not None
load_feature_extractor = type(model_config) in FEATURE_EXTRACTOR_MAPPING or feature_extractor is not None
load_image_processor = type(model_config) in IMAGE_PROCESSOR_MAPPING or image_processor is not None
@ -871,7 +870,8 @@ def pipeline(
tokenizer_kwargs = tokenizer[1]
else:
tokenizer_identifier = tokenizer
tokenizer_kwargs = model_kwargs
tokenizer_kwargs = model_kwargs.copy()
tokenizer_kwargs.pop("torch_dtype", None)
tokenizer = AutoTokenizer.from_pretrained(
tokenizer_identifier, use_fast=use_fast, _from_pipeline=task, **hub_kwargs, **tokenizer_kwargs