Rewrite for custom code warning messages (#26291)
Quick britpicking for some warning messages!
This commit is contained in:
@@ -594,9 +594,10 @@ def resolve_trust_remote_code(trust_remote_code, model_name, has_local_code, has
|
|||||||
signal.alarm(TIME_OUT_REMOTE_CODE)
|
signal.alarm(TIME_OUT_REMOTE_CODE)
|
||||||
while trust_remote_code is None:
|
while trust_remote_code is None:
|
||||||
answer = input(
|
answer = input(
|
||||||
f"Loading {model_name} requires to execute some code in that repo, you can inspect the content of "
|
f"The repository for {model_name} contains custom code which must be executed to correctly "
|
||||||
f"the repository at https://hf.co/{model_name}. You can dismiss this prompt by passing "
|
f"load the model. You can inspect the repository content at https://hf.co/{model_name}. "
|
||||||
"`trust_remote_code=True`.\nDo you accept? [y/N] "
|
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"]:
|
if answer.lower() in ["yes", "y", "1"]:
|
||||||
trust_remote_code = True
|
trust_remote_code = True
|
||||||
@@ -606,9 +607,9 @@ def resolve_trust_remote_code(trust_remote_code, model_name, has_local_code, has
|
|||||||
except Exception:
|
except Exception:
|
||||||
# OS which does not support signal.SIGALRM
|
# OS which does not support signal.SIGALRM
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Loading this model requires you to execute execute some code in that repo on your local machine. "
|
f"The repository for {model_name} contains custom code which must be executed to correctly "
|
||||||
f"Make sure you have read the code at https://hf.co/{model_name} to avoid malicious use, then set "
|
f"load the model. You can inspect the repository content at https://hf.co/{model_name}. "
|
||||||
"the option `trust_remote_code=True` to remove this error."
|
f"Please pass the argument `trust_remote_code=True` to allow custom code to be run."
|
||||||
)
|
)
|
||||||
elif has_remote_code:
|
elif has_remote_code:
|
||||||
# For the CI which puts the timeout at 0
|
# For the CI which puts the timeout at 0
|
||||||
|
|||||||
Reference in New Issue
Block a user