From da64ede36d05a7432c10b75db0296e1c83beb1dc Mon Sep 17 00:00:00 2001 From: Lysandre Debut Date: Wed, 6 Sep 2023 07:21:00 -0400 Subject: [PATCH] Falcon: fix revision propagation (#26006) * Fix revision propagation * Cleaner --- src/transformers/models/auto/configuration_auto.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/transformers/models/auto/configuration_auto.py b/src/transformers/models/auto/configuration_auto.py index cf93951c15e0a6..4fd125f88ba3a9 100755 --- a/src/transformers/models/auto/configuration_auto.py +++ b/src/transformers/models/auto/configuration_auto.py @@ -1016,13 +1016,11 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): kwargs["name_or_path"] = pretrained_model_name_or_path trust_remote_code = kwargs.pop("trust_remote_code", None) code_revision = kwargs.pop("code_revision", None) - revision = kwargs.pop("revision", None) - revision = sanitize_code_revision(pretrained_model_name_or_path, revision, trust_remote_code) + revision = kwargs.pop("revision", None) + kwargs["revision"] = sanitize_code_revision(pretrained_model_name_or_path, revision, trust_remote_code) - config_dict, unused_kwargs = PretrainedConfig.get_config_dict( - pretrained_model_name_or_path, revision=revision, **kwargs - ) + config_dict, unused_kwargs = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs) has_remote_code = "auto_map" in config_dict and "AutoConfig" in config_dict["auto_map"] has_local_code = "model_type" in config_dict and config_dict["model_type"] in CONFIG_MAPPING trust_remote_code = resolve_trust_remote_code(