Skip to content

Commit 540dd2b

Browse files
authored
[TestFailure] Resolving exceptions thrown across multiple GraphBolt tests. (dmlc#7852)
1 parent 275183b commit 540dd2b

File tree

53 files changed

+301
-248
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+301
-248
lines changed

dglgo/dglgo/apply_pipeline/graphpred/gen.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def config(
6363
cpt: str = typer.Option(..., help="input checkpoint file path"),
6464
):
6565
# Training configuration
66-
train_cfg = torch.load(cpt)["cfg"]
66+
train_cfg = torch.load(cpt, weights_only=False)["cfg"]
6767
if data is None:
6868
print("data is not specified, use the training dataset")
6969
data = train_cfg["data_name"]
@@ -119,7 +119,9 @@ def gen_script(cls, user_cfg_dict):
119119
cls.user_cfg_cls(**user_cfg_dict)
120120

121121
# Training configuration
122-
train_cfg = torch.load(user_cfg_dict["cpt_path"])["cfg"]
122+
train_cfg = torch.load(user_cfg_dict["cpt_path"], weights_only=False)[
123+
"cfg"
124+
]
123125

124126
# Dict for code rendering
125127
render_cfg = deepcopy(user_cfg_dict)

dglgo/dglgo/apply_pipeline/graphpred/graphpred.jinja-py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def main():
5757
data to have the same number of input edge features, got {:d} and {:d}'.format(model_edge_feat_size, data_edge_feat_size)
5858

5959
model = {{ model_class_name }}(**cfg['model'])
60-
model.load_state_dict(torch.load(cfg['cpt_path'], map_location='cpu')['model'])
60+
model.load_state_dict(torch.load(cfg['cpt_path'], weights_only=False, map_location='cpu')['model'])
6161
pred = infer(device, data_loader, model).detach().cpu()
6262

6363
# Dump the results

dglgo/dglgo/apply_pipeline/nodepred/gen.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def config(
4848
cpt: str = typer.Option(..., help="input checkpoint file path"),
4949
):
5050
# Training configuration
51-
train_cfg = torch.load(cpt)["cfg"]
51+
train_cfg = torch.load(cpt, weights_only=False)["cfg"]
5252
if data is None:
5353
print("data is not specified, use the training dataset")
5454
data = train_cfg["data_name"]
@@ -101,7 +101,9 @@ def gen_script(cls, user_cfg_dict):
101101
cls.user_cfg_cls(**user_cfg_dict)
102102

103103
# Training configuration
104-
train_cfg = torch.load(user_cfg_dict["cpt_path"])["cfg"]
104+
train_cfg = torch.load(user_cfg_dict["cpt_path"], weights_only=False)[
105+
"cfg"
106+
]
105107

106108
# Dict for code rendering
107109
render_cfg = deepcopy(user_cfg_dict)

dglgo/dglgo/apply_pipeline/nodepred/nodepred.jinja-py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def main():
4848
features, got {:d} and {:d}'.format(model_in_size, data_in_size)
4949

5050
model = {{ model_class_name }}(**cfg['model'])
51-
model.load_state_dict(torch.load(cfg['cpt_path'], map_location='cpu')['model'])
51+
model.load_state_dict(torch.load(cfg['cpt_path'], weights_only=False, map_location='cpu')['model'])
5252
logits = infer(device, data, model)
5353
pred = logits.argmax(dim=1).cpu()
5454

dglgo/dglgo/apply_pipeline/nodepred_sample/gen.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def config(
4848
cpt: str = typer.Option(..., help="input checkpoint file path"),
4949
):
5050
# Training configuration
51-
train_cfg = torch.load(cpt)["cfg"]
51+
train_cfg = torch.load(cpt, weights_only=False)["cfg"]
5252
if data is None:
5353
print("data is not specified, use the training dataset")
5454
data = train_cfg["data_name"]
@@ -101,7 +101,9 @@ def gen_script(cls, user_cfg_dict):
101101
cls.user_cfg_cls(**user_cfg_dict)
102102

103103
# Training configuration
104-
train_cfg = torch.load(user_cfg_dict["cpt_path"])["cfg"]
104+
train_cfg = torch.load(user_cfg_dict["cpt_path"], weights_only=False)[
105+
"cfg"
106+
]
105107

106108
# Dict for code rendering
107109
render_cfg = deepcopy(user_cfg_dict)

dglgo/dglgo/apply_pipeline/nodepred_sample/nodepred-ns.jinja-py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def main():
4848
features, got {:d} and {:d}'.format(model_in_size, data_in_size)
4949

5050
model = {{ model_class_name }}(**cfg['model'])
51-
model.load_state_dict(torch.load(cfg['cpt_path'], map_location='cpu')['model'])
51+
model.load_state_dict(torch.load(cfg['cpt_path'], weights_only=False, map_location='cpu')['model'])
5252
logits = infer(device, data, model)
5353
pred = logits.argmax(dim=1).cpu()
5454

dglgo/dglgo/pipeline/graphpred/graphpred.jinja-py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def main(run, cfg, data):
101101
else:
102102
lr_scheduler.step()
103103

104-
model.load_state_dict(torch.load(tmp_cpt_path))
104+
model.load_state_dict(torch.load(tmp_cpt_path, weights_only=False))
105105
os.remove(tmp_cpt_path)
106106
test_metric = evaluate(device, test_loader, model)
107107
print('Test Metric: {:.4f}'.format(test_metric))

dglgo/dglgo/pipeline/nodepred/nodepred.jinja-py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class EarlyStopping:
4242
torch.save(model.state_dict(), self.checkpoint_path)
4343

4444
def load_checkpoint(self, model):
45-
model.load_state_dict(torch.load(self.checkpoint_path))
45+
model.load_state_dict(torch.load(self.checkpoint_path, weights_only=False))
4646

4747
def close(self):
4848
os.remove(self.checkpoint_path)

dglgo/dglgo/pipeline/nodepred_sample/nodepred-ns.jinja-py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class EarlyStopping:
4242
torch.save(model.state_dict(), self.checkpoint_path)
4343

4444
def load_checkpoint(self, model):
45-
model.load_state_dict(torch.load(self.checkpoint_path))
45+
model.load_state_dict(torch.load(self.checkpoint_path, weights_only=False))
4646

4747
def close(self):
4848
os.remove(self.checkpoint_path)

dglgo/dglgo/utils/early_stop.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@ def save_checkpoint(self, model):
3434
torch.save(model.state_dict(), self.checkpoint_path)
3535

3636
def load_checkpoint(self, model):
37-
model.load_state_dict(torch.load(self.checkpoint_path))
37+
model.load_state_dict(
38+
torch.load(self.checkpoint_path, weights_only=False)
39+
)

0 commit comments

Comments
 (0)