-
Notifications
You must be signed in to change notification settings - Fork 718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potential memory issue with tf_py_environment #8
Comments
Hi Eric, Note that you are using a You'll want to change the later segment of your code to be:
|
Thank you so much for your help! It completely makes sense. I think I was just following Thanks again. |
@oars After running your code, I actually got an error:
Do you know how I can fix this? Also, as I mentioned above, when I ran the code Thanks! |
Can you try updating tf-agents and trying again? I can't reproduce your error. For reference I just re-ran with this code:
Regarding the memory fluctuations I wouldn't expect that to happen either. Note that your image is fairly large ~280MB as raw float32 so if there are a couple of internal instances of it memory usage will be large. |
It works! I used |
@oars How to deal with it in tf 2.0 without tf.Session ? |
How to deal with what? There are examples using environments in 2.0. Please look at the colabs. |
Hi,
First of all, my environment is the following:
Tensorflow version: 1.13.0-dev20190205 (pip install tf-nightly-gpu)
tf-agents version: 0.2.0.dev20190123 (pip install tf-agents-nightly)
CUDA version: 10.0
cuDNN version: 7.4.1
Ubuntu version: 16.04
When I wrapped my customized python environment using tf_py_environment, it seemed to consume more and more cpu memory as time passed until the memory ran out and the program got stuck. This problem is particularly evident if my observation is large (say a RGB image or a large vector).
Here is a toy example:
After a few minutes of running, it drained almost all the memory until the program got stuck. The last print out is
850000
.I have also run
tf_agents/agents/dqn/examples/train_eval_atari.py
for a while and it has the same symptom.The memory fluctuated between 40% - 90% and due to the time / computing limit, I didn't get the chance to run it until convergence or crash / getting stuck.
In both cases, running the program makes my machine pretty slow. Is this expected?
I am very new to tf-agents so I suspect I did something wrong (maybe I am supposed to free memory somewhere in my code?). I would really appreciate if someone could point me to the right direction. Thanks!
Eric
The text was updated successfully, but these errors were encountered: