stable_baselines 3 不存储 tensorboard_log

问题描述

我刚刚进入强化学习。我的模型不会在给定目录中创建任何文件。我做错了什么?

def train():
    model = PPO('MlpPolicy',env,verbose=1,tensorboard_log=log_path)

    model.learn(total_timesteps=3000)
    with open(os.path.join(log_path,"Text.txt")) as file: #Test if given directory works
        print(file.read())

    model.save(PPO_Path)

经过训练的模型运行良好。

解决方法

model.learn() 函数应该有额外的参数 tb_log_name

像这样:

model.learn(total_timesteps=3000,tb_log_name="experiment_1")