Harish L
Harish L

Reputation: 163

I am sometimes getting out of memory while training a model

Tensorflow Version : TF1.13 Using Anaconda

I studied in stack overflow to set :
TF_CUDNN_WORKSPACE_LIMIT_IN_MB = 100 To reduce the scratch space for tensorflow which is 4GB by default

GPU : NVIDIA GTX 1660 TI 6GB card CUDA Version : 11.0

But I do not know how to set the environment variable. I couldn't find any tutorial on it. Since I am a beginner with this can anyone give any links or tell how to set this variable?? It would be really helpful for me.

Upvotes: 0

Views: 332

Answers (1)

Yogesh Aggarwal
Yogesh Aggarwal

Reputation: 1127

You can use the OS module in python as follows:

import os

os.environ['TF_CUDNN_WORKSPACE_LIMIT_IN_MB'] = '100'

And by the way, 100MiB is way much less for a model to be trained. At least allocate it 1GiB.

Upvotes: 2

Related Questions