From a104f12cdfce59ff68d2133744d2a89e8a18a734 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 20 Dec 2024 15:29:40 +0000 Subject: [PATCH 1/3] Update missing model error message --- src/transformers/models/auto/configuration_auto.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/transformers/models/auto/configuration_auto.py b/src/transformers/models/auto/configuration_auto.py index 69ce8efa10c76c..ec0d876e97e17e 100644 --- a/src/transformers/models/auto/configuration_auto.py +++ b/src/transformers/models/auto/configuration_auto.py @@ -1059,7 +1059,10 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): raise ValueError( f"The checkpoint you are trying to load has model type `{config_dict['model_type']}` " "but Transformers does not recognize this architecture. This could be because of an " - "issue with the checkpoint, or because your version of Transformers is out of date." + "issue with the checkpoint, or because your version of Transformers is out of date. " + "If this checkpoint was released very recently then you may need to install " + "the latest version of Transformers from source with the command " + "`pip install git+https://github.com/huggingface/transformers.git`" ) return config_class.from_dict(config_dict, **unused_kwargs) else: From c11dc73650627a0a61671aeaea2f219477a09d0b Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 20 Dec 2024 15:34:42 +0000 Subject: [PATCH 2/3] Update missing model error message --- src/transformers/models/auto/configuration_auto.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/transformers/models/auto/configuration_auto.py b/src/transformers/models/auto/configuration_auto.py index ec0d876e97e17e..8e99adcb70dadd 100644 --- a/src/transformers/models/auto/configuration_auto.py +++ b/src/transformers/models/auto/configuration_auto.py @@ -1060,8 +1060,10 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): f"The checkpoint you are trying to load has model type `{config_dict['model_type']}` " "but Transformers does not recognize this architecture. This could be because of an " "issue with the checkpoint, or because your version of Transformers is out of date. " - "If this checkpoint was released very recently then you may need to install " - "the latest version of Transformers from source with the command " + "You can update transformers with the command `pip install --upgrade transformers`. If this " + "does not work, and the checkpoint is very new, then there may not be a release version " + "that supports this model yet. In this case, you can get the most up-to-date code by installing " + "Transformers from source with the command " "`pip install git+https://github.com/huggingface/transformers.git`" ) return config_class.from_dict(config_dict, **unused_kwargs) From 19c03b03e171567e442b738e7cab22275e858840 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 20 Dec 2024 15:37:03 +0000 Subject: [PATCH 3/3] Update missing model error message --- src/transformers/models/auto/configuration_auto.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/transformers/models/auto/configuration_auto.py b/src/transformers/models/auto/configuration_auto.py index 8e99adcb70dadd..3e8da40c3aa7e4 100644 --- a/src/transformers/models/auto/configuration_auto.py +++ b/src/transformers/models/auto/configuration_auto.py @@ -1057,9 +1057,9 @@ def from_pretrained(cls, pretrained_model_name_or_path, **kwargs): config_class = CONFIG_MAPPING[config_dict["model_type"]] except KeyError: raise ValueError( - f"The checkpoint you are trying to load has model type `{config_dict['model_type']}` " + f"\nThe checkpoint you are trying to load has model type `{config_dict['model_type']}` " "but Transformers does not recognize this architecture. This could be because of an " - "issue with the checkpoint, or because your version of Transformers is out of date. " + "issue with the checkpoint, or because your version of Transformers is out of date.\n\n" "You can update transformers with the command `pip install --upgrade transformers`. If this " "does not work, and the checkpoint is very new, then there may not be a release version " "that supports this model yet. In this case, you can get the most up-to-date code by installing "