Open Barleysack opened 3 years ago
Hi @Barleysack ,
Thanks for your feedback.
Regarding the first issue, indeed the latest version of TensorFlow is not compatible with NumPy 1.19 (as of May 2021, this will change in the future). So installing NumPy 1.19.2 is the correct solution.
Regarding the second issue, I've never run into it, but it looks like TensorFlow issue #33721.
By default, TensorFlow reserves (almost) all the available RAM on the GPU, and then uses it. This is why you would usually see RAM usage near 6 GB. But once you set the memory growth to True
, TensorFlow behaves differently: it will only reserve RAM as it needs it (but it never releases it). This is why you only see the GPU RAM usage being quite low in the second image: that's simply because your program does not use more RAM than that.
Setting the memory growth to True
can be useful when you want to run two or more TensorFlow programs on the same machine at the same time, so they can share the GPU RAM. But if you only have a single TensorFlow program running on the machine, then I recommend just using the default (unless setting the memory growth to True
fixes the memory bug for some reason).
Note that if your model sometimes uses too much GPU RAM, then setting the memory growth to True
will not help. In this case, the solution would be to reduce the batch size, or the model size, and basically try to use less RAM.
I hope this helps.
I found couple of issues executing this code, while using local environment to execute the code. Well this was the code from the Textbook, and notebook file of ch 16, from Sentiment Analysis.
First, Numpy 1.20.1 does not work with TF 2.4.1 in this code. it will return
Cannot convert a symbolic Tensor (gru/strided_slice:0) to a numpy array.
as a exception message, I'm sorry that I could not get full message since I solved it by downgrading the numpy to 1.19.2.
pip install numpy==1.19.2
will handle this problem anyway.
Second, even if we solved the version issue, we still have memory issue.
For this exception message, I added
to solve the problem. However, I discovered that local GPU memories are not utilized perfectly. I'll attach screenshots for Performance graph from task manager of windows 10.
This is when I run other codes from textbook
Aand this is what happens when I run the code that matters:/
Does anyone know why are they happening? Btw, sorry for screenshots including some Korean. hope you guys understand the screenshot with context:)
Versions (please complete the following information):
GTX1660TI, CUDA11