Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
feat: save config as json (#483)
Browse files Browse the repository at this point in the history
Pickled `FullConfigSchema`s will break when loading if the signature of
`FullConfigSchema` has changed, since `allow_extra` is false. As a
backup, we now save as json as well.
  • Loading branch information
MartinBernstorff authored Apr 12, 2023
2 parents 9943468 + d3ded84 commit 0be42a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,5 @@ package.json
*.csv

evaluation_results
*.pqt
*.pqt
tests/test_eval_results
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import logging
from pathlib import Path
from typing import Any, Optional, Union
Expand Down Expand Up @@ -82,6 +83,10 @@ def save(
if cfg is not None:
dump_to_pickle(cfg, self.dir_path / "cfg.pkl")

with (self.dir_path / "cfg.json").open(mode="w") as f:
cfg_dict = cfg.json()
json.dump(cfg_dict, f)

if pipe_metadata is not None:
dump_to_pickle(pipe_metadata, self.dir_path / "pipe_metadata.pkl")

Expand Down

0 comments on commit 0be42a7

Please sign in to comment.