Google Colab 加载运行时 CuDNN 库:8.0.5 但源代码编译时使用:8.1.0

Google Colab Loaded runtime CuDNN library: 8.0.5 but source was compiled with: 8.1.0

在 Google Collab 中使用 Tensorflow 2 对象检测 API 进行训练时,出现以下错误:

2022-03-07 15:27:51.475298: E tensorflow/stream_executor/cuda/cuda_dnn.cc:359] Loaded runtime CuDNN library: 8.0.5 but source was compiled with: 8.1.0.  CuDNN library needs to have matching major version and equal or higher minor version. If using a binary install, upgrade your CuDNN library.  If building from sources, make sure the library loaded at runtime is compatible with the version specified during compile configuration.
2022-03-07 15:27:51.477142: W tensorflow/core/framework/op_kernel.cc:1745] OP_REQUIRES failed at conv_ops.cc:1120 : UNKNOWN: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.

我尝试在 Google collab 中更新我的 CuDNN 库,使用这个 Whosebug 答案: Loaded runtime CuDNN library: 8.0.5 but source was compiled with: 8.1.0. when using google colab。 但是,这并不能解决问题。

我正在使用 Tensorflow 2.7.0。

以下是问题的解决方法,如官方发布的Github

这可能并不总是有效,也可能不安全,但作为暂时的解决方法,您可以尝试 运行 !apt install --allow-change-held-packages libcudnn8=8.1.0.77-1+cuda11.2