From c6fc02c914d6c6a9f386498e9447911f017688a9 Mon Sep 17 00:00:00 2001 From: Kunhao ZHENG Date: Tue, 9 May 2023 22:58:39 +0200 Subject: [PATCH] Fix `from_config` (#23246) fix --- src/transformers/models/auto/auto_factory.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/transformers/models/auto/auto_factory.py b/src/transformers/models/auto/auto_factory.py index f8bc266fe8325f..17cc7f95799fae 100644 --- a/src/transformers/models/auto/auto_factory.py +++ b/src/transformers/models/auto/auto_factory.py @@ -407,8 +407,7 @@ def from_config(cls, config, **kwargs): repo_id, class_ref = class_ref.split("--") else: repo_id = config.name_or_path - module_file, class_name = class_ref.split(".") - model_class = get_class_from_dynamic_module(repo_id, module_file + ".py", class_name, **kwargs) + model_class = get_class_from_dynamic_module(class_ref, repo_id, **kwargs) return model_class._from_config(config, **kwargs) elif type(config) in cls._model_mapping.keys(): model_class = _get_model_class(config, cls._model_mapping)