国产xxxx99真实实拍_久久不雅视频_高清韩国a级特黄毛片_嗯老师别我我受不了了小说

資訊專欄INFORMATION COLUMN

TensorFlow 安裝筆記

2bdenny / 3140人閱讀

摘要:而且我們可以看到他自動幫我們安裝了,,等等需要注意的是最后會出現這里選擇才能把加入環境變量中,然后才能使用不然之后就得手動配置。來安裝支持的。步驟中下載太慢了,需要個小時,還是直接在線安裝吧,先下載這個,然后這個只需要分鐘左右。

前言

最近上了幾門深度學習的公開課,還是覺得不過癮,總覺得要搞一個框架來試試。那么caffe,tensorflow,torch等等選哪一個呢?經過一番比較我還是選擇tensorflow,首先他是一個更通用的框架,而且對python支持最好,其次還有google支持,也是開源的,相信在未來無論是學術界還是工業界,他都會流行起來的。

安裝-實況記錄

首先得在我的電腦(win10)上裝一個雙系統(不裝虛擬機是因為虛擬機對顯卡等資源的利用不是很好),就裝一個ubuntu吧(版本14.10),怎么裝就不寫了,畢竟網上一大把,然后就是安裝tensorflow了,官網提供了5種安裝辦法,基于pip,基于docker,基于Anaconda,基于Virtualenv,基于源碼。由于Anaconda包含了眾多的科學計算庫,相信對未來的工作能大有用處,所以我就選擇了基于Anaconda的安裝方式。

1.首先在這里選擇相應的Anaconda版本下載。

2.進入下載目錄,輸入命令 bash Anaconda2-4.1.1-Linux-x86_64.sh

然后根據提示進行安裝,他會提示安裝目錄等。而且我們可以看到他自動幫我們安裝了python2.7.12,beautifulsoup,ipython等等:

installing: python-2.7.12-1 ...
installing: _nb_ext_conf-0.2.0-py27_0 ...
installing: alabaster-0.7.8-py27_0 ...
installing: anaconda-client-1.4.0-py27_0 ...
installing: anaconda-navigator-1.2.1-py27_0 ...
installing: argcomplete-1.0.0-py27_1 ...
installing: astropy-1.2.1-np111py27_0 ...
installing: babel-2.3.3-py27_0 ...
installing: backports-1.0-py27_0 ...
installing: backports_abc-0.4-py27_0 ...
installing: beautifulsoup4-4.4.1-py27_0 ...

需要注意的是最后會出現:

Do you wish the installer to prepend the Anaconda2 install location
to PATH in your /root/.bashrc ? [yes|no]

這里選擇yes才能把anaconda加入環境變量(path)中,然后才能使用,不然之后就得手動配置path。由于修改了環境變量,所以打開一個新的終端來測試安裝結果:在新的終端中輸入python,顯示:

Python 2.7.12 |Anaconda 4.1.1 (64-bit)| (default, Jul  2 2016, 17:42:40) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org

可見的確是安裝成功了。

3.conda create -n tensorflow python=2.7 來建立一個conda 計算環境

4.source activate tensorflow 來激活計算環境。

5.pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.8.0rc0-cp27-none-linux_x86_64.whl 來安裝支持GPU的tensorflow。

需要注意,支持GPU要先安裝Cuda Toolkit 和 CUDNN Toolkit(先在官網注冊)

6.安裝成功后打開python,

import tensorflow as tf

然后報了一堆錯:

Traceback (most recent call last):
  File "", line 1, in 
  File "/root/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/__init__.py", line 23, in 
    from tensorflow.python import *
  File "/root/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 45, in 
    from tensorflow.python import pywrap_tensorflow
  File "/root/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in 
    _pywrap_tensorflow = swig_import_helper()
  File "/root/anaconda2/envs/tensorflow/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
    _mod = imp.load_module("_pywrap_tensorflow", fp, pathname, description)
ImportError: libcudart.so.7.5: cannot open shared object file: No such file or directory

看樣子是我還沒有安裝好cuda所致。步驟5中下載Cuda Toolkit 太慢了,需要10個小時,還是直接在線安裝吧,先下載這個,然后

dpkg -i cuda-repo-ubuntu1410_7.0-28_amd64.deb 
apt-get update
apt-get install cuda 

這個只需要20分鐘左右。安裝好過后cuda應該就在/usr/local/路徑下了。然后安裝CUDNN Toolkit,進入其下載目錄:

tar xvzf cudnn-7.0-linux-x64-v3.0-prod.tgz
cp cuda/include/cudnn.h  /usr/local/cuda/include
cp cuda/lib64/libcudnn* /usr/local/cuda/lib64

然后設置 LD_LIBRARY_PATH 和 CUDA_HOME 環境變量. 可以將下面的命令 添加到 ~/.bashrc文件中, 這樣每次登陸后自動生效:

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64"
export CUDA_HOME=/usr/local/cuda

7.測試

測試之時發現依然報上面的錯。libcudart.so.7.5沒找到,我先在磁盤上查找這個文件,locate libcudart.so.7.5,果然沒有,應該是我的cuda版本低了吧,cd /usr/local/cuda/lib64,然后果然發現了libcudart.so.7.0.28,而不是 libcudart.so.7.5

8.重裝Cuda Toolkit

apt-get remove cuda
apt-get autoremove
#下載http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb
apt-get remove cuda-repo-ubuntu1410
dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb#正試圖覆蓋 /etc/apt/sources.list.d/cuda.list,它同時被包含于軟件包 cuda-repo-ubuntu1410 7.0-28,所以必須要上一步
apt-get update
sudo apt-get install cuda
#報錯:cuda : 依賴: cuda-7-5 (= 7.5-18) 但是它將不會被安裝 
#E: 無法修正錯誤,因為您要求某些軟件包保持現狀,就是它們破壞了軟件包間的依賴關系。

太亂了,還是重頭來過吧

同上

同上

conda create -n tensor python=2.7

source activate tensor

安裝Cuda Toolkit,先下載,進入目錄:

dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb
apt-get update
apt-get install cuda
#報錯:cuda : 依賴: cuda-7-5 (= 7.5-18) 但是它將不會被安裝 
#E: 無法修正錯誤,因為您要求某些軟件包保持現狀,就是它們破壞了軟件包間的依賴關系。
#也是醉了

裝錯了版本真是麻煩,清理一下系統吧

apt-get --purge remove nvidia-*  #徹底卸載nvidia
rm -rf anaconda2
# .bashrc文件中刪除關于把anaconda加入環境變量的那一句
#還是不行,依舊報錯:cuda : 依賴: cuda-7-5 (= 7.5-18) 但是它將不會被安裝 
#E: 無法修正錯誤,因為您要求某些軟件包保持現狀,就是它們破壞了軟件包間的依賴關系。

搞不定了,還是換成本地安裝試試吧,下載cuda 和 cudnn。奇怪:ubuntu下載很慢,但是windows上就快好多了,在windows上下好直接在ubuntu中拷貝過去吧。

安裝-無bug版 1.

由于包依賴問題沒法解決,重裝了系統Ubuntu14.04.5

2.

下載cuda 和cudnn,進入下載目錄

dpkg -i cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
sudo apt-get update
sudo apt-get install cuda
#稍等片刻,然后配置cudnn
tar xvzf cudnn-7.5-linux-x64-v5.0-ga-tgz
cp cuda/include/cudnn.h /usr/local/cuda/include
cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
3.

修改 .bashrc 加入:

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
export CUDA_HOME=/usr/local/cuda
4.

下載Anaconda,進入下載目錄

bash Anaconda2-4.1.1-Linux-x86_64.sh
注意修改配置,根據你的喜好來修改目錄
5.

重新打開一個終端

conda create -n tfgpu python=2.7
source activate tfgpu
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0rc0-cp27-none-linux_x86_64.whl
6.

裝好過后,重啟,黑屏了。應該是雙顯卡的問題,不管了,先進入tty試試tensorflow是否裝好了。

Ctrl+Alt+F2#進入tty2,并登陸
root@mageek-ThinkPad-T550:~# source activate tfgpu
(tfgpu) root@mageek-ThinkPad-T550:~# python
Python 2.7.12 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:42:40) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
>>> import tensorflow as tf
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally
>>> sess = tf.Session()
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_init.cc:102] Found device 0 with properties: 
name: GeForce 940M
major: 5 minor: 0 memoryClockRate (GHz) 1.124
pciBusID 0000:08:00.0
Total memory: 1023.88MiB
Free memory: 997.54MiB
I tensorflow/core/common_runtime/gpu/gpu_init.cc:126] DMA: 0 
I tensorflow/core/common_runtime/gpu/gpu_init.cc:136] 0:   Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:839] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce 940M, pci bus id: 0000:08:00.0)
>>> 
(tfgpu) root@mageek-ThinkPad-T550:~# source deactivate
可見是安裝成功了
7. 解決黑屏
vim /etc/modprobe.d/blacklist.conf
#添加如下幾句來屏蔽一些軟件
blacklist amd76x_edac
blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv
#退出
sudo prime-select intel #優先intel集顯
reboot#重啟就進入圖像化界面了
8. IPython

這個時候直接用ipython 可以進入界面,但是沒法import tensorflow,要先安裝conda install ipython然后再次進入ipython,就可以了,因為只有執行了這個命令才能將ipython加入虛擬環境tfgpu,在同一個環境中ipython才能找到tensorflow。

9. IDE

雖然IPython已經比原生的python終端好多了,但是每次都要敲相同命令,比如import tensorflow as tf還是相當麻煩的,所以還是要搞一個IDE才行。這里推薦Komodo Edit,下載過后,解壓。進入目錄運行 ./install.sh 然后按照提示修改安裝目錄(注意要有權限)。比如我的目錄就是 /usr/local/Komodo-Edit-10/ 然后加入環境變量。這樣就可以重新打開一個終端,命令 komodo,就可以打開這個IDE了,然后配置一些基本的選項比如縮進,配色方案等等就可以正式使用了。

新建一個 tf1.py:

import tensorflow as tf
import numpy as np

# Create 100 phony x, y data points in NumPy, y = x * 0.1 + 0.3
x_data = np.random.rand(100).astype(np.float32)
y_data = x_data * 0.1 + 0.3

# Try to find values for W and b that compute y_data = W * x_data + b
# (We know that W should be 0.1 and b 0.3, but TensorFlow will
# figure that out for us.)
W = tf.Variable(tf.random_uniform([1], -1.0, 1.0))
b = tf.Variable(tf.zeros([1]))
y = W * x_data + b

# Minimize the mean squared errors.
loss = tf.reduce_mean(tf.square(y - y_data))
optimizer = tf.train.GradientDescentOptimizer(0.5)
train = optimizer.minimize(loss)

# Before starting, initialize the variables.  We will "run" this first.
init = tf.initialize_all_variables()

# Launch the graph.
sess = tf.Session()
sess.run(init)

# Fit the line.
for step in range(201):
    sess.run(train)
    if step % 20 == 0:
        print(step, sess.run(W), sess.run(b))

# Learns best fit is W: [0.1], b: [0.3]

運行:

#進入文件目錄
source activate tfgpu
python tf1.py

結果:

I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_init.cc:102] Found device 0 with properties: 
name: GeForce 940M
major: 5 minor: 0 memoryClockRate (GHz) 1.124
pciBusID 0000:08:00.0
Total memory: 1023.88MiB
Free memory: 997.54MiB
I tensorflow/core/common_runtime/gpu/gpu_init.cc:126] DMA: 0 
I tensorflow/core/common_runtime/gpu/gpu_init.cc:136] 0:   Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:839] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce 940M, pci bus id: 0000:08:00.0)
(0, array([-0.09839484], dtype=float32), array([ 0.5272761], dtype=float32))
(20, array([ 0.02831561], dtype=float32), array([ 0.33592272], dtype=float32))
(40, array([ 0.07941294], dtype=float32), array([ 0.31031665], dtype=float32))
(60, array([ 0.09408762], dtype=float32), array([ 0.30296284], dtype=float32))
(80, array([ 0.09830203], dtype=float32), array([ 0.3008509], dtype=float32))
(100, array([ 0.09951238], dtype=float32), array([ 0.30024436], dtype=float32))
(120, array([ 0.09985995], dtype=float32), array([ 0.3000702], dtype=float32))
(140, array([ 0.09995978], dtype=float32), array([ 0.30002016], dtype=float32))
(160, array([ 0.09998845], dtype=float32), array([ 0.30000579], dtype=float32))
(180, array([ 0.09999669], dtype=float32), array([ 0.30000168], dtype=float32))
(200, array([ 0.09999905], dtype=float32), array([ 0.30000049], dtype=float32))
10.NN
#找到tensorflow的目錄
python -c "import os; import inspect; import tensorflow; print(os.path.dirname(inspect.getfile(tensorflow)))"
#/root/anaconda2/envs/tfgpu/lib/python2.7/site-packages/tensorflow
cd /root/anaconda2/envs/tfgpu/lib/python2.7/site-packages/tensorflow/models/image/mnist/#j進入目錄
python convolutional.py
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library    libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally
Extracting data/train-images-idx3-ubyte.gz
Traceback (most recent call last):
  File "convolutional.py", line 326, in 
    tf.app.run()
  File "/root/anaconda2/envs/tfgpu/lib/python2.7/site-packages/tensorflow/python/platform/app.py", line 30, in run
    sys.exit(main(sys.argv))
  File "convolutional.py", line 138, in main
    train_data = extract_data(train_data_filename, 60000)
  File "convolutional.py", line 85, in extract_data
    buf = bytestream.read(IMAGE_SIZE * IMAGE_SIZE * num_images * NUM_CHANNELS)
  File "/root/anaconda2/envs/tfgpu/lib/python2.7/gzip.py", line 268, in read
    self._read(readsize)
  File "/root/anaconda2/envs/tfgpu/lib/python2.7/gzip.py", line 315, in _read
    self._read_eof()
  File "/root/anaconda2/envs/tfgpu/lib/python2.7/gzip.py", line 354, in _read_eof
    hex(self.crc)))
IOError: CRC check failed 0x4b01c89e != 0xd2b9b600L

看來是CRC校驗出錯,還是直接去官網下載吧,然后直接拷貝到data路徑中。讀一下convolutional.py就知道下載路徑了,其實比較一下data里程序已經下載的文件和官網的文件就知道程序下載的文件出錯了,文件小了不少,應該是丟包了。
再次執行:

I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally
Extracting data/train-images-idx3-ubyte.gz
Extracting data/train-labels-idx1-ubyte.gz
Extracting data/t10k-images-idx3-ubyte.gz
Extracting data/t10k-labels-idx1-ubyte.gz
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_init.cc:102] Found device 0 with properties: 
name: GeForce 940M
major: 5 minor: 0 memoryClockRate (GHz) 1.124
pciBusID 0000:08:00.0
Total memory: 1023.88MiB
Free memory: 997.54MiB
I tensorflow/core/common_runtime/gpu/gpu_init.cc:126] DMA: 0 
I tensorflow/core/common_runtime/gpu/gpu_init.cc:136] 0:   Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:839] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce 940M, pci bus id: 0000:08:00.0)
Initialized!
E tensorflow/stream_executor/cuda/cuda_dnn.cc:347] Loaded runtime CuDNN library: 5005 (compatibility version 5000) but source was compiled with 4007 (compatibility version 4000).  If using a binary install, upgrade your CuDNN library to match.  If building from sources, make sure the library loaded at runtime matches a compatible version specified during compile configuration.
F tensorflow/core/kernels/conv_ops.cc:457] Check failed: stream->parent()->GetConvolveAlgorithms(&algorithms) 
Aborted (core dumped)

意思就是cudnn我安裝的是v5,但是cuda7.5支持的是v4,所以就去下載v4,然后按照步驟2來重新配置cudnnv4:

#這里會覆蓋cudnnv5,所以記得備份cudnnv5,萬一用得上,我把原來解壓的cuda改為cudnn5005
cd /usr/local/cuda/lib64
rm -f libcudnn* #刪掉cudnnv5
#先進入cudnnv4下載目錄
tar xvzf cudnn-7.0-linux-x64-v4.0-prod.tgz
cp cuda/include/cudnn.h /usr/local/cuda/include#用v4覆蓋v5
cp cuda/lib64/libcudnn* /usr/local/cuda/lib64#加入v4
chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

再次執行:

cd /root/anaconda2/envs/tfgpu/lib/python2.7/site-packages/tensorflow/models/image/mnist/#j進入目錄
python convolutional.py

結果:

I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally
Extracting data/train-images-idx3-ubyte.gz
Extracting data/train-labels-idx1-ubyte.gz
Extracting data/t10k-images-idx3-ubyte.gz
Extracting data/t10k-labels-idx1-ubyte.gz
E tensorflow/stream_executor/cuda/cuda_driver.cc:491] failed call to cuInit: CUDA_ERROR_NO_DEVICE
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:153] retrieving CUDA diagnostic information for host: mageek-ThinkPad-T550
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:160] hostname: mageek-ThinkPad-T550
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:185] libcuda reported version is: 352.63.0
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:356] driver version file contents: """NVRM version: NVIDIA UNIX x86_64 Kernel Module  352.63  Sat Nov  7 21:25:42 PST 2015
GCC version:  gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3) 
"""
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:189] kernel reported version is: 352.63.0
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:293] kernel version seems to match DSO: 352.63.0
I tensorflow/core/common_runtime/gpu/gpu_init.cc:81] No GPU devices available on machine.
Initialized!
Step 0 (epoch 0.00), 5.4 ms
Minibatch loss: 12.054, learning rate: 0.010000
Minibatch error: 90.6%
Validation error: 84.6%
Step 100 (epoch 0.12), 280.2 ms
Minibatch loss: 3.287, learning rate: 0.010000
Minibatch error: 6.2%
Validation error: 7.0%
Step 200 (epoch 0.23), 281.0 ms
Minibatch loss: 3.491, learning rate: 0.010000
Minibatch error: 12.5%
Validation error: 3.6%
Step 300 (epoch 0.35), 281.0 ms
Minibatch loss: 3.265, learning rate: 0.010000
Minibatch error: 10.9%
Validation error: 3.2%
Step 400 (epoch 0.47), 293.0 ms
Minibatch loss: 3.221, learning rate: 0.010000
Minibatch error: 7.8%
Validation error: 2.7%
Step 500 (epoch 0.58), 289.0 ms
Minibatch loss: 3.292, learning rate: 0.010000
Minibatch error: 7.8%
Validation error: 2.7%
Step 600 (epoch 0.70), 287.4 ms
Minibatch loss: 3.227, learning rate: 0.010000
Minibatch error: 7.8%
Validation error: 2.6%
Step 700 (epoch 0.81), 287.0 ms
Minibatch loss: 3.015, learning rate: 0.010000
Minibatch error: 3.1%
Validation error: 2.4%
Step 800 (epoch 0.93), 287.0 ms
Minibatch loss: 3.152, learning rate: 0.010000
Minibatch error: 6.2%
Validation error: 2.0%
Step 900 (epoch 1.05), 287.7 ms
Minibatch loss: 2.938, learning rate: 0.009500
Minibatch error: 3.1%
Validation error: 1.6%
Step 1000 (epoch 1.16), 287.4 ms
Minibatch loss: 2.862, learning rate: 0.009500
Minibatch error: 1.6%
Validation error: 1.7%
.
.
.

可見程序是跑起來了,但是沒有找到GPU,

reboot
#.....
source activate tfgpu
cd /root/anaconda2/envs/tfgpu/lib/python2.7/site-packages/tensorflow/models/image/mnist/#j進入目錄
python convolutional.py

結果:

I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally
Extracting data/train-images-idx3-ubyte.gz
Extracting data/train-labels-idx1-ubyte.gz
Extracting data/t10k-images-idx3-ubyte.gz
Extracting data/t10k-labels-idx1-ubyte.gz
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:925] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
I tensorflow/core/common_runtime/gpu/gpu_init.cc:102] Found device 0 with properties: 
name: GeForce 940M
major: 5 minor: 0 memoryClockRate (GHz) 1.124
pciBusID 0000:08:00.0
Total memory: 1023.88MiB
Free memory: 997.54MiB
I tensorflow/core/common_runtime/gpu/gpu_init.cc:126] DMA: 0 
I tensorflow/core/common_runtime/gpu/gpu_init.cc:136] 0:   Y 
I tensorflow/core/common_runtime/gpu/gpu_device.cc:839] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce 940M, pci bus id: 0000:08:00.0)
Initialized!
Step 0 (epoch 0.00), 81.3 ms
Minibatch loss: 12.054, learning rate: 0.010000
Minibatch error: 90.6%
Validation error: 84.6%
Step 100 (epoch 0.12), 44.4 ms
Minibatch loss: 3.291, learning rate: 0.010000
Minibatch error: 6.2%
Validation error: 7.1%
Step 200 (epoch 0.23), 44.4 ms
Minibatch loss: 3.462, learning rate: 0.010000
Minibatch error: 12.5%
Validation error: 3.6%
Step 300 (epoch 0.35), 44.0 ms
Minibatch loss: 3.188, learning rate: 0.010000
Minibatch error: 4.7%
Validation error: 3.2%
Step 400 (epoch 0.47), 44.3 ms
Minibatch loss: 3.253, learning rate: 0.010000
Minibatch error: 9.4%
Validation error: 2.8%
Step 500 (epoch 0.58), 44.3 ms
Minibatch loss: 3.288, learning rate: 0.010000
Minibatch error: 9.4%
Validation error: 2.5%
Step 600 (epoch 0.70), 43.9 ms
Minibatch loss: 3.180, learning rate: 0.010000
Minibatch error: 6.2%
Validation error: 2.8%
Step 700 (epoch 0.81), 44.2 ms
Minibatch loss: 3.033, learning rate: 0.010000
Minibatch error: 3.1%
Validation error: 2.4%
Step 800 (epoch 0.93), 44.0 ms
Minibatch loss: 3.149, learning rate: 0.010000
Minibatch error: 6.2%
Validation error: 2.0%
Step 900 (epoch 1.05), 44.0 ms
Minibatch loss: 2.919, learning rate: 0.009500
Minibatch error: 3.1%
Validation error: 1.6%
Step 1000 (epoch 1.16), 43.8 ms
Minibatch loss: 2.849, learning rate: 0.009500
Minibatch error: 0.0%
Validation error: 1.7%
Step 1100 (epoch 1.28), 43.6 ms
Minibatch loss: 2.822, learning rate: 0.009500
Minibatch error: 0.0%
Validation error: 1.6%
Step 1200 (epoch 1.40), 43.6 ms
Minibatch loss: 2.979, learning rate: 0.009500
Minibatch error: 7.8%
Validation error: 1.5%
Step 1300 (epoch 1.51), 43.6 ms
Minibatch loss: 2.763, learning rate: 0.009500
Minibatch error: 0.0%
Validation error: 1.9%
Step 1400 (epoch 1.63), 43.6 ms
Minibatch loss: 2.781, learning rate: 0.009500
Minibatch error: 3.1%
Validation error: 1.5%
Step 1500 (epoch 1.75), 43.6 ms
Minibatch loss: 2.861, learning rate: 0.009500
Minibatch error: 6.2%
Validation error: 1.4%
Step 1600 (epoch 1.86), 43.8 ms
Minibatch loss: 2.698, learning rate: 0.009500
Minibatch error: 1.6%
Validation error: 1.3%
Step 1700 (epoch 1.98), 43.9 ms
Minibatch loss: 2.650, learning rate: 0.009500
Minibatch error: 0.0%
Validation error: 1.3%
Step 1800 (epoch 2.09), 44.1 ms
Minibatch loss: 2.652, learning rate: 0.009025
Minibatch error: 1.6%
Validation error: 1.3%
Step 1900 (epoch 2.21), 44.1 ms
Minibatch loss: 2.655, learning rate: 0.009025
Minibatch error: 1.6%
Validation error: 1.3%
Step 2000 (epoch 2.33), 43.9 ms
Minibatch loss: 2.640, learning rate: 0.009025
Minibatch error: 3.1%
Validation error: 1.2%
Step 2100 (epoch 2.44), 44.0 ms
Minibatch loss: 2.568, learning rate: 0.009025
Minibatch error: 0.0%
Validation error: 1.1%
Step 2200 (epoch 2.56), 44.0 ms
Minibatch loss: 2.564, learning rate: 0.009025
Minibatch error: 0.0%
Validation error: 1.1%
Step 2300 (epoch 2.68), 44.2 ms
Minibatch loss: 2.561, learning rate: 0.009025
Minibatch error: 1.6%
Validation error: 1.2%
Step 2400 (epoch 2.79), 44.2 ms
Minibatch loss: 2.500, learning rate: 0.009025
Minibatch error: 0.0%
Validation error: 1.3%
Step 2500 (epoch 2.91), 44.0 ms
Minibatch loss: 2.471, learning rate: 0.009025
Minibatch error: 0.0%
Validation error: 1.2%
Step 2600 (epoch 3.03), 43.8 ms
Minibatch loss: 2.451, learning rate: 0.008574
Minibatch error: 0.0%
Validation error: 1.2%
Step 2700 (epoch 3.14), 43.6 ms
Minibatch loss: 2.483, learning rate: 0.008574
Minibatch error: 1.6%
Validation error: 1.1%
Step 2800 (epoch 3.26), 43.7 ms
Minibatch loss: 2.426, learning rate: 0.008574
Minibatch error: 1.6%
Validation error: 1.1%
Step 2900 (epoch 3.37), 44.3 ms
Minibatch loss: 2.449, learning rate: 0.008574
Minibatch error: 3.1%
Validation error: 1.1%
Step 3000 (epoch 3.49), 43.9 ms
Minibatch loss: 2.395, learning rate: 0.008574
Minibatch error: 1.6%
Validation error: 1.0%
Step 3100 (epoch 3.61), 44.1 ms
Minibatch loss: 2.390, learning rate: 0.008574
Minibatch error: 3.1%
Validation error: 1.0%
Step 3200 (epoch 3.72), 43.6 ms
Minibatch loss: 2.330, learning rate: 0.008574
Minibatch error: 0.0%
Validation error: 1.1%
Step 3300 (epoch 3.84), 43.8 ms
Minibatch loss: 2.319, learning rate: 0.008574
Minibatch error: 1.6%
Validation error: 1.1%
Step 3400 (epoch 3.96), 44.4 ms
Minibatch loss: 2.296, learning rate: 0.008574
Minibatch error: 0.0%
Validation error: 1.0%
Step 3500 (epoch 4.07), 44.4 ms
Minibatch loss: 2.273, learning rate: 0.008145
Minibatch error: 0.0%
Validation error: 1.0%
Step 3600 (epoch 4.19), 44.2 ms
Minibatch loss: 2.253, learning rate: 0.008145
Minibatch error: 0.0%
Validation error: 0.9%
Step 3700 (epoch 4.31), 44.4 ms
Minibatch loss: 2.237, learning rate: 0.008145
Minibatch error: 0.0%
Validation error: 1.0%
Step 3800 (epoch 4.42), 43.8 ms
Minibatch loss: 2.234, learning rate: 0.008145
Minibatch error: 1.6%
Validation error: 0.9%
Step 3900 (epoch 4.54), 43.9 ms
Minibatch loss: 2.325, learning rate: 0.008145
Minibatch error: 3.1%
Validation error: 0.9%
Step 4000 (epoch 4.65), 43.6 ms
Minibatch loss: 2.215, learning rate: 0.008145
Minibatch error: 0.0%
Validation error: 1.1%
Step 4100 (epoch 4.77), 43.6 ms
Minibatch loss: 2.209, learning rate: 0.008145
Minibatch error: 1.6%
Validation error: 1.0%
Step 4200 (epoch 4.89), 43.6 ms
Minibatch loss: 2.242, learning rate: 0.008145
Minibatch error: 1.6%
Validation error: 1.0%
Step 4300 (epoch 5.00), 43.5 ms
Minibatch loss: 2.188, learning rate: 0.007738
Minibatch error: 1.6%
Validation error: 0.9%
Step 4400 (epoch 5.12), 43.5 ms
Minibatch loss: 2.155, learning rate: 0.007738
Minibatch error: 3.1%
Validation error: 1.0%
Step 4500 (epoch 5.24), 43.5 ms
Minibatch loss: 2.164, learning rate: 0.007738
Minibatch error: 4.7%
Validation error: 0.9%
Step 4600 (epoch 5.35), 43.5 ms
Minibatch loss: 2.095, learning rate: 0.007738
Minibatch error: 0.0%
Validation error: 0.9%
Step 4700 (epoch 5.47), 43.6 ms
Minibatch loss: 2.062, learning rate: 0.007738
Minibatch error: 0.0%
Validation error: 0.9%
Step 4800 (epoch 5.59), 43.6 ms
Minibatch loss: 2.068, learning rate: 0.007738
Minibatch error: 1.6%
Validation error: 1.0%
Step 4900 (epoch 5.70), 43.6 ms
Minibatch loss: 2.062, learning rate: 0.007738
Minibatch error: 1.6%
Validation error: 1.0%
Step 5000 (epoch 5.82), 43.5 ms
Minibatch loss: 2.148, learning rate: 0.007738
Minibatch error: 3.1%
Validation error: 1.0%
Step 5100 (epoch 5.93), 43.5 ms
Minibatch loss: 2.017, learning rate: 0.007738
Minibatch error: 1.6%
Validation error: 0.9%
Step 5200 (epoch 6.05), 43.5 ms
Minibatch loss: 2.074, learning rate: 0.007351
Minibatch error: 3.1%
Validation error: 1.0%
Step 5300 (epoch 6.17), 43.6 ms
Minibatch loss: 1.983, learning rate: 0.007351
Minibatch error: 0.0%
Validation error: 1.1%
Step 5400 (epoch 6.28), 43.6 ms
Minibatch loss: 1.957, learning rate: 0.007351
Minibatch error: 0.0%
Validation error: 0.8%
Step 5500 (epoch 6.40), 43.5 ms
Minibatch loss: 1.955, learning rate: 0.007351
Minibatch error: 0.0%
Validation error: 0.9%
Step 5600 (epoch 6.52), 43.5 ms
Minibatch loss: 1.926, learning rate: 0.007351
Minibatch error: 0.0%
Validation error: 0.8%
Step 5700 (epoch 6.63), 43.5 ms
Minibatch loss: 1.914, learning rate: 0.007351
Minibatch error: 0.0%
Validation error: 1.0%
Step 5800 (epoch 6.75), 43.6 ms
Minibatch loss: 1.897, learning rate: 0.007351
Minibatch error: 0.0%
Validation error: 0.9%
Step 5900 (epoch 6.87), 43.5 ms
Minibatch loss: 1.887, learning rate: 0.007351
Minibatch error: 0.0%
Validation error: 0.8%
Step 6000 (epoch 6.98), 43.6 ms
Minibatch loss: 1.878, learning rate: 0.007351
Minibatch error: 0.0%
Validation error: 1.0%
Step 6100 (epoch 7.10), 43.5 ms
Minibatch loss: 1.859, learning rate: 0.006983
Minibatch error: 0.0%
Validation error: 0.8%
Step 6200 (epoch 7.21), 43.6 ms
Minibatch loss: 1.844, learning rate: 0.006983
Minibatch error: 0.0%
Validation error: 0.8%
Step 6300 (epoch 7.33), 43.6 ms
Minibatch loss: 1.850, learning rate: 0.006983
Minibatch error: 1.6%
Validation error: 0.9%
Step 6400 (epoch 7.45), 43.6 ms
Minibatch loss: 1.916, learning rate: 0.006983
Minibatch error: 3.1%
Validation error: 0.8%
Step 6500 (epoch 7.56), 43.6 ms
Minibatch loss: 1.808, learning rate: 0.006983
Minibatch error: 0.0%
Validation error: 0.8%
Step 6600 (epoch 7.68), 43.5 ms
Minibatch loss: 1.839, learning rate: 0.006983
Minibatch error: 1.6%
Validation error: 0.9%
Step 6700 (epoch 7.80), 43.6 ms
Minibatch loss: 1.781, learning rate: 0.006983
Minibatch error: 0.0%
Validation error: 0.8%
Step 6800 (epoch 7.91), 43.6 ms
Minibatch loss: 1.773, learning rate: 0.006983
Minibatch error: 0.0%
Validation error: 0.8%
Step 6900 (epoch 8.03), 43.5 ms
Minibatch loss: 1.762, learning rate: 0.006634
Minibatch error: 0.0%
Validation error: 0.9%
Step 7000 (epoch 8.15), 43.5 ms
Minibatch loss: 1.797, learning rate: 0.006634
Minibatch error: 1.6%
Validation error: 0.9%
Step 7100 (epoch 8.26), 43.5 ms
Minibatch loss: 1.741, learning rate: 0.006634
Minibatch error: 0.0%
Validation error: 0.8%
Step 7200 (epoch 8.38), 43.5 ms
Minibatch loss: 1.744, learning rate: 0.006634
Minibatch error: 0.0%
Validation error: 0.9%
Step 7300 (epoch 8.49), 43.6 ms
Minibatch loss: 1.726, learning rate: 0.006634
Minibatch error: 1.6%
Validation error: 0.8%
Step 7400 (epoch 8.61), 43.5 ms
Minibatch loss: 1.704, learning rate: 0.006634
Minibatch error: 0.0%
Validation error: 0.8%
Step 7500 (epoch 8.73), 43.6 ms
Minibatch loss: 1.695, learning rate: 0.006634
Minibatch error: 0.0%
Validation error: 0.8%
Step 7600 (epoch 8.84), 43.5 ms
Minibatch loss: 1.808, learning rate: 0.006634
Minibatch error: 3.1%
Validation error: 0.8%
Step 7700 (epoch 8.96), 43.6 ms
Minibatch loss: 1.667, learning rate: 0.006634
Minibatch error: 0.0%
Validation error: 0.9%
Step 7800 (epoch 9.08), 43.5 ms
Minibatch loss: 1.660, learning rate: 0.006302
Minibatch error: 0.0%
Validation error: 0.9%
Step 7900 (epoch 9.19), 43.6 ms
Minibatch loss: 1.649, learning rate: 0.006302
Minibatch error: 0.0%
Validation error: 0.9%
Step 8000 (epoch 9.31), 43.5 ms
Minibatch loss: 1.666, learning rate: 0.006302
Minibatch error: 0.0%
Validation error: 0.8%
Step 8100 (epoch 9.43), 43.6 ms
Minibatch loss: 1.626, learning rate: 0.006302
Minibatch error: 0.0%
Validation error: 0.8%
Step 8200 (epoch 9.54), 43.5 ms
Minibatch loss: 1.633, learning rate: 0.006302
Minibatch error: 1.6%
Validation error: 0.8%
Step 8300 (epoch 9.66), 43.6 ms
Minibatch loss: 1.616, learning rate: 0.006302
Minibatch error: 0.0%
Validation error: 0.8%
Step 8400 (epoch 9.77), 43.6 ms
Minibatch loss: 1.597, learning rate: 0.006302
Minibatch error: 0.0%
Validation error: 0.8%
Step 8500 (epoch 9.89), 43.5 ms
Minibatch loss: 1.612, learning rate: 0.006302
Minibatch error: 1.6%
Validation error: 0.8%
Test error: 0.8%

Finally Dode!!!

總結

來來回回折騰了4天。教訓就是一定要根據官網一步一步來,因為不同版本兼容性不行,所以不要隨意下載其他版本,同時要仔細分析報出的錯誤,再采取下一步行動。

歡迎訪問我的主頁(http://mageek.cn/)

文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。

轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/45512.html

相關文章

  • tensorflow學習筆記1——mac開發環境配置

    摘要:模塊中包含著大量的語料庫,可以很方便地完成很多自然語言處理的任務,包括分詞詞性標注命名實體識別及句法分析。導入工具包,下載數據源。在終端輸入是第一被添加到核心中的高級別框架,成為的默認。至此開發環境配置完畢 1. mac電腦推薦配置 內存:8G+cpu:i5+硬盤:SSD 128G+ 本人的電腦配置是cpu:i7, 內存:16G,硬盤:SSD 256G 2. mac開發環境配置 1.1...

    Muninn 評論0 收藏0
  • 深度學習

    摘要:深度學習在過去的幾年里取得了許多驚人的成果,均與息息相關。機器學習進階筆記之一安裝與入門是基于進行研發的第二代人工智能學習系統,被廣泛用于語音識別或圖像識別等多項機器深度學習領域。零基礎入門深度學習長短時記憶網絡。 多圖|入門必看:萬字長文帶你輕松了解LSTM全貌 作者 | Edwin Chen編譯 | AI100第一次接觸長短期記憶神經網絡(LSTM)時,我驚呆了。原來,LSTM是神...

    Vultr 評論0 收藏0

發表評論

0條評論

最新活動
閱讀需要支付1元查看
<