gpt4 book ai didi

没有 GPU 的机器上的 TENSORFLOW,无法仅在 CPU 上运行

转载 作者:行者123 更新时间:2023-12-03 16:43:28 24 4
gpt4 key购买 nike

我正在学习 Tensorflow(希望将其与我的聊天机器人集成)并希望运行此处的示例:

https://www.tensorflow.org/tutorials/recurrent

我下载了建议的存储库,安装了 tensorflow(现在是 cpu-only 版本,但也尝试了 --gpu),但遇到了这个问题:

 python ptb_word_lm.py --data_path=simple-examples/data/ --model=small --rnn_mode=basic
2017-09-21 17:38:09.856638: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-09-21 17:38:09.856685: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
Traceback (most recent call last):
File "ptb_word_lm.py", line 532, in <module>
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 48, in run
_sys.exit(main(_sys.argv[:1] + flags_passthrough))
File "ptb_word_lm.py", line 459, in main
% (len(gpus), FLAGS.num_gpus))
ValueError: Your machine has only 0 gpus which is less than the requested --num_gpus=1.

我的系统没有 CUDA GPU(嗯,它有,但是 CUDA 1.3,而不是 tensorflow 需要的 >=3),如何让示例代码在 cpu-only 模式下运行而不是仅仅退出?

最佳答案

您可以尝试将 gpu 的数量设置为您拥有的数量,即零。

python ptb_word_lm.py --data_path=simple-examples/data/ --model=small --rnn_mode=basic --num_gpus=0

我从错误消息中收集到了这个:
ValueError: Your machine has only 0 gpus which is less than the requested --num_gpus=1.

由于您只有 0 gpus 您需要明确设置该命令行参数,因为默认值假定为 1当您使用 gpu 软件包时。

关于没有 GPU 的机器上的 TENSORFLOW,无法仅在 CPU 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46348418/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com