[tune] Pretty print params json in logger.py (#4903)

This commit is contained in:
Kristian Hartikainen 2019-06-01 12:38:59 -07:00 committed by Richard Liaw
parent 9aa1cd613d
commit 88bab5d3c4

View file

@ -95,7 +95,12 @@ class JsonLogger(Logger):
self.config = config
config_out = os.path.join(self.logdir, "params.json")
with open(config_out, "w") as f:
json.dump(self.config, f, cls=_SafeFallbackEncoder)
json.dump(
self.config,
f,
indent=2,
sort_keys=True,
cls=_SafeFallbackEncoder)
config_pkl = os.path.join(self.logdir, "params.pkl")
with open(config_pkl, "wb") as f:
cloudpickle.dump(self.config, f)