当我运行一些代码(DDPG - Deep Deterministic Policy Gradient)时,发生了这个错误: ValueError: callbacks
must be a callable method that return a subclass of DefaultCallbacks, got <class 'ray.rllib.agents.callbacks.DefaultCallbacks'>
我的代码在这里:
import json
def load_policy():
log_dir = "/root/ray_results/DDPG_SimpleSupplyChain_2020-07-15_02-37-48j2fjk67_" # this path needs to be set manually
checkpoint_id = "200"
with open(f"{log_dir}/params.json", "r") as read_file:
config = json.load(read_file)
trainer = ddpg.DDPGTrainer(config=config, env=SimpleSupplyChain)
trainer.restore(f"{log_dir}/checkpoint_{checkpoint_id}/checkpoint-{checkpoint_id}")
return trainer.get_policy()
policy = load_policy()
log_dir 是经过训练的 DDPG 参数的位置。
我想使用经过训练的参数,所以使用“config = json.load(read_file)”代码。
然后,当我制作 DDPGTrainer 时,使用这个“配置”,但发生了一些错误。
我该如何解决这个错误?