TensorFlow使用中的常见问题

安装指定版本的TensorFlow

1
2
3
4
# 安装cpu版本
pip install tensorflow==1.2.1
# 给特定用户安装gpu版本
pip install tensorflow-gpu==1.2.1 --user

找不到模型文件 / 用于初始化的预训练文件

perhaps your file is in a different file format and you need to use a different restore operator?

解决方法类似这里, 即设置的目录不是checkpoint文件所在目录, 还需要把Checkpoint的前缀(prefix)作为目录名的一部分.

例如名为myModel.ckpt.data-00000-of-00001和其相关的index等checkpoint文件一起放在~/model/文件夹下, 则传入的TensorFlow的参数需要设置为~/model/myModel.ckpt, 而不是/model/

AttributeError: ‘module’ object has no attribute ‘computation’

pd.computation.expressions.set_use_numexpr(False)

很可能是当前包为0.13.0,需要更新到0.15.0+,更新dask包到最新,

1
pip install dask

Couldn’t open CUDA library libcupti.so.8.0

解决办法

export LD_LIBRARY_PATH=/usr/local/cuda/extras/CUPTI/lib64:$LD_LIBRARY_PATH

Dst tensor is not initialized

一般是由于 GPU 显存已满, tensor 无法初始化造成的.