Skip to content

Commit

Permalink
Pretty-print JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
borchero committed Jan 2, 2022
1 parent a25d5c0 commit 78765be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lightkit/estimator/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def save_parameters(self, path: Path) -> None:
"""
params = self.get_params()
try:
data = json.dumps(params)
data = json.dumps(params, indent=4)
with (path / "params.json").open("w+") as f:
f.write(data)
except TypeError:
Expand Down Expand Up @@ -193,7 +193,7 @@ def save_attributes(self, path: Path) -> None:
attribute: getattr(self, attribute) for attribute in self.persistent_attributes
}
try:
data = json.dumps(attributes)
data = json.dumps(attributes, indent=4)
with (path / "attributes.json").open("w+") as f:
f.write(data)
except TypeError:
Expand Down
2 changes: 1 addition & 1 deletion lightkit/nn/configurable.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def save_config(self: ConfigurableModule[C], path: Path) -> None:
"""
path.mkdir(parents=False, exist_ok=True)
with (path / "config.json").open("w+") as f:
json.dump(dataclasses.asdict(self.config), f)
json.dump(dataclasses.asdict(self.config), f, indent=4)

@jit.unused
def save(self: ConfigurableModule[C], path: PathType, compile_model: bool = False) -> None:
Expand Down

0 comments on commit 78765be

Please sign in to comment.