hill-a / stable-baselines

A fork of OpenAI Baselines, implementations of reinforcement learning algorithms
http://stable-baselines.readthedocs.io/
MIT License
4.16k stars 725 forks source link

Steady Memory Increase When Running Example #1099

Closed danieldugas closed 3 years ago

danieldugas commented 3 years ago

Describe the bug similar to https://github.com/hill-a/stable-baselines/issues/716, the memory increases steadily until the process is killed. In this case, when running the SAC example from the documentation with an image-based env (here, CarRacing for example) and CnnPolicy

memleak

Code example

import gym
import numpy as np

from stable_baselines.sac.policies import CnnPolicy
from stable_baselines import SAC

env = gym.make('CarRacing-v0')

model = SAC(CnnPolicy, env, verbose=1)
model.learn(total_timesteps=1000000, log_interval=1)

System Info I initially thought that it was a dependency version issue, but having installed the same versions as mentioned in this comment https://github.com/hill-a/stable-baselines/issues/716#issuecomment-594465949, the problem persists. that is: Ubuntu 18.04 Python 3.6.9 (not conda) Tensorflow 1.14.0 Numpy 1.18.1

stable baselines is on 2.10.0

I have tried several other dependency versions (numpy 1.19, tensorflow 1.13.2, etc..) with no luck so far.

araffin commented 3 years ago

v (here, CarRacing for example) and CnnPolicy

CarRacing is known to have a memory leak... and you should use master version of gym (see https://github.com/openai/gym/issues/2062)

Do it happens with another image based env?

Anyway, I would highly recommend you to switch to Stable-Baselines3 if possible: https://github.com/DLR-RM/stable-baselines3

danieldugas commented 3 years ago

Not seeing the same issue with stable-baselines3, thank you. Closing.