Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c1c8168
update optimization
awaelchli Mar 13, 2023
0504638
update inception
awaelchli Mar 13, 2023
da590db
update attention
awaelchli Mar 13, 2023
ec3d50a
incomplete GNN
awaelchli Mar 13, 2023
0b92f1d
update energy models
awaelchli Mar 13, 2023
a5466e4
update deep autoencoders
awaelchli Mar 13, 2023
88722ac
normalizing flows incomplete
awaelchli Mar 13, 2023
47f1cfe
autoregressive
awaelchli Mar 13, 2023
cfab2ee
vit
awaelchli Mar 13, 2023
b4d7be3
meta learning
awaelchli Mar 13, 2023
8ab731c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 13, 2023
18c2430
Apply suggestions from code review
awaelchli Mar 13, 2023
000c803
update gnn
awaelchli Mar 13, 2023
3824605
simclr
awaelchli Mar 13, 2023
d1a93e7
update
awaelchli Mar 13, 2023
6e04b38
Merge branch 'upgrade/course' of github.com:Lightning-AI/tutorials in…
awaelchli Mar 13, 2023
9377298
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 13, 2023
b24b122
Update course_UvA-DL/05-transformers-and-MH-attention/Transformers_MH…
awaelchli Mar 13, 2023
099c50a
update
awaelchli Mar 13, 2023
82f2be6
links
awaelchli Mar 13, 2023
a6a1a17
Merge branch 'main' into upgrade/course
Borda Mar 14, 2023
5733cc0
Merge branch 'main' into upgrade/course
Borda Mar 14, 2023
28accf9
2.0.0rc0
Borda Mar 14, 2023
10615e9
lightning
Borda Mar 14, 2023
217be55
2.0
Borda Mar 14, 2023
1dc811a
Apply suggestions from code review
awaelchli Mar 14, 2023
bb1e40a
docs build fix
awaelchli Mar 14, 2023
835a628
stupid sphinx
awaelchli Mar 14, 2023
94e6725
Merge branch 'main' into upgrade/course
Borda Mar 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update gnn
  • Loading branch information
awaelchli committed Mar 13, 2023
commit 000c803673a498082209ffc0e962c88809fd6c3d
13 changes: 7 additions & 6 deletions course_UvA-DL/06-graph-neural-networks/GNN_overview.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,26 +634,27 @@ def test_step(self, batch, batch_idx):
# Additionally to the Lightning module, we define a training function below.
# As we have a single graph, we use a batch size of 1 for the data loader and share the same data loader for the train,
# validation, and test set (the mask is picked inside the Lightning module).
# Besides, we set the argument `progress_bar_refresh_rate` to zero as it usually shows the progress per epoch,
# Besides, we set the argument `enable_progress_bar` to False as it usually shows the progress per epoch,
# but an epoch only consists of a single step.
# If you have downloaded the pre-trained models in the beginning of the tutorial, we load those instead of training from scratch.
# Finally, we test the model and return the results.


# %%
def train_node_classifier(model_name, dataset, **model_kwargs):
pl.seed_everything(42)
L.seed_everything(42)
node_data_loader = geom_data.DataLoader(dataset, batch_size=1)

# Create a PyTorch Lightning trainer
root_dir = os.path.join(CHECKPOINT_PATH, "NodeLevel" + model_name)
os.makedirs(root_dir, exist_ok=True)
trainer = pl.Trainer(
trainer = L.Trainer(
default_root_dir=root_dir,
callbacks=[ModelCheckpoint(save_weights_only=True, mode="max", monitor="val_acc")],
gpus=AVAIL_GPUS,
accelerator="auto",
devices=AVAIL_GPUS,
max_epochs=200,
progress_bar_refresh_rate=0,
enable_progress_bar=False,
) # 0 because epoch size is 1
trainer.logger._default_hp_metric = None # Optional logging argument that we don't need

Expand All @@ -663,7 +664,7 @@ def train_node_classifier(model_name, dataset, **model_kwargs):
print("Found pretrained model, loading...")
model = NodeLevelGNN.load_from_checkpoint(pretrained_filename)
else:
pl.seed_everything()
L.seed_everything()
model = NodeLevelGNN(
model_name=model_name, c_in=dataset.num_node_features, c_out=dataset.num_classes, **model_kwargs
)
Expand Down