python - TensorFlow 2.1 调用 cuInit : UNKNOWN ERROR (303) 失败

标签 python python-3.x tensorflow python-3.7 tensorflow2.0

我是 TensorFlow 初学者,在尝试加载已保存的模型时遇到以下问题。

我正在关注本教程:https://youtu.be/6g4O5UOH304?t=7532

在视频中的那个点运行代码时,我遇到了这个错误:

2020-02-03 08:59:24.589058: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2020-02-03 08:59:24.589234: E tensorflow/stream_executor/cuda/cuda_driver.cc:351] failed call to cuInit: UNKNOWN ERROR (303)


Traceback (most recent call last):
  File "C:/Users/btu/PycharmProjects/Chatbot/venv/testMovieReviews.py", line 53, in <module>
    encode = review_encode(nline)
  File "C:/Users/btu/PycharmProjects/Chatbot/venv/testMovieReviews.py", line 41, in review_encode
    encoded.append(word_index[word])
KeyError: 'Of'

TF 版本:TensorFlow 2.1

操作系统:Windows 10

CPU:Intel Core i7-2600 CPU(根据我的搜索,它支持AVX)

显卡:AMD RADEON HD 6450

语言:Python 3.7

IDE:Pycharm 2019.3.1

我很困惑,因为这个错误的先前线程似乎出现在 Nvidia 显卡上,但我没有运行。

最佳答案

我在我的电脑(win 10)上也遇到了和你一样的错误,但我的程序可以继续运行。

所以,你的问题不是“调用cuInit失败:未知错误(303)”,看来你的代码有一些KeyError。您应该首先检查您的代码。

简单的例子:

    tf> python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

    2020-04-29 09:22:01.959213: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found

    2020-04-29 09:22:01.962833: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

    2020-04-29 09:22:09.075191: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found

    2020-04-29 09:22:09.079202: E tensorflow/stream_executor/cuda/cuda_driver.cc:351] failed call to cuInit: UNKNOWN ERROR (303)
    .....

   tf.Tensor(-101.936615, shape=(), dtype=float32)    <=== This is the output and ignore the previous error info

此外,请引用here更多细节。

关于python - TensorFlow 2.1 调用 cuInit : UNKNOWN ERROR (303) 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60041399/

相关文章:

python - 如何获得 gtkDialog 对空格键触发的默认响应

python - TensorFlow:如何有效地训练每一层都需要馈送的网络?

python - 如果我取随机整数,如何除无余数?

machine-learning - 在 Tensorflow 中切片稀疏张量?

tensorflow - tensorflow安装的速度基准测试

python - TypeError : must be string or buffer, not int:执行 sqlAlchemy 查询时

python - 将应用名称导入项目 urls.py Django

php - 调用Python脚本*使用从php导入的非标准库*

python子进程多个stdin.write和stdout.read

python - 填充数据框列Python中的缺失值