Browse Source

fix bugs when importing from only one backend

tags/v0.3.1
Frozenmad 4 years ago
parent
commit
d117c8e4a7
4 changed files with 14 additions and 36 deletions
  1. +2
    -2
      autogl/module/model/dgl/__init__.py
  2. +6
    -1
      autogl/module/train/__init__.py
  3. +6
    -6
      docs/requirements.txt
  4. +0
    -27
      setup.py

+ 2
- 2
autogl/module/model/dgl/__init__.py View File

@@ -3,7 +3,7 @@ from .base import BaseModel
from .topkpool import AutoTopkpool


from .graph_saint import GraphSAINTAggregationModel
# from .graph_saint import GraphSAINTAggregationModel
from .gcn import GCN, AutoGCN
from .graphsage import GraphSAGE, AutoSAGE
from .gat import GAT,AutoGAT
@@ -14,7 +14,7 @@ __all__ = [
"register_model",
"BaseModel",
"AutoTopkpool",
"GraphSAINTAggregationModel",
# "GraphSAINTAggregationModel",
"GCN",
"AutoGCN",
"GraphSAGE",


+ 6
- 1
autogl/module/train/__init__.py View File

@@ -1,3 +1,5 @@
from ...backend import DependentBackend

TRAINER_DICT = {}
from .base import (
BaseTrainer,
@@ -24,7 +26,10 @@ def register_trainer(name):

from .graph_classification_full import GraphClassificationFullTrainer
from .node_classification_full import NodeClassificationFullTrainer
from .link_prediction import LinkPredictionTrainer
if DependentBackend.is_pyg():
from .link_prediction import LinkPredictionTrainer
elif DependentBackend.is_dgl():
LinkPredictionTrainer = None
from .node_classification_trainer import *
from .evaluation import get_feval, Acc, Auc, Logloss, Mrr, MicroF1



+ 6
- 6
docs/requirements.txt View File

@@ -13,11 +13,11 @@ requests
scikit-learn
scipy
tabulate
https://download.pytorch.org/whl/lts/1.8/cpu/torch-1.8.1%2Bcpu-cp36-cp36m-linux_x86_64.whl
https://pytorch-geometric.com/whl/torch-1.8.0+cpu/torch_cluster-1.5.9-cp36-cp36m-linux_x86_64.whl
https://pytorch-geometric.com/whl/torch-1.8.0+cpu/torch_scatter-2.0.6-cp36-cp36m-linux_x86_64.whl
https://pytorch-geometric.com/whl/torch-1.8.0+cpu/torch_sparse-0.6.10-cp36-cp36m-linux_x86_64.whl
https://pytorch-geometric.com/whl/torch-1.8.0+cpu/torch_spline_conv-1.2.1-cp36-cp36m-linux_x86_64.whl
torch-geometric
# https://download.pytorch.org/whl/lts/1.8/cpu/torch-1.8.1%2Bcpu-cp36-cp36m-linux_x86_64.whl
# https://pytorch-geometric.com/whl/torch-1.8.0+cpu/torch_cluster-1.5.9-cp36-cp36m-linux_x86_64.whl
# https://pytorch-geometric.com/whl/torch-1.8.0+cpu/torch_scatter-2.0.6-cp36-cp36m-linux_x86_64.whl
# https://pytorch-geometric.com/whl/torch-1.8.0+cpu/torch_sparse-0.6.10-cp36-cp36m-linux_x86_64.whl
# https://pytorch-geometric.com/whl/torch-1.8.0+cpu/torch_spline_conv-1.2.1-cp36-cp36m-linux_x86_64.whl
# torch-geometric
tqdm
nni

+ 0
- 27
setup.py View File

@@ -6,30 +6,6 @@ except ModuleNotFoundError:
"Please appropriately install PyTorch, "
"see https://pytorch.org/ for installation."
)
try:
import torch_scatter
import torch_sparse
import torch_geometric
PYG_VER = torch_geometric.__version__.split('.')
PYG_VER = [int(PYG_VER[0]), int(PYG_VER[1])]
assert PYG_VER >= [1, 7], "PyTorch-Geometric version should be at least 1.7.0"
except ModuleNotFoundError:
raise ModuleNotFoundError(
"PyTorch-Geometric not fully installed. "
"Please appropriately install PyTorch-Geometric, "
"see https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html for installation."
)

if torch.__version__.startswith('1.8.'):
try:
import torch_cluster
import torch_spline_conv
except ModuleNotFoundError:
raise ModuleNotFoundError(
"PyTorch-Geometric not fully installed. "
"For PyTorch version 1.8.x, you should also install torch_cluster and torch_spline_conv "
"see https://pytorch-geometric.readthedocs.io/en/latest/notes/installation.html for installation."
)

from setuptools import setup, find_packages

@@ -77,9 +53,6 @@ setup(
'scipy',
'tabulate',
'torch',
'torch-geometric',
'torch-scatter',
'torch-sparse',
'tqdm',
'nni'
]

Loading…
Cancel
Save