Skip to content

Commit

Permalink
Falcon: fix revision propagation (huggingface#26006)
Browse files Browse the repository at this point in the history
* Fix revision propagation

* Cleaner
  • Loading branch information
LysandreJik authored and EduardoPach committed Nov 18, 2023
1 parent 3e5b419 commit 6bccf4f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/transformers/models/auto/configuration_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -1019,13 +1019,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(
Expand Down

0 comments on commit 6bccf4f

Please sign in to comment.