gpt4 book ai didi

reinforcement-learning - 未使用 Stable-Baselines3 监视 CustomEnv 的转出摘要统计信息

转载 作者:行者123 更新时间:2023-12-02 05:47:53 26 4
gpt4 key购买 nike

我正在尝试通过 Stable-Baselines3 和 OpenAI Gym 使用 PPO 训练自定义环境。出于某种原因,当我尝试训练 PPO 模型时,未针对此自定义环境报告推出统计信息。

我正在使用的代码如下(为简洁起见,我没有包括 CustomEnv 的代码):

env = CustomEnv(mode = "discrete")
env = Monitor(env, log_dir)
model = PPO("MlpPolicy", env, verbose=1, tensorboard_log = log_dir)

timesteps = 5000
for i in range(3):
model.learn(total_timesteps = timesteps, reset_num_timesteps = False, tb_log_name = "PPO")
model.save(f"{models_dir}/car_model_{timesteps * i}")

下图展示了上述代码的输出(图片右侧),图片左侧展示了我用于调试的虚拟环境的常规输出。

On the left we have the usual output from model.learn() applied to a dummy environment, with rollout statistics being reported. On the right is my custom environment, where only 'time' and 'train' statistics are being reported.

我已经尝试添加这行代码:

env = Monitor(env, log_dir)

但这不会改变输出。

最佳答案

已解决:存在环境未结束的边缘情况,并且 done 变量无限期地保持为 False。

修复此错误后,Rollout 统计数据重新出现。

关于reinforcement-learning - 未使用 Stable-Baselines3 监视 CustomEnv 的转出摘要统计信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71786530/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com