gym icon indicating copy to clipboard operation
gym copied to clipboard

[bug] OpenAI gym set_level(50) not disabling logs

Open yuvalkabeli opened this issue 10 months ago • 1 comments

Im running gym.logger.set_level(50) which is supposed to silence logs completely, and the logs just keep coming

Code:

import gym
    gym.logger.set_level(50)
    rgb_env = gym.make('ALE/Pong-v5', render_mode='rgb_array')
 
    ...

    done = False
    total_points = 0
    while not done:
           action = agent.get_action(stacked_state)
           next_observation, reward, terminated, truncated, info = rgb_env.step(action)

Log: ... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 97ms/step 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 111ms/step 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 93ms/step 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 107ms/step 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 104ms/step 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 101ms/step 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 95ms/step 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 115ms/step 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 67ms/step 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 96ms/step 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 87ms/step 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 91ms/step ...

System Info python 3.11.7 windows 10 VS code gym==0.26.2 gym-notices==0.0.8 running the pong game in gym[atari] gym installed trough pip insatll

yuvalkabeli avatar Apr 08 '24 18:04 yuvalkabeli

What is doing the logging? I suspect your issue is that something in your agent.get_action is logging data. Otherwise, could you provide a reproducible example script to test with

pseudo-rnd-thoughts avatar Apr 08 '24 20:04 pseudo-rnd-thoughts