diff --git a/src/transformers/dynamic_module_utils.py b/src/transformers/dynamic_module_utils.py index 627adf4fc86d19..cd875b7b4132fa 100644 --- a/src/transformers/dynamic_module_utils.py +++ b/src/transformers/dynamic_module_utils.py @@ -575,9 +575,8 @@ def _set_auto_map_in_config(_config): def _raise_timeout_error(signum, frame): raise ValueError( - "Loading this model requires you to execute the configuration file in that repo on your local machine. We " - "asked if it was okay but did not get an answer. Make sure you have read the code there to avoid malicious " - "use, then set the option `trust_remote_code=True` to remove this error." + "Loading this model requires you to execute custom code contained in the model repository on your local" + "machine. Please set the option `trust_remote_code=True` to permit loading of this model." ) @@ -594,9 +593,9 @@ 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"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"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}.\n" + f"You can avoid this prompt in future by passing the argument `trust_remote_code=True`.\n\n" f"Do you wish to run the custom code? [y/N] " ) if answer.lower() in ["yes", "y", "1"]: @@ -607,8 +606,8 @@ 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( - 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"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}.\n" f"Please pass the argument `trust_remote_code=True` to allow custom code to be run." ) elif has_remote_code: