Unverified Commit 87208a05 authored by Clémentine Fourrier's avatar Clémentine Fourrier Committed by GitHub
Browse files

Graphormer model for Graph Classification (#20968)



* [FT] First commit for graphormer architecture.

The model has no tokenizer, as it uses a collator and preprocessing function for its input management.
Architecture to be tested against original one.
The arch might need to be changed to fit the checkpoint, but a revert to the original arch will make the code less nice to read.
TODO: doc

* [FIX] removed test model

* [FIX] import error

* [FIX] black and flake

* [DOC] added paper refs

* [FIX] [DOC]

* [FIX] black

* [DOC] Updated READMEs

* [FIX] Order of imports + rm Tokenizer calls

* [FIX] Moved assert in class to prevent doc build failure

* [FIX] make fix-copies

* [Doc] update from code review
Co-authored-by: default avatarSylvain Gugger <35901082+sgugger@users.noreply.github.com>

* [FIX] Removed Graphormer from Sequence classification model list

* [DOC] Added HF copyright to Cython file

* [DOC] Fixed comments

* [FIX] typos in class doc + removed config classes.

Tod...
parent 758bd39e
...@@ -103,6 +103,7 @@ from .import_utils import ( ...@@ -103,6 +103,7 @@ from .import_utils import (
is_bitsandbytes_available, is_bitsandbytes_available,
is_bs4_available, is_bs4_available,
is_coloredlogs_available, is_coloredlogs_available,
is_cython_available,
is_datasets_available, is_datasets_available,
is_decord_available, is_decord_available,
is_detectron2_available, is_detectron2_available,
......
...@@ -2865,6 +2865,30 @@ class GPTJPreTrainedModel(metaclass=DummyObject): ...@@ -2865,6 +2865,30 @@ class GPTJPreTrainedModel(metaclass=DummyObject):
requires_backends(self, ["torch"]) requires_backends(self, ["torch"])
GRAPHORMER_PRETRAINED_MODEL_ARCHIVE_LIST = None
class GraphormerForGraphClassification(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"])
class GraphormerModel(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"])
class GraphormerPreTrainedModel(metaclass=DummyObject):
_backends = ["torch"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch"])
GROUPVIT_PRETRAINED_MODEL_ARCHIVE_LIST = None GROUPVIT_PRETRAINED_MODEL_ARCHIVE_LIST = None
......
...@@ -736,6 +736,10 @@ def is_jumanpp_available(): ...@@ -736,6 +736,10 @@ def is_jumanpp_available():
return (importlib.util.find_spec("rhoknp") is not None) and (shutil.which("jumanpp") is not None) return (importlib.util.find_spec("rhoknp") is not None) and (shutil.which("jumanpp") is not None)
def is_cython_available():
return importlib.util.find_spec("pyximport") is not None
# docstyle-ignore # docstyle-ignore
DATASETS_IMPORT_ERROR = """ DATASETS_IMPORT_ERROR = """
{0} requires the 🤗 Datasets library but it was not found in your environment. You can install it with: {0} requires the 🤗 Datasets library but it was not found in your environment. You can install it with:
......
This diff is collapsed.
...@@ -51,6 +51,8 @@ PRIVATE_MODELS = [ ...@@ -51,6 +51,8 @@ PRIVATE_MODELS = [
# Being in this list is an exception and should **not** be the rule. # Being in this list is an exception and should **not** be the rule.
IGNORE_NON_TESTED = PRIVATE_MODELS.copy() + [ IGNORE_NON_TESTED = PRIVATE_MODELS.copy() + [
# models to ignore for not tested # models to ignore for not tested
"GraphormerEncoder", # Building part of bigger (tested) model.
"GraphormerDecoderHead", # Building part of bigger (tested) model.
"CLIPSegDecoder", # Building part of bigger (tested) model. "CLIPSegDecoder", # Building part of bigger (tested) model.
"TableTransformerEncoder", # Building part of bigger (tested) model. "TableTransformerEncoder", # Building part of bigger (tested) model.
"TableTransformerDecoder", # Building part of bigger (tested) model. "TableTransformerDecoder", # Building part of bigger (tested) model.
...@@ -152,6 +154,8 @@ TEST_FILES_WITH_NO_COMMON_TESTS = [ ...@@ -152,6 +154,8 @@ TEST_FILES_WITH_NO_COMMON_TESTS = [
IGNORE_NON_AUTO_CONFIGURED = PRIVATE_MODELS.copy() + [ IGNORE_NON_AUTO_CONFIGURED = PRIVATE_MODELS.copy() + [
# models to ignore for model xxx mapping # models to ignore for model xxx mapping
"GitVisionModel", "GitVisionModel",
"GraphormerModel",
"GraphormerForGraphClassification",
"BlipForConditionalGeneration", "BlipForConditionalGeneration",
"BlipForImageTextRetrieval", "BlipForImageTextRetrieval",
"BlipForQuestionAnswering", "BlipForQuestionAnswering",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment