openai / gym

A toolkit for developing and comparing reinforcement learning algorithms.
https://www.gymlibrary.dev
Other
34.19k stars 8.58k forks source link

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

Open yuvalkabeli opened 2 months ago

yuvalkabeli commented 2 months ago

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

pseudo-rnd-thoughts commented 2 months ago

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