Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
ee5b2457
Unverified
Commit
ee5b2457
authored
Aug 30, 2021
by
Ben Nimmo
Committed by
GitHub
Aug 30, 2021
Browse files
the use_auth_token has not been set up early enough in the model_kwargs. Fixes #12941 (#13205)
parent
03056730
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
src/transformers/pipelines/__init__.py
src/transformers/pipelines/__init__.py
+3
-3
No files found.
src/transformers/pipelines/__init__.py
View file @
ee5b2457
...
@@ -410,6 +410,9 @@ def pipeline(
...
@@ -410,6 +410,9 @@ def pipeline(
model
=
get_default_model
(
targeted_task
,
framework
,
task_options
)
model
=
get_default_model
(
targeted_task
,
framework
,
task_options
)
logger
.
warning
(
f
"No model was supplied, defaulted to
{
model
}
(https://huggingface.co/
{
model
}
)"
)
logger
.
warning
(
f
"No model was supplied, defaulted to
{
model
}
(https://huggingface.co/
{
model
}
)"
)
# Retrieve use_auth_token and add it to model_kwargs to be used in .from_pretrained
model_kwargs
[
"use_auth_token"
]
=
model_kwargs
.
get
(
"use_auth_token"
,
use_auth_token
)
# Config is the primordial information item.
# Config is the primordial information item.
# Instantiate config if needed
# Instantiate config if needed
if
isinstance
(
config
,
str
):
if
isinstance
(
config
,
str
):
...
@@ -419,9 +422,6 @@ def pipeline(
...
@@ -419,9 +422,6 @@ def pipeline(
model_name
=
model
if
isinstance
(
model
,
str
)
else
None
model_name
=
model
if
isinstance
(
model
,
str
)
else
None
# Retrieve use_auth_token and add it to model_kwargs to be used in .from_pretrained
model_kwargs
[
"use_auth_token"
]
=
model_kwargs
.
get
(
"use_auth_token"
,
use_auth_token
)
# Infer the framework from the model
# Infer the framework from the model
# Forced if framework already defined, inferred if it's None
# Forced if framework already defined, inferred if it's None
# Will load the correct model if possible
# Will load the correct model if possible
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment