常用深度學習框架(keras,pytorch.cntk,theano)conda 安裝--未整理


版本查詢


cpu   
  
tensorflow  
conda  env  list 
source   activate   tensorflow

python  
import tensorflow as tf 和 tf.__version__   1.11.0



keras

conda  env  list
source   activate   keras 
import keras   2.2.2
print(keras.__version__)
import tensorflow as tf 
tf.__version__
1.11.0



pytorch  

import torch
print(torch.__version__)   
print(torch.cuda.device_count())
print(torch.cuda.is_available())

1.2.0  


cntk 
/root/anaconda3/bin/conda  env  list
 source  activate  cntk-py35
需要添加變量
python  3.5.6
export  PATH=/root/anaconda3/bin:$PATH
 python -c "import cntk; print(cntk.__version__)"  
2.7



新的名字:conda-cntk-pass     cntk2.7


theano     



caffe2     直接使用
python  3.6.9 
import   caffe2  




gpu  

tensorflow-gpu:1.11.0     python 3.5  

export  PATH=/root/anaconda3/bin:$PATH
source  activate  tensorflow
 
1.11.0   新的名字 docker  commit  ba9743bcfc7d   gpu-tensflow-1.11:1.11.0


keras   
export  PATH=/root/anaconda3/bin:$PATH  
conda  env list
source  activate  keras
python3.5 

tensorflow 1.11.0
keras 2.2.2



nvidia-docker  run  -it --rm    pytorch-gpu:1.1.0  /bin/bash
pytorch   直接使用 
[root@191ddd30d4ae /]# python 
Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 19:07:31) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import  torch 
>>> print(torch.__version__) 
1.1.0
>>> print(torch.cuda.device_count())
1
>>> print(torch.cuda.is_available())
True
>>> 



cntk 

source activate  cntk-py35    python3.5

python -c "import cntk; print(cntk.__version__)"
2.4 



theano 


ValueError: You are trying to use the old GPU back-end. It was removed from Theano. Use device=cuda* now. See https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29 for more information
—————————
vim ~/.bashrc 
2:添加如下命令:

export THEANO_FLAGS='mode=FAST_RUN,device=cpu,floatX=float32'
1
3:使修改的theano設置生效:

source ~/.bashrc
1
4:編輯theano對於gpu的配置文件:

vim ~/.theanorc
1
5:添加內容如下:

[global]
device = cuda
floatX=float32
[nvcc]
flags=--machine=64
[lib]
cnmem=100
 

gpu-theano-in-use:1.0.4    python2.7  

source activate  theano
python  test.py 
>>> import  theano 
/root/anaconda3/envs/theano/lib/python2.7/site-packages/theano/gpuarray/dnn.py:184: UserWarning: Your cuDNN version is more recent than Theano. If you encounter problems, try updating Theano or downgrading cuDNN to a version >= v5 and <= v7.
  warnings.warn("Your cuDNN version is more recent than "
Using cuDNN version 7603 on context None
Mapped name None to device cuda: GeForce GTX 960M (0000:01:00.0)
>>> theano.__version__
u'1.0.4'
>>> 


 https://www.jianshu.com/p/4cc75a79dce9
Linux下安裝miniconda
在官網下載miniconda3
執行:bash Miniconda3-latest-Linux-x86_64.sh  之后跟隨提示步驟,安裝過程中可以自動添加路徑到配置文件,也可以之后進行配置。在這期間輸入 yes  no   (在這里我是之后配置的所以執行3)
將其添加到大環境變量中去
-vim ~/.bashrc
-export PATH=~/anaconda3/bin:$PATH
-source ~/.bashrc
創建虛擬環境並安裝theano (主要參考官網教程http://deeplearning.net/software/theano/install_ubuntu.html)
基於python2.7創建一個名為theano的環境: conda create --name theano python=2.7
進入虛擬環境: source activate theano
-使用conda安裝:conda install numpy scipy mkl
                pip install parameterized
                conda install theano pygpu

-使用pip安裝:pip install Theano
Install and configure the GPU drivers (這一步我沒有嘗試,因為本來就安裝好了)
配置theanoGPU環境
vim ~/.theanorc
在空白文件中添加
[global]
floatX = float32
device = gpu3
[lib]
cnmem = 0.6 意味着有百分之60的顯存分給當前終端
也可以不用5,直接在運行的時候使用命令:THEANO_FLAGS='device=cuda,floatX=float32'
默認為cuda0)
測試
test.py 文件:
from theano import function, config, shared, tensor
import numpy
import time

vlen = 10 * 30 * 768  # 10 x #cores x # threads per core
iters = 1000

rng = numpy.random.RandomState(22)
x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
f = function([], tensor.exp(x))
print(f.maker.fgraph.toposort())
t0 = time.time()
for i in range(iters):
    r = f()
t1 = time.time()
print("Looping %d times took %f seconds" % (iters, t1 - t0))
print("Result is %s" % (r,))
if numpy.any([isinstance(x.op, tensor.Elemwise) and
              ('Gpu' not in type(x.op).__name__)
              for x in f.maker.fgraph.toposort()]):
    print('Used the cpu')
else:
    print('Used the gpu')


caffe2
https://blog.csdn.net/qq_35451572/article/details/79428167 
cmake \
  -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-9.0 \
  -DCUDNN_ROOT_DIR=/usr/local/cuda  


# To check if Caffe2 build was successful
python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"

# To check if Caffe2 GPU build was successful
# This must print a number > 0 in order to use Detectron
python -c 'from caffe2.python import workspace; print(workspace.NumCudaDevices())'

https://blog.csdn.net/Yan_Joy/article/details/70241319

https://www.nvidia.com/en-gb/data-center/gpu-accelerated-applications/caffe2/
https://blog.csdn.net/qq_35451572/article/details/79428167
https://blog.csdn.net/qq_16525279/article/details/79724728
https://blog.csdn.net/y_f_raquelle/article/details/83278953
https://www.cnblogs.com/nanzhao/p/9596844.html

1,

cpu   
  
conda  create   -n  xx   --clone   nn(已經存在的虛擬環境)

tensorflow  


conda  env  list 
source   activate   tensorflow
 pip  install   tensorflow==1.11.0

python  
import tensorflow as tf 和 tf.__version__   1.11.0



keras
 pip  install   tensorflow==1.11.0
 pip  install   keras==2.2.2

conda  env  list
source   activate   keras 
import keras   2.2.2
print(keras.__version__)
import tensorflow as tf 
tf.__version__
1.11.0



pytorch  

https://pytorch.org/get-started/locally/   安裝
pip3 install torch==1.2.0+cpu torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html  不行

conda install pytorch torchvision cpuonly -c pytorch  -n pytorch 


import torch
print(torch.__version__)   
print(torch.cuda.device_count())
print(torch.cuda.is_available())

1.2.0  


cntk 

pip  install  https://cntk.ai/PythonWheel/CPU-Only/cntk-2.7.post1-cp35-cp35m-linux_x86_64.whl
/root/anaconda3/bin/conda  env  list
 source  activate  cntk-py35
需要添加變量
python  3.5.6
export  PATH=/root/anaconda3/bin:$PATH
 python -c "import cntk; print(cntk.__version__)"  
2.7



新的名字:conda-cntk-pass     cntk2.7


theano     



caffe2     直接使用
python  3.6.9 
import   caffe2  

安裝
conda  create   -n  caffe2   python=3.6
conda activate caffe2
conda install pytorch-nightly-cpu -c pytorch  -n  caffe2

python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"

pip  install   protobuf
pip  install  future




gpu  

tensorflow-gpu:1.11.0     python 3.5  

export  PATH=/root/anaconda3/bin:$PATH
source  activate  tensorflow
 
1.11.0   新的名字 docker  commit  ba9743bcfc7d   gpu-tensflow-1.11:1.11.0


keras   
export  PATH=/root/anaconda3/bin:$PATH  
conda  env list
source  activate  keras
python3.5 

tensorflow 1.11.0
keras 2.2.2



nvidia-docker  run  -it --rm    pytorch-gpu:1.1.0  /bin/bash
pytorch   直接使用 

conda install pytorch torchvision cudatoolkit=9.0 -c pytorch

conda install pytorch torchvision   -c pytorch  -n  pytorch

[root@191ddd30d4ae /]# python 
Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 19:07:31) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import  torch 
>>> print(torch.__version__) 
1.1.0
>>> print(torch.cuda.device_count())
1
>>> print(torch.cuda.is_available())
True
>>> 



cntk 

source activate  cntk-py35    python3.5

python -c "import cntk; print(cntk.__version__)"
2.4 



theano 


ValueError: You are trying to use the old GPU back-end. It was removed from Theano. Use device=cuda* now. See https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29 for more information
—————————
vim ~/.bashrc 
2:添加如下命令:

export THEANO_FLAGS='mode=FAST_RUN,device=cpu,floatX=float32'
1
3:使修改的theano設置生效:

source ~/.bashrc
1
4:編輯theano對於gpu的配置文件:

vim ~/.theanorc
1
5:添加內容如下:

[global]
device = cuda
floatX=float32
[nvcc]
flags=--machine=64
[lib]
cnmem=100
 

gpu-theano-in-use:1.0.4    python2.7  

source activate  theano
python  test.py 
>>> import  theano 
/root/anaconda3/envs/theano/lib/python2.7/site-packages/theano/gpuarray/dnn.py:184: UserWarning: Your cuDNN version is more recent than Theano. If you encounter problems, try updating Theano or downgrading cuDNN to a version >= v5 and <= v7.
  warnings.warn("Your cuDNN version is more recent than "
Using cuDNN version 7603 on context None
Mapped name None to device cuda: GeForce GTX 960M (0000:01:00.0)
>>> theano.__version__
u'1.0.4'
>>> 


 https://www.jianshu.com/p/4cc75a79dce9
Linux下安裝miniconda
在官網下載miniconda3
執行:bash Miniconda3-latest-Linux-x86_64.sh  之后跟隨提示步驟,安裝過程中可以自動添加路徑到配置文件,也可以之后進行配置。在這期間輸入 yes  no   (在這里我是之后配置的所以執行3)
將其添加到大環境變量中去
-vim ~/.bashrc
-export PATH=~/anaconda3/bin:$PATH
-source ~/.bashrc
創建虛擬環境並安裝theano (主要參考官網教程http://deeplearning.net/software/theano/install_ubuntu.html)
基於python2.7創建一個名為theano的環境: conda create --name theano python=2.7
進入虛擬環境: source activate theano
-使用conda安裝:conda install numpy scipy mkl
                pip install parameterized
                conda install theano pygpu

-使用pip安裝:pip install Theano
Install and configure the GPU drivers (這一步我沒有嘗試,因為本來就安裝好了)
配置theanoGPU環境
vim ~/.theanorc
在空白文件中添加
[global]
floatX = float32
device = gpu3
[lib]
cnmem = 0.6 意味着有百分之60的顯存分給當前終端
也可以不用5,直接在運行的時候使用命令:THEANO_FLAGS='device=cuda,floatX=float32'
(默認為cuda0)
測試
test.py 文件:
from theano import function, config, shared, tensor
import numpy
import time

vlen = 10 * 30 * 768  # 10 x #cores x # threads per core
iters = 1000

rng = numpy.random.RandomState(22)
x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
f = function([], tensor.exp(x))
print(f.maker.fgraph.toposort())
t0 = time.time()
for i in range(iters):
    r = f()
t1 = time.time()
print("Looping %d times took %f seconds" % (iters, t1 - t0))
print("Result is %s" % (r,))
if numpy.any([isinstance(x.op, tensor.Elemwise) and
              ('Gpu' not in type(x.op).__name__)
              for x in f.maker.fgraph.toposort()]):
    print('Used the cpu')
else:
    print('Used the gpu')






caffe2
看官網文檔安裝
https://caffe2.ai/docs/getting-started.html?platform=ubuntu&configuration=compile



https://blog.csdn.net/qq_35451572/article/details/79428167 


cmake \
  -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-9.0 \
  -DCUDNN_ROOT_DIR=/usr/local/cuda  


# To check if Caffe2 build was successful
python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"

# To check if Caffe2 GPU build was successful
# This must print a number > 0 in order to use Detectron
python -c 'from caffe2.python import workspace; print(workspace.NumCudaDevices())'







https://blog.csdn.net/Yan_Joy/article/details/70241319

https://www.nvidia.com/en-gb/data-center/gpu-accelerated-applications/caffe2/
https://blog.csdn.net/qq_35451572/article/details/79428167
https://blog.csdn.net/qq_16525279/article/details/79724728
https://blog.csdn.net/y_f_raquelle/article/details/83278953
https://www.cnblogs.com/nanzhao/p/9596844.html








python -m pip install --user numpy scipy matplotlib  pandas  



 nltk  scikit-learn 

nltk安裝
Install NLTK: run pip install --user -U nltk

Install Numpy (optional): run pip install --user -U numpy

Test installation: run python then type import nltk




Installing scikit-learn,require:
Python (>= 3.5)
NumPy (>= 1.11.0)
SciPy (>= 0.17.0)
joblib (>= 0.11)

If you already have a working installation of numpy and scipy, the easiest way to install scikit-learn is using pip

pip install -U scikit-learn
or conda:

conda install scikit-learn



2安裝

anaconda  
https://repo.anaconda.com/archive/


conda create -n caffe_gpu -c defaults python=3.6 caffe-gpu
conda create -n caffe -c defaults python=3.6 caffe


import caffe
python -c "import caffe; print dir(caffe)"


https://blog.csdn.net/weixin_37251044/article/details/79763858


一、編譯Caffe、PyCaffe

URL : https://github.com/BVLC/caffe.git
1
1.下載Caffe

git clone https://github.com/BVLC/caffe.git 
cd caffe

注意:如果想在anaconda下使用,就先 
source activate caffe_env 
然后在這個環境下安裝 
利用anaconda2隨意切換proto的版本,多proto並存,protobuf,libprotobuf

2.編譯caffe

用cmake默認配置:
1
[注意]:一般需要修改config文件。

進入caffe根目錄

mkdir build
cd build
cmake ..
make all -j8
make install 
make runtest -j8
3.安裝pycaffe需要的依賴包,並編譯pycaffe

cd ../python
conda install cython scikit-image ipython h5py nose pandas protobuf pyyaml jupyter
for req in $(cat requirements.txt); do pip install $req; done
cd ../build
make pycaffe -j8

4.添加pycaffe的環境變量

終端輸入如下指令:
vim ~/.bashrc
在最后一行添加caffe的python路徑(到達vim最后一行快捷鍵:Shift+G):
export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH
注意: /path/to/caffe是下載的Caffe的根目錄,例如我的路徑為:/home/Jack-Cui/caffe-master/python

Source環境變量,在終端執行如下命令:
source ~/.bashrc
注意: Source完環境變量,會退出testcaffe這個conda環境,再次使用命令進入即可。

四、測試

執行如下命令:
python -c "import caffe; print dir(caffe)"
fatal error: pyconfig.h: No such file or directory

如果使用的是系統的python路徑,解決方法如下:

make clean
export CPLUS_INCLUDE_PATH=/usr/include/python2.7
make all -j8
如果使用的是anaconda Python,路徑如下:

export CPLUS_INCLUDE_PATH=/home/gpf/anaconda3/include/python3.6m

http://blog.csdn.net/GPFYCF521/article/details/80387869


        cd /usr/local/src/caffe-master/
    2  ll
    3  make  pycaffe 
    4  find   /  -name  "Python.h"
    5  export CPLUS_INCLUDE_PATH=/usr/local/src/Python-3.6.4/Include/Python.h:$CPLUS_INCLUDE_PATH
    6  make  clean 
    7  make  pycaffe
    8  export CPLUS_INCLUDE_PATH=/usr/local/src/Python-3.6.4/Include/:$CPLUS_INCLUDE_PATH
    9  make  clean 
   10  make  pycaffe
   11  export CPLUS_INCLUDE_PATH=
   12  export CPLUS_INCLUDE_PATH=/usr/local/src/Python-3.6.4/Include/:$CPLUS_INCLUDE_PATH
   13  make  clean 
   14  make  pycaffe
   15  find   /   -name  "pyconfig.h"
   16   yum install python-devel.x86_64
   17  make   clean 
   18  make  pycaffe
   19  find python3.6
   20  locate python3.6
   21  make clean
   22  export CPLUS_INCLUDE_PATH=/usr/include/python2.7
   23  export CPLUS_INCLUDE_PATH=
   24  export CPLUS_INCLUDE_PATH=/root/anaconda3/include/python3.5m
   25  make  all 
   26  find   /   -name  "pycaffe"
   27  history 





裝的是python3.6,項目中用到boost相關代碼,編譯時找不到pyconfig.h。看了一下/usr/include/python3.6和/usr/include/python3.6m,都只有一個pyconfig-64.h文件。
網上查了一圈,找了各種方法都搞不定,其中一種方法可以安裝一堆.h進/usr/include/python2.7,3.6文件夾中還是沒有。方法如下:

1. 可以先查看一下含python-devel的包

    yum search python | grep python-devel

2. 64位安裝python-devel.x86_64,32位安裝python-devel.i686,我這里安裝:

    sudo yum install python-devel.x86_64

受此啟發,輸入命令查找3.6版本相關的python包
yum search python | grep python36
發現下面這個應該是我們想要的
python36u-devel.x86_64 : Libraries and header files needed for Python
 
yum install python36u-devel.x86_64


conda create -n caffe_gpu -c defaults python=3.5 caffe-gpu
conda create -n caffe -c defaults python=3.5 caffe





CONDA  安裝caffe 
一、編譯Caffe、PyCaffe

URL : https://github.com/BVLC/caffe.git
1
1.下載Caffe

git clone https://github.com/BVLC/caffe.git 
cd caffe

注意:如果想在anaconda下使用,就先 
source activate caffe_env 
然后在這個環境下安裝 
利用anaconda2隨意切換proto的版本,多proto並存,protobuf,libprotobuf

2.編譯caffe

用cmake默認配置:
1
[注意]:一般需要修改config文件。

進入caffe根目錄

mkdir build
cd build
cmake ..
make all -j8
make install 
make runtest -j8
 
3.安裝pycaffe需要的依賴包,並編譯pycaffe

cd ../python
conda install cython scikit-image ipython h5py nose pandas protobuf pyyaml jupyter
for req in $(cat requirements.txt); do pip install $req; done
cd ../build
make pycaffe -j8
 
4.添加pycaffe的環境變量

終端輸入如下指令:
1
vim ~/.bashrc
1
在最后一行添加caffe的python路徑(到達vim最后一行快捷鍵:Shift+G):
1
export PYTHONPATH=/path/to/caffe/python:$PYTHONPATH
1
2
注意: /path/to/caffe是下載的Caffe的根目錄,例如我的路徑為:/home/Jack-Cui/caffe-master/python

Source環境變量,在終端執行如下命令:
1
source ~/.bashrc
1
注意: Source完環境變量,會退出testcaffe這個conda環境,再次使用命令進入即可。

四、測試

執行如下命令:
python -c "import caffe; print dir(caffe)"

輸出結果如下:


 注意: 如果創建了conda環境,每次想要使用caffe,需要先進入這個創建的conda環境。


export   PATH=/root/anaconda3/bin:$PATH


conda create -n caffe  -c defaults python=3.5

conda  install  caffe-gpu

conda  install  tensorflow-gpu==1.11.0   


conda create --name  tensorflow    python=3.5

source activate tensorflow

source deactivate

conda    remove  -n   tensorflow   --all

import tensorflow as tf 和 tf.__version__

您正在使用GPU版本。您可以列出可用的tensorflow設備
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())



conda 安裝pytorch  
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/


添加清華源
命令行中直接使用以下命令

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/

# 設置搜索時顯示通道地址
conda config --set show_channel_urls yes


————————————————————————————————————————————————————————————————————————————————
設置搜索時顯示通道地址                                                           |
 conda config --set show_channel_urls yes
conda GPU的命令如圖所示:
conda install pytorch torchvision -c pytorch
conda CPU的命令如圖所示:
conda install pytorch-cpu -c pytorch 

pip3 install torchvision

pytorch-gpu
conda install pytorch torchvision cudatoolkit=9.0 -c pytorch
 
import torch
print(torch.__version__)   
print(torch.cuda.device_count())
print(torch.cuda.is_available())


--------------------------------------------------------------------------------|


conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/


 conda config --set show_channel_urls yes 
查看已經添加的channels

conda config --get channels
已添加的channel在哪里查看

vim ~/.condarc

conda search gatk
安裝完成后,可以用“which 軟件名”來查看該軟件安裝的位置:

 which gatk
如需要安裝特定的版本:
conda install 軟件名=版本號
conda install gatk=3.7


查看已安裝軟件:

conda list
更新指定軟件:

conda update gatk
卸載指定軟件:

conda remove gatk





cntk  

https://blog.csdn.net/Jonms/article/details/79550512
ubuntu1604   cuda -cudnn
接着,運行下面的命令安裝anaconda

$ sh Anaconda3-5.1.0-Linux-x86_64.sh
anaconda的安裝很簡單,這里就不多描述。

CNTK需要你的系統安裝有OpenMPI。在Ubuntu中可以通過以下命令安裝

$ sudo apt install openmpi-bin
然后,創建名為cntk-py35的虛擬環境

$ conda create --name cntk-py35 python=3.5 numpy scipy h5py jupyter
激活cntk虛擬環境

$ source activate cntk-py35
關閉cntk虛擬環境

$ source deactivate
激活虛擬環境后,用pip安裝CNTK(GPU)即可

$ pip install https://cntk.ai/PythonWheel/GPU/cntk-2.4-cp35-cp35m-linux_x86_64.whl
測試CNTK是否安裝成功並輸出CNTK版本

$ python -c "import cntk; print(cntk.__version__)"
 





cpu  
pip  install  https://cntk.ai/PythonWheel/CPU-Only/cntk-2.7.post1-cp35-cp35m-linux_x86_64.whl

python -c "import cntk; print(cntk.__version__)"



報錯:
ImportError: No module named 'cntk._cntk_py'
ImportError: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory

處理:
 find     /  -name  "libpython3.5m.so.1.0"   找到路徑  使用conda安裝的

/root/anaconda3/envs/cntk-py35/lib/   加入環境變量
#cd /etc/ld.so.conf.d

#vim python3.conf

將編譯后的python/lib地址加入conf文件

#ldconfig


容器環境變量會丟失,使用dockerfile重新賦值。  export   PATH=/root/anaconda3/bin:$PATH     上面的鏈接庫配置

pip  https://cntk.ai/PythonWheel/CPU-Only/cntk-2.7.post1-cp36-cp36m-linux_x86_64.whl





python3.7環境下

theano  

apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev
 pip install Theano


NumPy (~30s): python -c "import numpy; numpy.test()"
SciPy (~1m): python -c "import scipy; scipy.test()"
Theano (~30m): python -c "import theano; theano.test()"

已安裝cuda
export PATH=/usr/local/cuda-5.5/bin:$PATH
 
export LD_LIBRARY_PATH=/usr/local/cuda-5.5/lib64:$LD_LIBRARY_PATH





安裝Caffe2
docker pull caffe2ai/caffe2
 
# to test
nvidia-docker run -it caffe2ai/caffe2:latest python -m caffe2.python.operator_test.relu_op_test
 
# to interact
nvidia-docker run -it caffe2ai/caffe2:latest /bin/bash
 

python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"
#返回Success就OK
python2 -c 'from caffe2.python import workspace; print(workspace.NumCudaDevices())'
#返回1就OK
#進入python輸入
from caffe2.python import workspace

錯誤:
ModuleNotFoundError: No module named 'google'
pip  install   protobuf
ModuleNotFoundError: No module named 'past'

 pip  install  future 


安裝后檢測
python -c 'from caffe2.python import core' 2>/dev/null && echo "Success" || echo "Failure"


gpu檢測
python -m caffe2.python.operator_test.relu_op_test


Python2.7和Python3.6下都可以,不過只是cpu版本,只限於Mac和Ubuntu平台下:

conda install -c caffe2 caffe2


參考網址:
https://blog.csdn.net/qq_35451572/article/details/79428167


https://blog.csdn.net/Yan_Joy/article/details/70241319


https://blog.csdn.net/zmm__/article/details/90285887

https://blog.csdn.net/u013842516/article/details/80604409




使用Docker安裝GPU版本caffe2

https://blog.csdn.net/Andrwin/article/details/94736930
caffe安裝
https://blog.csdn.net/jacky_ponder/article/details/53129355



cntk


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM