Skip to content

Commit

Permalink
Simplify saving, when parent folder doesn't exist.
Browse files Browse the repository at this point in the history
  • Loading branch information
Miltos Allamanis committed Nov 27, 2020
1 parent 0ba8308 commit ab3e309
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ptgnn/baseneuralmodel/abstractneuralmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def build_neural_module(self) -> TNeuralModule:

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

Expand Down

0 comments on commit ab3e309

Please sign in to comment.