diff --git a/autogl/module/nas/algorithm/enas.py b/autogl/module/nas/algorithm/enas.py index 122ee2d..23bb1fe 100644 --- a/autogl/module/nas/algorithm/enas.py +++ b/autogl/module/nas/algorithm/enas.py @@ -82,7 +82,6 @@ class Enas(BaseNAS): device="auto", ): super().__init__(device) - self.device = device self.num_epochs = num_epochs self.log_frequency = log_frequency self.entropy_weight = entropy_weight diff --git a/autogl/module/nas/algorithm/gasso.py b/autogl/module/nas/algorithm/gasso.py index c3f5ba8..c445386 100644 --- a/autogl/module/nas/algorithm/gasso.py +++ b/autogl/module/nas/algorithm/gasso.py @@ -61,7 +61,6 @@ class Gasso(BaseNAS): device="auto", ): super().__init__(device=device) - self.device = device self.num_epochs = num_epochs self.warmup_epochs = warmup_epochs self.model_lr = model_lr diff --git a/autogl/module/nas/algorithm/rl.py b/autogl/module/nas/algorithm/rl.py index 95530a0..06ad6d8 100644 --- a/autogl/module/nas/algorithm/rl.py +++ b/autogl/module/nas/algorithm/rl.py @@ -265,7 +265,6 @@ class RL(BaseNAS): disable_progress=False, ): super().__init__(device) - self.device = device self.num_epochs = num_epochs self.log_frequency = log_frequency self.entropy_weight = entropy_weight @@ -447,7 +446,6 @@ class GraphNasRL(BaseNAS): hardware_metric_limit=None, ): super().__init__(device) - self.device = device self.num_epochs = num_epochs self.log_frequency = log_frequency self.entropy_weight = entropy_weight diff --git a/autogl/module/nas/algorithm/spos.py b/autogl/module/nas/algorithm/spos.py index 0e03fa6..5bcaf71 100644 --- a/autogl/module/nas/algorithm/spos.py +++ b/autogl/module/nas/algorithm/spos.py @@ -228,7 +228,6 @@ class Spos(BaseNAS): device="cuda", ): super().__init__(device) - self.device = device self.model_lr=5e-3 self.model_wd=5e-4 self.n_warmup = n_warmup diff --git a/autogl/module/nas/space/autoattend.py b/autogl/module/nas/space/autoattend.py index 51d12eb..c0e6477 100644 --- a/autogl/module/nas/space/autoattend.py +++ b/autogl/module/nas/space/autoattend.py @@ -57,6 +57,9 @@ class AutoAttendNodeClassificationSpace(BaseSpace): ): super().__init__() + + from autogl.backend import DependentBackend;assert not DependentBackend.is_dgl(),"Now AutoAttend only support pyg" + self.layer_number = layer_number self.hidden_dim = hidden_dim self.input_dim = input_dim diff --git a/test/nas/node_classification.py b/test/nas/node_classification.py index 4b5e3c2..e28bbac 100644 --- a/test/nas/node_classification.py +++ b/test/nas/node_classification.py @@ -20,7 +20,7 @@ if DependentBackend.is_dgl(): elif DependentBackend.is_pyg(): from torch_geometric.datasets import Planetoid from autogl.module.model.pyg import BaseAutoModel - +from autogl.datasets import build_dataset_from_name import torch import torch.nn.functional as F from autogl.module.nas.space.single_path import SinglePathNodeClassificationSpace @@ -71,12 +71,13 @@ def test_model(model, data=None, check_children=False): if __name__ == "__main__": print("Testing backend: {}".format("dgl" if DependentBackend.is_dgl() else "pyg")) - if DependentBackend.is_dgl(): - dataset = CoraGraphDataset() + from autogl.datasets.utils.conversion._to_dgl_dataset import to_dgl_dataset as convert_dataset else: - dataset = Planetoid(os.path.expanduser("~/.cache-autogl"), "Cora") + from autogl.datasets.utils.conversion._to_pyg_dataset import to_pyg_dataset as convert_dataset + dataset = build_dataset_from_name('cora') + dataset = convert_dataset(dataset) data = dataset[0] di = bk_feat(data).shape[1] @@ -125,14 +126,6 @@ if __name__ == "__main__": model = algo.search(space, dataset, esti) test_model(model, data, True) - print("darts + graphnas ") - space = AutoAttendNodeClassificationSpace().cuda() - space.instantiate(input_dim=di, output_dim=do) - esti = OneShotEstimator() - algo = Darts(num_epochs=10) - model = algo.search(space, dataset, esti) - test_model(model, data, True) - print("Random search + graphnas ") space = GraphNasNodeClassificationSpace().cuda() space.instantiate(input_dim=di, output_dim=do)