Skip to content

Commit ee5b245

Browse files
authored
the use_auth_token has not been set up early enough in the model_kwargs. Fixes huggingface#12941 (huggingface#13205)
1 parent 0305673 commit ee5b245

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/transformers/pipelines/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,9 @@ def pipeline(
410410
model = get_default_model(targeted_task, framework, task_options)
411411
logger.warning(f"No model was supplied, defaulted to {model} (https://huggingface.co/{model})")
412412

413+
# Retrieve use_auth_token and add it to model_kwargs to be used in .from_pretrained
414+
model_kwargs["use_auth_token"] = model_kwargs.get("use_auth_token", use_auth_token)
415+
413416
# Config is the primordial information item.
414417
# Instantiate config if needed
415418
if isinstance(config, str):
@@ -419,9 +422,6 @@ def pipeline(
419422

420423
model_name = model if isinstance(model, str) else None
421424

422-
# Retrieve use_auth_token and add it to model_kwargs to be used in .from_pretrained
423-
model_kwargs["use_auth_token"] = model_kwargs.get("use_auth_token", use_auth_token)
424-
425425
# Infer the framework from the model
426426
# Forced if framework already defined, inferred if it's None
427427
# Will load the correct model if possible

0 commit comments

Comments
 (0)