Browse Source

Merge branch 'dev' of github.com:THUMNLab/AutoGL into dev

develop/0.4/predevelop
Generall 4 years ago
parent
commit
5dfdb2a177
6 changed files with 8 additions and 17 deletions
  1. +0
    -1
      autogl/module/nas/algorithm/enas.py
  2. +0
    -1
      autogl/module/nas/algorithm/gasso.py
  3. +0
    -2
      autogl/module/nas/algorithm/rl.py
  4. +0
    -1
      autogl/module/nas/algorithm/spos.py
  5. +3
    -0
      autogl/module/nas/space/autoattend.py
  6. +5
    -12
      test/nas/node_classification.py

+ 0
- 1
autogl/module/nas/algorithm/enas.py View File

@@ -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


+ 0
- 1
autogl/module/nas/algorithm/gasso.py View File

@@ -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


+ 0
- 2
autogl/module/nas/algorithm/rl.py View File

@@ -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


+ 0
- 1
autogl/module/nas/algorithm/spos.py View File

@@ -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


+ 3
- 0
autogl/module/nas/space/autoattend.py View File

@@ -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


+ 5
- 12
test/nas/node_classification.py View File

@@ -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)


Loading…
Cancel
Save