I am trying to create a DQN model for mario environment. But when I try to create the model it gives me this error:
MemoryError: Unable to allocate 229. GiB for an array with shape (1000000, 1, 4, 240, 256) and data type uint8
This is the code for creating the model:
model = DQN('CnnPolicy', env, verbose=1, tensorboard_log=LOG_DIR, learning_rate=0.000001)
I am using Jupyter notebook for this project.
It looks like you simply don't have enough RAM to allocate 229 GiB for an array of that size---which is incredibly large---very few computers could.
Have you tried batching your idea into batches of either 64, 128, 256, etc.? That is a very common way to decrease the memory load, and you can experiment with different values to see what computation you can handle. Tensorflow has a great deal of built-in methods that can help you here. One place to look would be the batch method here.