Skip to content

Commit

Permalink
accept trust_remote_code and ignore it
Browse files Browse the repository at this point in the history
  • Loading branch information
ydshieh committed Aug 2, 2022
1 parent 8ae7784 commit 62a3392
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/transformers/modeling_utils.py
Expand Up @@ -1790,6 +1790,7 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P
local_files_only = kwargs.pop("local_files_only", False)
use_auth_token = kwargs.pop("use_auth_token", None)
revision = kwargs.pop("revision", None)
trust_remote_code = kwargs.pop("trust_remote_code", None)
mirror = kwargs.pop("mirror", None)
from_pipeline = kwargs.pop("_from_pipeline", None)
from_auto_class = kwargs.pop("_from_auto", False)
Expand All @@ -1802,6 +1803,11 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P
offload_state_dict = kwargs.pop("offload_state_dict", None)
subfolder = kwargs.pop("subfolder", "")

if trust_remote_code is not None:
logger.warning(
"The argument `trust_remote_code` is to be used with Auto classes. It has no effect here and is ignored."
)

if device_map is not None:
if low_cpu_mem_usage is None:
low_cpu_mem_usage = True
Expand Down

0 comments on commit 62a3392

Please sign in to comment.