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
f29fe745
Unverified
Commit
f29fe745
authored
Sep 20, 2023
by
Matt
Committed by
GitHub
Sep 20, 2023
Browse files
Rewrite for custom code warning messages (#26291)
Quick britpicking for some warning messages!
parent
2d71307d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
src/transformers/dynamic_module_utils.py
src/transformers/dynamic_module_utils.py
+7
-6
No files found.
src/transformers/dynamic_module_utils.py
View file @
f29fe745
...
...
@@ -594,9 +594,10 @@ def resolve_trust_remote_code(trust_remote_code, model_name, has_local_code, has
signal
.
alarm
(
TIME_OUT_REMOTE_CODE
)
while
trust_remote_code
is
None
:
answer
=
input
(
f
"Loading
{
model_name
}
requires to execute some code in that repo, you can inspect the content of "
f
"the repository at https://hf.co/
{
model_name
}
. You can dismiss this prompt by passing "
"`trust_remote_code=True`.
\n
Do you accept? [y/N] "
f
"The repository for
{
model_name
}
contains custom code which must be executed to correctly "
f
"load the model. You can inspect the repository content at https://hf.co/
{
model_name
}
. "
f
"You can avoid this prompt in future by passing the argument `trust_remote_code=True`.
\n
"
f
"Do you wish to run the custom code? [y/N] "
)
if
answer
.
lower
()
in
[
"yes"
,
"y"
,
"1"
]:
trust_remote_code
=
True
...
...
@@ -606,9 +607,9 @@ def resolve_trust_remote_code(trust_remote_code, model_name, has_local_code, has
except
Exception
:
# OS which does not support signal.SIGALRM
raise
ValueError
(
"Loading this model requires you to execute execute some code in that repo on your local machine.
"
f
"
Make sure you have read the code at https://hf.co/
{
model_name
}
to avoid malicious use, then set
"
"the option
`trust_remote_code=True` to
remove this error
."
f
"The repository for
{
model_name
}
contains custom code which must be executed to correctly
"
f
"
load the model. You can inspect the repository content at https://hf.co/
{
model_name
}
.
"
f
"Please pass the argument
`trust_remote_code=True` to
allow custom code to be run
."
)
elif
has_remote_code
:
# For the CI which puts the timeout at 0
...
...
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