我收到有关错误的错误: Can't find libdevice directory ${CUDA_DIR}/nvvm/libdevice in tensorflow object_detection api

Shu*_*Fan 6 python cuda tensorflow tensorflow2.0

Windows版本:Windows 10 Pro 21H2 19044.1706 GPU:rtx2070

import tensorflow as tf
import torch
print(torch.__version__) #1.10.1+cu113
print(torch.version.cuda) #11.3
print(tf.__version__) #2.9.1
Run Code Online (Sandbox Code Playgroud)

我跑

python .\object_detection\builders\model_builder_tf2_test.py
Run Code Online (Sandbox Code Playgroud)

我可以获得“在 18.279 秒内进行 24 次测试,正常(跳过 = 1)”结果;

但是当我想训练我的模型时,我使用

feature_extractor {
   type: 'faster_rcnn_inception_resnet_v2_keras'
}
Run Code Online (Sandbox Code Playgroud)

在我的 pipeline_config 中,我运行

python .\object_detection\model_main_tf2.py --logtostderr --pipeline_config_path=LOCATION_OF_MY_PIPECONFIG --model_dir=LOCATION_OF_MY_MODEL_DIR
Run Code Online (Sandbox Code Playgroud)

然后我收到以下错误 在此输入图像描述 在我的系统环境变量中,“CUDA_DIR”是变量并且可以访问

小智 11

我遇到了同样的问题,刚刚修复了它。即使您设置了“CUDA_DIR”,库也找不到该文件夹​​,因为它没有使用该变量或我尝试过的任何其他变量。这篇文章有助于理解这个问题。我能找到的唯一解决方案就是复制所需的文件。

快速修复的步骤:

  1. 找到 CUDA nvvm 的安装位置(对我来说是“C:\Program Files\NVIDIA GPU Compute Toolkit\CUDA\v11.6”)。
  2. 找到脚本的工作目录(运行脚本的环境或目录)。
  3. 将整个 nvvm 文件夹复制到工作目录中,您的脚本应该可以工作。

这不是一个很好的解决方案,但在其他人发布答案之前,您至少可以运行您的代码。