Skip to content

Commit ab3e309

Browse files
author
Miltos Allamanis
committed
Simplify saving, when parent folder doesn't exist.
1 parent 0ba8308 commit ab3e309

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ptgnn/baseneuralmodel/abstractneuralmodel.py

+1
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ def build_neural_module(self) -> TNeuralModule:
151151

152152
# region Saving/Loading
153153
def save(self, path: Path, model: TNeuralModule) -> None:
154+
os.makedirs(os.path.dirname(str(path)), exist_ok=True)
154155
with gzip.open(path, "wb") as f:
155156
torch.save((self, model), f)
156157

0 commit comments

Comments
 (0)