zoukankan      html  css  js  c++  java
  • TensorFlow MNIST 问题解决

    TensorFlow MNIST 问题解决

    一、数据集下载错误

    错误:IOError: [Errno socket error] [Errno 101] Network is unreachable

    A: 手动下载:
    http://yann.lecun.com/exdb/mnist/
    下面的四个包

    train-images-idx3-ubyte.gz: training set images (9912422 bytes)
    train-labels-idx1-ubyte.gz: training set labels (28881 bytes)
    t10k-images-idx3-ubyte.gz: test set images (1648877 bytes)
    t10k-labels-idx1-ubyte.gz: test set labels (4542 bytes)

    B: 将下载到的包拷贝到如下目录(注意新版本已经不是之前的MNIST_data 目录了)

    cp *.gz /tmp/tensorflow/mnist/input_data/

    二、不能运行

    错误: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX0.9166

    A: 零时解决办法

    mnist_softmax.py 中加入如下代码:

    在 import sys 后加入如下代码

    import os
    os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
    import tensorflow as tf
    

    如果出现如下警告: 'TF_CPP_MIN_LOG_LEVEL' represents the Tensorflow environment variable responsible for logging.
    则 在ubuntu 上执行如下:

    export TF_CPP_MIN_LOG_LEVEL=2

    B: 彻底解决此问题

    (1)卸载已安装的tensorflow

    sudo pip uninstall tensorflow

    (2) 用下面的命令重新编译 tensorflow

    GPU & CPU

    bazel build -c opt --copt=-march=native --copt=-mfpmath=both --config=cuda -k //tensorflow/tools/pip_package:build_pip_package

    仅CPU

    bazel build -c opt --copt=-march=native --copt=-mfpmath=both -k //tensorflow/tools/pip_package:build_pip_package

    (3)生成安装包

    bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg

    (4) 安装

    sudo -H pip install /tmp/tensorflow_pkg/tensorflow-1.4.0-cp27-cp27mu-linux_x86_64.whl

    参考:
    https://stackoverflow.com/questions/42463594/cpu-instructions-not-compiled-with-tensorflow

    三、 安装TensorFlow时出现警告

    安装命令:

    sudo pip install /tmp/tensorflow_pkg/tensorflow-1.4.0-cp27-cp27mu-linux_x86_64.whl

    警告:

    The directory '/home/dyufei/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

    解决办法:

    用sudo -H 命令安装:

    sudo -H pip install /tmp/tensorflow_pkg/tensorflow-1.4.0-cp27-cp27mu-linux_x86_64.whl

    参考:https://stackoverflow.com/questions/33437798/osx-10-11-1-cant-install-gevent

  • 相关阅读:
    用word2010发个blog
    停止调试无法关闭控制台
    D11.5.8,Lingo中不支持AS3的ExternalInterface接口
    Lingo03 通用脚本和自定义handler
    Lingo01 术语
    Lingo09 Sprite
    Lingo动态创建script member
    tut11脚本基础
    诡异失败的导入对话框
    Lingo3D01 3D Cast Member的组成
  • 原文地址:https://www.cnblogs.com/dyufei/p/8041336.html
Copyright © 2011-2022 走看看