Kautenja / playing-mario-with-deep-reinforcement-learning

An implementation of (Double/Dueling) Deep-Q Learning to play Super Mario Bros.
MIT License
68 stars 12 forks source link

Out of memory error during training #36

Open aadeshnpn opened 6 years ago

aadeshnpn commented 6 years ago

I started training the algorithm for SuperMarioBros. I tried it on Desktop and Laptop with Nvidia GPU and 16 GB of RAM. On both machines, the training scripts exits after the RAM is full.

Kautenja commented 6 years ago

Ah, this is to be expected as the default DeepQAgent initializes a replay queue of 750,000 states. This requires ~39GB of RAM to execute. Changing the 40th line of train.py from

agent = DeepQAgent(env, replay_memory_size=int(7.5e5))

to

agent = DeepQAgent(env, replay_memory_size=int(2.5e5))

should fix your problem. Otherwise I'd suggest finding a powerful server with 64GB+ RAM and at least a GTX1070 to run training sessions on.

In the near future I'll update:

  1. the CLI to support passing training parameters in without editing code files
  2. init of DeepQAgent to raise an error if the replay queue will exceed the amount of memory on the machine
aadeshnpn commented 6 years ago

Thanks @Kautenja.