Add from_pretrained to dummy timm objects (#12097)

* Add from_pretrained to dummy timm

* Fix at the source

* Update utils/check_dummies.py

Co-authored-by: Lysandre Debut <lysandre@huggingface.co>

* Missing pretrained dummies

* Style

Co-authored-by: Sylvain Gugger <sylvain.gugger@gmail.com>
Co-authored-by: Sylvain Gugger <35901082+sgugger@users.noreply.github.com>
This commit is contained in:
Lysandre Debut
2021-06-11 18:27:10 +02:00
committed by GitHub
parent 15b498f3b8
commit 3b1f5caff2
8 changed files with 1158 additions and 1071 deletions

View File

@@ -39,8 +39,8 @@ class {0}:
requires_backends(self, {1})
@classmethod
def from_pretrained(self, *args, **kwargs):
requires_backends(self, {1})
def from_pretrained(cls, *args, **kwargs):
requires_backends(cls, {1})
"""
DUMMY_CLASS = """
@@ -103,11 +103,14 @@ def read_init():
def create_dummy_object(name, backend_name):
"""Create the code for the dummy object corresponding to `name`."""
_pretrained = [
"Config" "ForCausalLM",
"Config",
"ForCausalLM",
"ForConditionalGeneration",
"ForMaskedLM",
"ForMultipleChoice",
"ForObjectDetection",
"ForQuestionAnswering",
"ForSegmentation",
"ForSequenceClassification",
"ForTokenClassification",
"Model",