Question
This Content is from Stack Overflow. Question asked by Timothée Fronteau
Although I seem to have installed the right versions of tensorflow, cudatoolkit, cudnn and have the right hardware, adequate functions are not found in the .dll files
Here is my test code simple_model.py
which I can’t run:
import tensorflow as tf
from tensorflow.keras.layers import Conv2D
from tensorflow.keras.models import Sequential
model = Sequential([Conv2D(3, 3, input_shape=(None, None, 3))])
with tf.device('gpu:0'):
x = tf.ones((32, 20, 20, 3))
y = model.predict(x)
here are the command lines I’ve executed:
conda create -n testenv python=3.8.6
conda activate testenv
conda install cudatoolkit=11.2 cudnn=8.1.0
pip install tensorflow==2.9
python N:pathtosimple_model.py
I have a NVIDIA Quadro RTX 6000 GPU with Driver Version: 460.89.
I get the following errors:
2022-07-28 14:25:55.370989: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-07-28 14:26:00.539273: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1532] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 22073 MB memory: -> device: 0, name: Quadro RTX 6000, pci bus id: 0000:65:00.0, compute capability: 7.5
2022-07-28 14:26:10.831136: E tensorflow/stream_executor/cuda/cuda_dnn.cc:389] Could not create cudnn handle: CUDNN_STATUS_ALLOC_FAILED
2022-07-28 14:26:10.831278: W tensorflow/core/framework/op_kernel.cc:1745] OP_REQUIRES failed at conv_ops.cc:1120 : UNIMPLEMENTED: DNN library is not found.
Traceback (most recent call last):
File "N:pathtosimple_model.py", line 9, in <module>
y = model.predict(x)
File "C:pathtominiforge3envstestenvlibsite-packageskerasutilstraceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:pathtominiforge3envstestenvlibsite-packagestensorflowpythoneagerexecute.py", line 54, in quick_execute
tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.UnimplementedError: Graph execution error:
Detected at node 'sequential/conv2d/Conv2D' defined at (most recent call last):
File "N:pathtosimple_model.py", line 9, in <module>
y = model.predict(x)
...
File "C:pathtominiforge3envstestenvlibsite-packageskeraslayersconvolutionalbase_conv.py", line 250, in call
outputs = self.convolution_op(inputs, self.kernel)
File "C:pathtominiforge3envstestenvlibsite-packageskeraslayersconvolutionalbase_conv.py", line 225, in convolution_op
return tf.nn.convolution(
Node: 'sequential/conv2d/Conv2D'
DNN library is not found.
[[{{node sequential/conv2d/Conv2D}}]] [Op:__inference_predict_function_106]
Can someone please help me understand what is happening??
I’ve also tried without the cudatoolkit and cudnn packages of conda and rather installed CUDA Toolkit and cuDNN on Nvidia’s website, compiled the first one with Visual Studio 2017 but it didn’t change anything.
Solution
If your cloning the Tensorflow Repo from Github,change the setup.py within ..\models\research\object_detection\packages\tf2 to
'tensorflow==2.7.0',
'tf-models-official==2.7.0',
'tensorflow_io==0.23.1',
So when you’re installing TFOD it will install Tensorflow 2.7 instead 2.8. But make sure to do the changes after you clone the repo from github. Otherwise your changes will be gone
Answered by dnhrtmn
This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 4.0.