Unverified Commit f29fe745 authored by Matt's avatar Matt Committed by GitHub
Browse files

Rewrite for custom code warning messages (#26291)

Quick britpicking for some warning messages!
parent 2d71307d
......@@ -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`.\nDo 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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment