Silently train an agent?


#1

Is there a way to silently train an agent?

I would like to monitor the agent but don’t let it open a window. Make it train silently and then I will look into the recording.

import gym
import tempfile

from IPython.display import HTML
from gym import wrappers

env = gym.make('CartPole-v0')
env = wrappers.Monitor(env, tempfile.gettempdir(), force=True)
for i_episode in range(20):
    observation = env.reset()
    for t in range(100):
        action = env.action_space.sample()
        observation, reward, done, info = env.step(action)
        if done:
            print("Episode finished after {} timesteps".format(t+1))
            break
env.close()

Any ideas how to do this?


#2

render = false