From 31115aece284d5eb92b9354acb6b84968e2759b7 Mon Sep 17 00:00:00 2001 From: Andrei Ivanov <32910461+drivanov@users.noreply.github.com> Date: Wed, 9 Oct 2024 22:25:54 -0700 Subject: [PATCH 1/2] [UserWarning] Eliminating the use of the deprecated `verbose` parameter. (#7812) --- examples/pytorch/ogb/directional_GSN/main.py | 2 +- examples/pytorch/ogb/ogbn-arxiv/gcn.py | 1 - examples/pytorch/ogb/ogbn-products/gat/gat.py | 1 - examples/pytorch/ogb/ogbn-products/mlp/mlp.py | 1 - examples/pytorch/ogb/ogbn-proteins/gat.py | 2 +- 5 files changed, 2 insertions(+), 5 deletions(-) diff --git a/examples/pytorch/ogb/directional_GSN/main.py b/examples/pytorch/ogb/directional_GSN/main.py index f4f1dc0aa961..559dee3569d0 100644 --- a/examples/pytorch/ogb/directional_GSN/main.py +++ b/examples/pytorch/ogb/directional_GSN/main.py @@ -302,7 +302,7 @@ def train(dataset, params): optimizer = optim.Adam(model.parameters(), lr=0.0008, weight_decay=1e-5) scheduler = optim.lr_scheduler.ReduceLROnPlateau( - optimizer, mode="min", factor=0.8, patience=8, verbose=True + optimizer, mode="min", factor=0.8, patience=8 ) epoch_train_losses, epoch_val_losses = [], [] diff --git a/examples/pytorch/ogb/ogbn-arxiv/gcn.py b/examples/pytorch/ogb/ogbn-arxiv/gcn.py index c30b4dee7add..de3db57381c9 100644 --- a/examples/pytorch/ogb/ogbn-arxiv/gcn.py +++ b/examples/pytorch/ogb/ogbn-arxiv/gcn.py @@ -136,7 +136,6 @@ def run( mode="min", factor=0.5, patience=100, - verbose=True, min_lr=1e-3, ) diff --git a/examples/pytorch/ogb/ogbn-products/gat/gat.py b/examples/pytorch/ogb/ogbn-products/gat/gat.py index c3585f6b5519..826e370745df 100755 --- a/examples/pytorch/ogb/ogbn-products/gat/gat.py +++ b/examples/pytorch/ogb/ogbn-products/gat/gat.py @@ -302,7 +302,6 @@ def run( mode="max", factor=0.7, patience=20, - verbose=True, min_lr=1e-4, ) diff --git a/examples/pytorch/ogb/ogbn-products/mlp/mlp.py b/examples/pytorch/ogb/ogbn-products/mlp/mlp.py index 4c1fa8228ded..56e9d52b3e38 100755 --- a/examples/pytorch/ogb/ogbn-products/mlp/mlp.py +++ b/examples/pytorch/ogb/ogbn-products/mlp/mlp.py @@ -215,7 +215,6 @@ def run( mode="max", factor=0.7, patience=20, - verbose=True, min_lr=1e-4, ) diff --git a/examples/pytorch/ogb/ogbn-proteins/gat.py b/examples/pytorch/ogb/ogbn-proteins/gat.py index 6860461611e0..e3f8ab08e257 100755 --- a/examples/pytorch/ogb/ogbn-proteins/gat.py +++ b/examples/pytorch/ogb/ogbn-proteins/gat.py @@ -246,7 +246,7 @@ def run( model.parameters(), lr=args.lr, weight_decay=args.wd ) lr_scheduler = optim.lr_scheduler.ReduceLROnPlateau( - optimizer, mode="max", factor=0.75, patience=50, verbose=True + optimizer, mode="max", factor=0.75, patience=50 ) total_time = 0 From 433ffb34b146fc1c5c85ff20a8caf2df52e380c4 Mon Sep 17 00:00:00 2001 From: Andrei Ivanov <32910461+drivanov@users.noreply.github.com> Date: Wed, 9 Oct 2024 22:29:33 -0700 Subject: [PATCH 2/2] [FutureWarning] Resolving the warning related to the use of a single-element series. (#7813) --- examples/pytorch/eeg-gcnn/EEGGraphDataset.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/examples/pytorch/eeg-gcnn/EEGGraphDataset.py b/examples/pytorch/eeg-gcnn/EEGGraphDataset.py index 8af8f6c59dc7..affda325f878 100644 --- a/examples/pytorch/eeg-gcnn/EEGGraphDataset.py +++ b/examples/pytorch/eeg-gcnn/EEGGraphDataset.py @@ -84,17 +84,22 @@ def get_sensor_distances(self): def get_geodesic_distance( self, montage_sensor1_idx, montage_sensor2_idx, coords_1010 ): + def get_coord(ref_sensor, coord): + return float( + (coords_1010[coords_1010.label == ref_sensor][coord]).iloc[0] + ) + # get the reference sensor in the 10-10 system for the current montage pair in 10-20 system ref_sensor1 = self.ref_names[montage_sensor1_idx] ref_sensor2 = self.ref_names[montage_sensor2_idx] - x1 = float(coords_1010[coords_1010.label == ref_sensor1]["x"]) - y1 = float(coords_1010[coords_1010.label == ref_sensor1]["y"]) - z1 = float(coords_1010[coords_1010.label == ref_sensor1]["z"]) + x1 = get_coord(ref_sensor1, "x") + y1 = get_coord(ref_sensor1, "y") + z1 = get_coord(ref_sensor1, "z") - x2 = float(coords_1010[coords_1010.label == ref_sensor2]["x"]) - y2 = float(coords_1010[coords_1010.label == ref_sensor2]["y"]) - z2 = float(coords_1010[coords_1010.label == ref_sensor2]["z"]) + x2 = get_coord(ref_sensor2, "x") + y2 = get_coord(ref_sensor2, "y") + z2 = get_coord(ref_sensor2, "z") # https://math.stackexchange.com/questions/1304169/distance-between-two-points-on-a-sphere r = 1 # since coords are on unit sphere