Tensorflow与cudnn不兼容的问题。

3

我正在使用Ubuntu 20.04并安装了Anaconda。根据此说明,我通过conda create -n tf tensorflow-gpu创建了一个环境。

在安装了scikit-learn和tqdm等必要的包之后,我尝试运行以下代码:

## Global variables

BATCH_SIZE = 2 
EPOCHS = 50 
CATGORICAL = 10 
PATIENCE = 10
INPUT_SHAPE = (32, 32, 3) 
TARGET_SIZE = (INPUT_SHAPE[0], INPUT_SHAPE[1]) 
TRAIN_SIZE = 0.8
VAL_SPLIT = 0.2 
STUDENT_CNN_LR = 1e-5
LR_FACTOR = 0.4 
LR_PATIENCE = 3 
MODEL_NAME = 'tftest.hdf5' 
### Setup ###

import numpy as np
import tensorflow as tf

from glob import *
import numpy as np # linear algebra
import os
import tensorflow as tf

from sklearn.model_selection import train_test_split, StratifiedKFold, learning_curve
from sklearn.preprocessing import MinMaxScaler, StandardScaler, scale
from sklearn.metrics import roc_auc_score, confusion_matrix, accuracy_score, classification_report

from tensorflow import keras
from tensorflow.keras.applications.resnet50 import ResNet50
from tensorflow.keras.layers import Activation, Dropout, Flatten, Dense, GlobalMaxPooling2D, BatchNormalization, Input, Conv2D, MaxPool2D, GlobalAveragePooling2D
from tensorflow.keras.callbacks import ModelCheckpoint
from tensorflow.keras import metrics, layers, Sequential
from tensorflow.keras.optimizers import Adam 
from tensorflow.keras.models import Model
from tensorflow.keras.losses import binary_crossentropy, categorical_crossentropy, SparseCategoricalCrossentropy
from tensorflow.keras.callbacks import ModelCheckpoint, LearningRateScheduler, EarlyStopping, ReduceLROnPlateau

from tqdm import *
from scipy.stats import norm, rankdata

### Load the dataset ###

(X_train, y_train), (X_test, y_test) = tf.keras.datasets.mnist.load_data()

# expand new axis, channel axis 
X_train = np.expand_dims(X_train, axis=-1)
X_test = np.expand_dims(X_test, axis=-1)

# [optional]: we may need 3 channel (instead of 1)
X_train = np.repeat(X_train, 3, axis=-1)
X_test = np.repeat(X_test, 3, axis=-1)

# resize the input shape , i.e. old shape: 28, new shape: 32 (cifar is 32 already)
X_train = tf.image.resize(X_train, TARGET_SIZE) # if we want to resize 
X_test = tf.image.resize(X_test, TARGET_SIZE) # if we want to resize 

# one hot 
y_train = tf.keras.utils.to_categorical(y_train, num_classes=CATGORICAL)
y_test = tf.keras.utils.to_categorical(y_test, num_classes=CATGORICAL)


data_augmentation_student = tf.keras.Sequential([
    tf.keras.layers.experimental.preprocessing.Rescaling(scale=1/255),
    layers.experimental.preprocessing.Normalization()
])

# images in cifar is small, use LeNet
student_CNN = keras.Sequential(
[
    data_augmentation_student,
    Conv2D(filters=6, kernel_size=(5,5), padding='valid', input_shape=INPUT_SHAPE, activation='tanh'),
    MaxPool2D(pool_size=(2,2)),
    Conv2D(filters=16, kernel_size=(5,5), padding='valid', activation='tanh'),
    MaxPool2D(pool_size=(2,2)),
    Flatten(),
    Dense(120, activation='tanh'),
    Dense(84, activation='tanh'),
    Dense(CATGORICAL, activation='softmax')
],
    name="student_CNN",
)
student_CNN.compile(optimizer=Adam(learning_rate=STUDENT_CNN_LR), loss='categorical_crossentropy', metrics=['accuracy'])
checkpoint = ModelCheckpoint(filepath=MODEL_NAME, monitor='val_accuracy', verbose=1, 
                             save_best_only=True, mode='auto', save_weights_only = True)
reduceLROnPlat = ReduceLROnPlateau(monitor='val_accuracy', factor=LR_FACTOR, patience=LR_PATIENCE, 
                                   verbose=1, mode='auto', min_delta=0.0001)
early = EarlyStopping(monitor='val_accuracy', mode="auto", patience=PATIENCE)
callbacks_list = [checkpoint, reduceLROnPlat, early]
history = student_CNN.fit(X_train, y_train,
                    batch_size=BATCH_SIZE, 
                    epochs=EPOCHS,
                    verbose=1,
                    callbacks=callbacks_list,
                    validation_split=VAL_SPLIT)

# 計算正確率
CNN_epoch = len(list(range(len(history.history['accuracy']))))
CNN_train_acc = history.history['accuracy'][-1]
CNN_val_acc = history.history['val_accuracy'][-1]
y_test_int = [np.where(r==1)[0][0] for r in y_test] # y_test is one hot, convert to integer labels
student_CNN.load_weights(MODEL_NAME)
student_prediction = student_CNN.predict(X_test, batch_size=BATCH_SIZE, verbose=1)
y_prediction_S = np.argmax(student_prediction, axis=1)
CNN_test_acc = accuracy_score(y_prediction_S, y_test_int)

我使用命令 python tftest.py 来在GPU上运行代码。

021-09-30 17:44:53.913935: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.1
2021-09-30 17:44:55.106074: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-09-30 17:44:55.106578: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcuda.so.1
2021-09-30 17:44:55.134062: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-30 17:44:55.134520: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties: 
pciBusID: 0000:01:00.0 name: NVIDIA GeForce RTX 3060 computeCapability: 8.6
coreClock: 1.852GHz coreCount: 28 deviceMemorySize: 11.77GiB deviceMemoryBandwidth: 335.32GiB/s
2021-09-30 17:44:55.134534: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.1
2021-09-30 17:44:55.135370: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.10
2021-09-30 17:44:55.135393: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublasLt.so.10
2021-09-30 17:44:55.136296: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcufft.so.10
2021-09-30 17:44:55.136437: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcurand.so.10
2021-09-30 17:44:55.137322: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusolver.so.10
2021-09-30 17:44:55.137817: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusparse.so.10
2021-09-30 17:44:55.139781: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.7
2021-09-30 17:44:55.139853: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-30 17:44:55.140351: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-30 17:44:55.140850: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-09-30 17:44:55.141045: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  SSE4.1 SSE4.2 AVX AVX2 AVX512F FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-09-30 17:44:55.141798: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-30 17:44:55.142243: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties: 
pciBusID: 0000:01:00.0 name: NVIDIA GeForce RTX 3060 computeCapability: 8.6
coreClock: 1.852GHz coreCount: 28 deviceMemorySize: 11.77GiB deviceMemoryBandwidth: 335.32GiB/s
2021-09-30 17:44:55.142255: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.1
2021-09-30 17:44:55.142264: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.10
2021-09-30 17:44:55.142270: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublasLt.so.10
2021-09-30 17:44:55.142275: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcufft.so.10
2021-09-30 17:44:55.142280: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcurand.so.10
2021-09-30 17:44:55.142287: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusolver.so.10
2021-09-30 17:44:55.142293: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcusparse.so.10
2021-09-30 17:44:55.142299: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.7
2021-09-30 17:44:55.142325: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-30 17:44:55.142767: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-30 17:44:55.143181: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-09-30 17:44:55.143199: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.1

但是代码在这里卡了4分钟,然后出现了错误。

2021-09-30 17:48:33.025621: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-09-30 17:48:33.025643: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267]      0 
2021-09-30 17:48:33.025647: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0:   N 
2021-09-30 17:48:33.025797: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-30 17:48:33.026250: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-30 17:48:33.026668: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:941] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2021-09-30 17:48:33.027075: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1406] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10758 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce RTX 3060, pci bus id: 0000:01:00.0, compute capability: 8.6)
2021-09-30 17:48:33.027256: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-09-30 17:48:33.038331: W tensorflow/core/framework/cpu_allocator_impl.cc:80] Allocation of 737280000 exceeds 10% of free system memory.
2021-09-30 17:48:33.669046: W tensorflow/core/framework/cpu_allocator_impl.cc:80] Allocation of 589824000 exceeds 10% of free system memory.
2021-09-30 17:48:33.838103: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:116] None of the MLIR optimization passes are enabled (registered 2)
2021-09-30 17:48:33.856360: I tensorflow/core/platform/profile_utils/cpu_utils.cc:112] CPU Frequency: 2592000000 Hz
Epoch 1/50
2021-09-30 17:48:34.107817: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcublas.so.10
2021-09-30 17:49:42.529567: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudnn.so.7
2021-09-30 18:00:47.141606: W tensorflow/stream_executor/gpu/asm_compiler.cc:63] Running ptxas --version returned 256
2021-09-30 18:00:47.200580: W tensorflow/stream_executor/gpu/redzone_allocator.cc:314] Internal: ptxas exited with non-zero error code 256, output: 
Relying on driver to perform ptx compilation. 
Modify $PATH to customize ptxas location.
This message will be only logged once.
2021-09-30 18:00:47.881462: W tensorflow/core/framework/op_kernel.cc:1763] OP_REQUIRES failed at cwise_op_gpu_base.cc:89 : Internal: Failed to load in-memory CUBIN: CUDA_ERROR_NO_BINARY_FOR_GPU: no kernel image is available for execution on the device
Traceback (most recent call last):
  File "/home/benny/Documents/DL2021/tensorflow_test/tftest.py", line 91, in <module>
    history = student_CNN.fit(X_train, y_train,
  File "/home/benny/anaconda3/envs/tf/lib/python3.9/site-packages/tensorflow/python/keras/engine/training.py", line 1100, in fit
    tmp_logs = self.train_function(iterator)
  File "/home/benny/anaconda3/envs/tf/lib/python3.9/site-packages/tensorflow/python/eager/def_function.py", line 828, in __call__
    result = self._call(*args, **kwds)
  File "/home/benny/anaconda3/envs/tf/lib/python3.9/site-packages/tensorflow/python/eager/def_function.py", line 888, in _call
    return self._stateless_fn(*args, **kwds)
  File "/home/benny/anaconda3/envs/tf/lib/python3.9/site-packages/tensorflow/python/eager/function.py", line 2942, in __call__
    return graph_function._call_flat(
  File "/home/benny/anaconda3/envs/tf/lib/python3.9/site-packages/tensorflow/python/eager/function.py", line 1918, in _call_flat
    return self._build_call_outputs(self._inference_function.call(
  File "/home/benny/anaconda3/envs/tf/lib/python3.9/site-packages/tensorflow/python/eager/function.py", line 555, in call
    outputs = execute.execute(
  File "/home/benny/anaconda3/envs/tf/lib/python3.9/site-packages/tensorflow/python/eager/execute.py", line 59, in quick_execute
    tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
tensorflow.python.framework.errors_impl.InternalError:  Failed to load in-memory CUBIN: CUDA_ERROR_NO_BINARY_FOR_GPU: no kernel image is available for execution on the device
     [[node student_CNN/conv2d/Tanh (defined at /Documents/DL2021/tensorflow_test/tftest.py:91) ]] [Op:__inference_train_function_953]

Function call stack:
train_function

我的GPU是Geforce RTX3060,CUDA版本是114.4。我已经尝试重新构建环境。这是我的一些包列表。谢谢!

# packages in environment at /home/benny/anaconda3/envs/tf:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main  
_openmp_mutex             4.5                       1_gnu  
_tflow_select             2.1.0                       gpu  
absl-py                   0.13.0           py39h06a4308_0  
aiohttp                   3.7.4.post0      py39h7f8727e_2  
argon2-cffi               20.1.0           py39h27cfd23_1  
astor                     0.8.1            py39h06a4308_0  
astunparse                1.6.3                      py_0  
async-timeout             3.0.1            py39h06a4308_0  
async_generator           1.10               pyhd3eb1b0_0  
attrs                     21.2.0             pyhd3eb1b0_0  
backcall                  0.2.0              pyhd3eb1b0_0  
blas                      1.0                         mkl  
bleach                    4.0.0              pyhd3eb1b0_0  
blinker                   1.4              py39h06a4308_0  
brotlipy                  0.7.0           py39h27cfd23_1003  
c-ares                    1.17.1               h27cfd23_0  
ca-certificates           2021.7.5             h06a4308_1  
cachetools                4.2.2              pyhd3eb1b0_0  
certifi                   2021.5.30        py39h06a4308_0  
cffi                      1.14.6           py39h400218f_0  
chardet                   4.0.0           py39h06a4308_1003  
charset-normalizer        2.0.4              pyhd3eb1b0_0  
click                     8.0.1              pyhd3eb1b0_0  
coverage                  5.5              py39h27cfd23_2  
cryptography              3.4.7            py39hd23ed53_0  
cudatoolkit               10.1.243             h6bb024c_0  
cudnn                     7.6.5                cuda10.1_0  
cupti                     10.1.168                      0  
cython                    0.29.24          py39h295c915_0  
dataclasses               0.8                pyh6d0b6a4_7  
dbus                      1.13.18              hb2f20db_0  
debugpy                   1.4.1            py39h295c915_0  
decorator                 5.0.9              pyhd3eb1b0_0  
defusedxml                0.7.1              pyhd3eb1b0_0  
entrypoints               0.3              py39h06a4308_0  
expat                     2.4.1                h2531618_2  
fontconfig                2.13.1               h6c09931_0  
freetype                  2.10.4               h5ab3b9f_0  
gast                      0.4.0              pyhd3eb1b0_0  
glib                      2.69.1               h5202010_0  
google-auth               1.33.0             pyhd3eb1b0_0  
google-auth-oauthlib      0.4.4              pyhd3eb1b0_0  
google-pasta              0.2.0              pyhd3eb1b0_0  
grpcio                    1.36.1           py39h2157cd5_1  
gst-plugins-base          1.14.0               h8213a91_2  
gstreamer                 1.14.0               h28cd5cc_2  
h5py                      2.10.0           py39hec9cf62_0  
hdf5                      1.10.6               hb1b8bf9_0  
icu                       58.2                 he6710b0_3  
idna                      3.2                pyhd3eb1b0_0  
importlib-metadata        4.8.1            py39h06a4308_0  
importlib_metadata        4.8.1                hd3eb1b0_0  
intel-openmp              2021.3.0          h06a4308_3350  
ipykernel                 6.2.0            py39h06a4308_1  
ipython                   7.27.0           py39hb070fc8_0  
ipython_genutils          0.2.0              pyhd3eb1b0_1  
ipywidgets                7.6.4              pyhd3eb1b0_0  
jedi                      0.18.0           py39h06a4308_1  
jinja2                    3.0.1              pyhd3eb1b0_0  
joblib                    1.0.1              pyhd8ed1ab_0    conda-forge
jpeg                      9d                   h7f8727e_0  
jsonschema                3.2.0              pyhd3eb1b0_2  
jupyter                   1.0.0            py39h06a4308_7  
jupyter_client            7.0.1              pyhd3eb1b0_0  
jupyter_console           6.4.0              pyhd3eb1b0_0  
jupyter_core              4.7.1            py39h06a4308_0  
jupyterlab_pygments       0.1.2                      py_0  
jupyterlab_widgets        1.0.0              pyhd3eb1b0_1  
keras-preprocessing       1.1.2              pyhd3eb1b0_0  
ld_impl_linux-64          2.35.1               h7274673_9  
libblas                   3.9.0            11_linux64_mkl    conda-forge
libcblas                  3.9.0            11_linux64_mkl    conda-forge
libffi                    3.3                  he6710b0_2  
libgcc-ng                 9.3.0               h5101ec6_17  
libgfortran-ng            7.5.0               ha8ba4b0_17  
libgfortran4              7.5.0               ha8ba4b0_17  
libgomp                   9.3.0               h5101ec6_17  
libpng                    1.6.37               hbc83047_0  
libprotobuf               3.17.2               h4ff587b_1  
libsodium                 1.0.18               h7b6447c_0  
libstdcxx-ng              9.3.0               hd4cf53a_17  
libuuid                   1.0.3                h1bed415_2  
libxcb                    1.14                 h7b6447c_0  
libxml2                   2.9.12               h03d6c58_0  
markdown                  3.3.4            py39h06a4308_0  
markupsafe                2.0.1            py39h27cfd23_0  
matplotlib-inline         0.1.2              pyhd3eb1b0_2  
mistune                   0.8.4           py39h27cfd23_1000  
mkl                       2021.3.0           h06a4308_520  
mkl-service               2.4.0            py39h7f8727e_0  
mkl_fft                   1.3.0            py39h42c9631_2  
mkl_random                1.2.2            py39h51133e4_0  
multidict                 5.1.0            py39h27cfd23_2  
nbclient                  0.5.3              pyhd3eb1b0_0  
nbconvert                 6.1.0            py39h06a4308_0  
nbformat                  5.1.3              pyhd3eb1b0_0  
ncurses                   6.2                  he6710b0_1  
nest-asyncio              1.5.1              pyhd3eb1b0_0  
notebook                  6.4.3            py39h06a4308_0  
numpy                     1.20.3           py39hf144106_0  
numpy-base                1.20.3           py39h74d4b33_0  
oauthlib                  3.1.1              pyhd3eb1b0_0  
openssl                   1.1.1l               h7f8727e_0  
opt_einsum                3.3.0              pyhd3eb1b0_1  
packaging                 21.0               pyhd3eb1b0_0  
pandocfilters             1.4.3            py39h06a4308_1  
parso                     0.8.2              pyhd3eb1b0_0  
pcre                      8.45                 h295c915_0  
pexpect                   4.8.0              pyhd3eb1b0_3  
pickleshare               0.7.5           pyhd3eb1b0_1003  
pip                       21.2.4           py37h06a4308_0  
prometheus_client         0.11.0             pyhd3eb1b0_0  
prompt-toolkit            3.0.17             pyhca03da5_0  
prompt_toolkit            3.0.17               hd3eb1b0_0  
protobuf                  3.17.2           py39h295c915_0  
ptyprocess                0.7.0              pyhd3eb1b0_2  
pyasn1                    0.4.8              pyhd3eb1b0_0  
pyasn1-modules            0.2.8                      py_0  
pycparser                 2.20                       py_2  
pygments                  2.10.0             pyhd3eb1b0_0  
pyjwt                     2.1.0            py39h06a4308_0  
pyopenssl                 20.0.1             pyhd3eb1b0_1  
pyparsing                 2.4.7              pyhd3eb1b0_0  
pyqt                      5.9.2            py39h2531618_6  
pyrsistent                0.18.0           py39h7f8727e_0  
pysocks                   1.7.1            py39h06a4308_0  
python                    3.9.7                h12debd9_1  
python-dateutil           2.8.2              pyhd3eb1b0_0  
python-flatbuffers        1.12               pyhd3eb1b0_0  
python_abi                3.9                      2_cp39    conda-forge
pyzmq                     22.2.1           py39h295c915_1  
qt                        5.9.7                h5867ecd_1  
qtconsole                 5.1.1              pyhd3eb1b0_0  
qtpy                      1.10.0             pyhd3eb1b0_0  
readline                  8.1                  h27cfd23_0  
requests                  2.26.0             pyhd3eb1b0_0  
requests-oauthlib         1.3.0                      py_0  
rsa                       4.7.2              pyhd3eb1b0_1  
scikit-learn              0.24.2           py39h4dfa638_0    conda-forge
scipy                     1.7.1            py39h292c36d_2  
send2trash                1.8.0              pyhd3eb1b0_1  
setuptools                58.0.4           py39h06a4308_0  
sip                       4.19.13          py39h2531618_0  
six                       1.16.0             pyhd3eb1b0_0  
sqlite                    3.36.0               hc218d9a_0  
tensorboard               2.4.0              pyhc547734_0  
tensorboard-plugin-wit    1.6.0                      py_0  
tensorflow                2.4.1           gpu_py39h8236f22_0  
tensorflow-base           2.4.1           gpu_py39h29c2da4_0  
tensorflow-estimator      2.6.0              pyh7b7c402_0  
tensorflow-gpu            2.4.1                h30adc30_0  
termcolor                 1.1.0            py39h06a4308_1  
terminado                 0.9.4            py39h06a4308_0  
testpath                  0.5.0              pyhd3eb1b0_0  
threadpoolctl             2.2.0              pyh8a188c0_0    conda-forge
tk                        8.6.11               h1ccaba5_0  
tornado                   6.1              py39h27cfd23_0  
tqdm                      4.62.2             pyhd3eb1b0_1  
traitlets                 5.1.0              pyhd3eb1b0_0  
typing-extensions         3.10.0.2             hd3eb1b0_0  
typing_extensions         3.10.0.2           pyh06a4308_0  
tzdata                    2021a                h5d7bf9c_0  
urllib3                   1.26.6             pyhd3eb1b0_1  
wcwidth                   0.2.5              pyhd3eb1b0_0  
webencodings              0.5.1            py39h06a4308_1  
werkzeug                  2.0.1              pyhd3eb1b0_0  
wheel                     0.37.0             pyhd3eb1b0_1  
widgetsnbextension        3.5.1            py39h06a4308_0  
wrapt                     1.12.1           py39he8ac12f_1  
xz                        5.2.5                h7b6447c_0  
yarl                      1.6.3            py39h27cfd23_0  
zeromq                    4.3.4                h2531618_0  
zipp                      3.5.0              pyhd3eb1b0_0  
zlib                      1.2.11               h7b6447c_3  
1个回答

1
这可能是您使用的软件包版本存在问题。Tensorflow官方网站表示,tensorflow 2.4仅与python 3.8兼容。
根据您的环境版本,看起来您正在使用tensorflow 2.4.1python 3.9
尝试将您的python版本降级到3.8。

Python的版本为什么会对cuDNN产生影响? - Dr. Snoopy
我尝试了,但是仍然出现相同的问题。 - 李丞恩

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接