Unverified Commit 4446b6b0 authored by Clémentine Fourrier's avatar Clémentine Fourrier Committed by GitHub
Browse files

Graphormer fix (#21699)

* Removed useless check for backend

* fix style check for graphormer

* Reverted change and corrected requires_backend for cython

* code qual
parent 63306263
......@@ -24,9 +24,7 @@ def convert_to_single_emb(x, offset: int = 512):
def preprocess_item(item, keep_features=True):
requires_backends(preprocess_item, ["Cython"])
if not is_cython_available():
raise ImportError("Graphormer preprocessing needs Cython (pyximport)")
requires_backends(preprocess_item, ["cython"])
if keep_features and "edge_attr" in item.keys(): # edge_attr
edge_attr = np.asarray(item["edge_attr"], dtype=np.int64)
......
......@@ -992,6 +992,11 @@ DECORD_IMPORT_ERROR = """
decord`. Please note that you may need to restart your runtime after installation.
"""
CYTHON_IMPORT_ERROR = """
{0} requires the Cython library but it was not found in your environment. You can install it with pip: `pip install
Cython`. Please note that you may need to restart your runtime after installation.
"""
BACKENDS_MAPPING = OrderedDict(
[
("bs4", (is_bs4_available, BS4_IMPORT_ERROR)),
......@@ -1023,6 +1028,7 @@ BACKENDS_MAPPING = OrderedDict(
("accelerate", (is_accelerate_available, ACCELERATE_IMPORT_ERROR)),
("oneccl_bind_pt", (is_ccl_available, CCL_IMPORT_ERROR)),
("decord", (is_decord_available, DECORD_IMPORT_ERROR)),
("cython", (is_cython_available, CYTHON_IMPORT_ERROR)),
]
)
......
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