mirror of
https://github.com/wassname/ray.git
synced 2026-06-28 19:33:06 +08:00
[tune/rllib] Use cloudpickle to dump config (#3462)
<!-- Thank you for your contribution! Please review https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before opening a pull request. --> ## What do these changes do? JSON Logger now uses cloudpickle to dump the configs as welll, which pkls the functions needed for multi-agent replay. ## Related issue number <!-- Are there any issues opened that will be resolved by merging this change? -->
This commit is contained in:
committed by
Richard Liaw
parent
b9e1977fae
commit
7a7c6e53c8
@@ -9,6 +9,7 @@ import numpy as np
|
||||
import os
|
||||
import yaml
|
||||
|
||||
import ray.cloudpickle as cloudpickle
|
||||
from ray.tune.log_sync import get_syncer
|
||||
from ray.tune.result import NODE_IP, TRAINING_ITERATION, TIME_TOTAL_S, \
|
||||
TIMESTEPS_TOTAL
|
||||
@@ -103,6 +104,9 @@ class _JsonLogger(Logger):
|
||||
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)
|
||||
local_file = os.path.join(self.logdir, "result.json")
|
||||
self.local_out = open(local_file, "w")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user