graphSAGE-pytorch icon indicating copy to clipboard operation
graphSAGE-pytorch copied to clipboard

RuntimeError: Parent directory models does not exist.

Open Mariyaaaaaaaaaa opened this issue 1 year ago • 1 comments

Traceback (most recent call last): File "D:\lunwen2\githubprogram--gnn\graphsage\graphSAGE-pytorch-master\main.py", line 76, in args.max_vali_f1 = evaluate(dataCenter, ds, graphSage, classification, device, args.max_vali_f1, args.name, epoch) File "D:\lunwen2\githubprogram--gnn\graphsage\graphSAGE-pytorch-master\src\utils.py", line 52, in evaluate torch.save(models, 'models/model_best_{}ep{}{:.4f}.torch'.format(name, cur_epoch, test_f1)) File "D:\lunwen2\githubprogram--gnn\graphsage\graphSAGE-pytorch-master\venv\lib\site-packages\torch\serialization.py", line 440, in save with _open_zipfile_writer(f) as opened_zipfile: File "D:\lunwen2\githubprogram--gnn\graphsage\graphSAGE-pytorch-master\venv\lib\site-packages\torch\serialization.py", line 315, in _open_zipfile_writer return container(name_or_buffer) File "D:\lunwen2\githubprogram--gnn\graphsage\graphSAGE-pytorch-master\venv\lib\site-packages\torch\serialization.py", line 288, in init super().init(torch._C.PyTorchFileWriter(str(name))) RuntimeError: Parent directory models does not exist.

Mariyaaaaaaaaaa avatar Sep 12 '23 06:09 Mariyaaaaaaaaaa

定位到这行代码torch.save(models, 'models/model_best_{}ep{}{:.4f}.torch'.format(name, cur_epoch, test_f1)),可以发现代码本是打算将模型保存在models文件夹下,但是下载下来的项目并没有该文件夹。有两种解决方案,第一种,在graphSAGE-pytorch-master下创建一个models的文件夹;第二种,将models换成其他已有的文件夹,如src。

Mariyaaaaaaaaaa avatar Sep 12 '23 06:09 Mariyaaaaaaaaaa