Skip to content

Commit 2ef1159

Browse files
author
Miltos
authored
Merge pull request #7 from microsoft/mallamanis/simplify-saving
Simplify model saving, when parent folder doesn't exist.
2 parents 0ba8308 + cceac45 commit 2ef1159

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

ptgnn/baseneuralmodel/abstractneuralmodel.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from typing_extensions import final
22

33
import gzip
4+
import os
45
import torch
56
from abc import ABC, abstractmethod
67
from concurrent import futures
@@ -151,6 +152,7 @@ def build_neural_module(self) -> TNeuralModule:
151152

152153
# region Saving/Loading
153154
def save(self, path: Path, model: TNeuralModule) -> None:
155+
os.makedirs(os.path.dirname(str(path)), exist_ok=True)
154156
with gzip.open(path, "wb") as f:
155157
torch.save((self, model), f)
156158

0 commit comments

Comments
 (0)