twjiang / graphSAGE-pytorch

A PyTorch implementation of GraphSAGE. This package contains a PyTorch implementation of GraphSAGE.
621 stars 150 forks source link

no model_save function? #10

Closed Abigale001 closed 4 years ago

Abigale001 commented 4 years ago

I am trying to run your example commend: python -m src.main --epochs 50 --cuda --learn_method unsup However, there is an error that:

... Step [66/68], Loss: 7.4922, Dealed Nodes [1355/1355] Step [67/68], Loss: 7.5110, Dealed Nodes [1355/1355] Step [68/68], Loss: 7.4139, Dealed Nodes [1355/1355] Training Classification ... Loading embeddings from trained GraphSAGE model. Embeddings loaded. Validation F1: 0.5720620842572062 Test F1: 0.5753880266075388 Traceback (most recent call last): File "/home/xxx/anaconda2/envs/xxx/lib/python3.7/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/home/xxx/anaconda2/envs/xxx/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/xxx/xxx/xxx/graphSAGE-pytorch/src/main.py", line 74, in classification, args.max_vali_f1 = train_classification(dataCenter, graphSage, classification, ds, device, args.max_vali_f1, args.name) File "/home/xxx/xxx/xxx/graphSAGE-pytorch/src/utils.py", line 110, in train_classification max_vali_f1 = evaluate(dataCenter, ds, graphSage, classification, device, max_vali_f1, name, epoch) File "/home/xxx/xxx/xxx/graphSAGE-pytorch/src/utils.py", line 52, in evaluate torch.save(models, 'models/modelbest{}ep{}{:.4f}.torch'.format(name, cur_epoch, test_f1)) File "/home/xxx/anaconda2/envs/xxx/lib/python3.7/site-packages/torch/serialization.py", line 224, in save return _with_file_like(f, "wb", lambda f: _save(obj, f, pickle_module, pickle_protocol)) File "/home/xxx/anaconda2/envs/xxx/lib/python3.7/site-packages/torch/serialization.py", line 147, in _with_file_like f = open(f, mode) FileNotFoundError: [Errno 2] No such file or directory: 'models/model_best_debug_ep0_0.5754.torch'

It seems that there is no save model function to models directory. Am I right?

zhao-tong commented 4 years ago

no, you got this error because you didn't create the models/ directory.