Using allow_growth on keras with tensorflow
See original GitHub issueI’m using Keras with TensorFlow to train a large number of tiny networks (~4 layers, less than 30 nodes in each layer). Currently TF allocates all GPU memory to a single process and therefore prevents me from opening more learning processes in parallel. I found on TF document that I can use
config.gpu_options.allow_growth = True
session = tf.Session(config=config, ...)
to do this. However, I wasn’t able to integrate that into keras. Does someone know the way to initialize a tf session on keras? Thank you very much!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:15 (2 by maintainers)
Top Results From Across the Web
Using allow_growth memory option in Tensorflow and Keras
It prevents any new GPU process which consumes a GPU memory to be run on the same machine. Example of three processes which...
Read more >Use a GPU | TensorFlow Core
Use a GPU · On this page · Setup · Overview · Logging device placement · Manual device placement · Limiting GPU memory...
Read more >How to set dynamic memory growth on TF 2.1? - Stack Overflow
With previous versions of tensorflow+keras I was able to set an 'allow_growth' option and view realtime memory usage with nvidia-smi.
Read more >How to limit GPU Memory in TensorFlow 2.0 (and 1.x)
When your GPU run out of memory..! Wanna limit your GPU memory(VRAM) usage in TensorFlow 2.0 ? You can find a detailed explanation...
Read more >How to Manage GPU Resource Utilization in Tensorflow and ...
I'll show you how to keep Tensorflow and Keras from hogging all your VRAM, so that you can run multiple models on the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@vijaycd , if you are still looking for an actual code you can copy-paste into your Keras code to have Tensorflow dynamically allocate the GPU memory:
I am sorry, I am new to KEras. How do I use it in my .py file. I need to have the equivalent of
Thanks.