vwxyzjn / cleanrl

High-quality single file implementation of Deep Reinforcement Learning algorithms with research-friendly features (PPO, DQN, C51, DDPG, TD3, SAC, PPG)
http://docs.cleanrl.dev
Other
4.84k stars 560 forks source link

Unable to allocate 26.3 GiB for an array #453

Closed satyrmipt closed 3 months ago

satyrmipt commented 3 months ago

Problem Description

After installing cleanrl from github i try to run python dqn_atari.py and get "Unable to allocate 26.3 GiB". Do i really need 26 GiB free RAM to run this file?

reinf_learning_hw2) C:\Users\satyr\Documents\edu\rl\hw2\cleanrl\cleanrl>python dqn_atari.py
C:\Users\satyr\anaconda3\envs\reinf_learning_hw2\lib\site-packages\torch\utils\tensorboard\__init__.py:4: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if not hasattr(tensorboard, "__version__") or LooseVersion(
A.L.E: Arcade Learning Environment (version 0.8.1+53f58b7)
[Powered by Stella]
Traceback (most recent call last):
  File "C:\Users\satyr\Documents\edu\rl\hw2\cleanrl\cleanrl\dqn_atari.py", line 182, in <module>
    rb = ReplayBuffer(
  File "C:\Users\satyr\anaconda3\envs\reinf_learning_hw2\lib\site-packages\stable_baselines3\common\buffers.py", line 202, in __init__
    self.observations = np.zeros((self.buffer_size, self.n_envs, *self.obs_shape), dtype=observation_space.dtype)
numpy.core._exceptions._ArrayMemoryError: Unable to allocate 26.3 GiB for an array with shape (1000000, 1, 4, 84, 84) and data type uint8

Checklist

I did it other way: pip install requirements/requirements.txt pip install requirements/requirements-atari.txt

vwxyzjn commented 3 months ago

This is unfortunately the expected behavior. DQN Atari uses a large chunk of memory to store experiences.