Skip to content

Commit

Permalink
Try removing the clause entirely
Browse files Browse the repository at this point in the history
  • Loading branch information
Rocketknight1 committed Aug 26, 2024
1 parent e9e154b commit 0bb67d8
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/transformers/models/auto/auto_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import copy
import importlib
import json
import os
import warnings
from collections import OrderedDict

Expand Down Expand Up @@ -427,11 +426,7 @@ def from_config(cls, config, **kwargs):
else:
repo_id = config.name_or_path
model_class = get_class_from_dynamic_module(class_ref, repo_id, **kwargs)
if os.path.isdir(config._name_or_path):
model_class.register_for_auto_class(cls.__name__)
cls.register(config.__class__, model_class, exist_ok=True)
else:
cls.register(config.__class__, model_class, exist_ok=True)
cls.register(config.__class__, model_class, exist_ok=True)
_ = kwargs.pop("code_revision", None)
return model_class._from_config(config, **kwargs)
elif type(config) in cls._model_mapping.keys():
Expand Down Expand Up @@ -553,11 +548,7 @@ def from_pretrained(cls, pretrained_model_name_or_path, *model_args, **kwargs):
class_ref, pretrained_model_name_or_path, code_revision=code_revision, **hub_kwargs, **kwargs
)
_ = hub_kwargs.pop("code_revision", None)
if os.path.isdir(pretrained_model_name_or_path):
model_class.register_for_auto_class(cls.__name__)
cls.register(config.__class__, model_class, exist_ok=True)
else:
cls.register(config.__class__, model_class, exist_ok=True)
cls.register(config.__class__, model_class, exist_ok=True)
return model_class.from_pretrained(
pretrained_model_name_or_path, *model_args, config=config, **hub_kwargs, **kwargs
)
Expand Down

0 comments on commit 0bb67d8

Please sign in to comment.