资讯专栏INFORMATION COLUMN

Keras configuration (GPU version, based on GTX108

hzc / 2657人阅读

This is my first blog about machine learning.( •̀ ω •́ )y

To begin with,the most important thing is to configure a group of proper tools and develope environments.
Keras is a well recommended framework by google, which can either supported by tensorflow and theano. Due to the excellent optimization by nvidia, the latest version of nv gamer graphics card (gtx10x0,titan xp)can also largely extend the efficiency of network training. So if one of the card is available, a GPU version of Keras is recommended.

My graphics card is GTX1080, the operating system is windows10 X64.

1. Microsoft Visual Studio 2015

Firstly, if you want to install a GPU version of machine learning framework, a Microsoft visual studio is needed. The version of Microsoft vs(also the CUDA Toolkit mentioned below) depends on your graphics card. If your card doesn"t belong to one of the latest NVidia version (gtx10x0,titan xp),then visual studio 2010~2013 is strongly recommended, because vs2015 is only compatible with cuda8.0,which is the only CUDA version supported by GTX1080. Due to my GTX1080, I"ve chosen vs2015 as my version, which can be de directly downloaded at the following link:

http://download.microsoft.com...

It"s a community version, totally free for individual developer.

The installation of vs2015 is so simple, load the iso file and click the execution file just like all other software.

VS2015 will automatically configure the environment without needing more Settings.

2. Anaconda2 4.4.0

To run Keras framework, a python environment is also needed. You can directly find the open source codes of python on GitHub, but I recommend Anaconda, for it has already integrated a lot of third-party libs (numpy, scipy, matplotlib, ipython, spyder.....). There are 2 version of Anaconda can be accessed, corresponding to python2+ and python3+. I took anaconda2(python2.7 version) as my choise. If you need to do text procession works, py3+ is recommended.

Download it from official site: https://www.continuum.io/down...

It can also be downloaded from the archive of the open source share site of Tsinghua university, choose anaconda2 4.4.0 if you choose python2.7 as environment:
https://mirrors.tuna.tsinghua...

Downloading from the latter can speed up a lot if you are in mainland CHINA.

When installing anaconda, don"t forget add the folder of anaconda scripts and libs to the environment variables.

3. Gcc compiler

Since we chose GPU version of Keras as our derivation machine, a g++ is indispensable.
open command line (win+R, cmd)and tap in the code:

conda install mingw libpython

4. CUDA Toolkit 8.0

It"s the core part if you want to use your powerful GPU to do the batch calculation and derivation.
CUDA Toolkit is provided by NVIDIA to support GPU oriented programming, which is only valid for graphics cards of NVIDIA but not AMD or Intel graphics products. If you have no NVIDIA graphics card, CPU version of Keras deep learning framework can be used.

Go to NVIDIA official site to download CUDA Toolkit, choose your version of operating system.
https://developer.nvidia.com/...

5. install Theano/Tensorflow

Open the CMD, tap in the code one by one:

#Which torch you wanna choose? Theano or Tensorflow?
pip install theano;#pip install tensorflow; 
pip install keras
conda install git
pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git

6. Configuration

Add the following path into environment variables:

#Change the disk and folder if you"ve already chosen another place
C:Anaconda2;
C:Anaconda2Scripts;
C:Anaconda2MinGWin;
C:Anaconda2MinGWx86_64-w64-mingw32lib;

create a new variable, add in the PATH:

#Change the dick, folder; change "theano" to "tensorflow" if you chose another
C:Anaconda2Libsite-packages	heano;

create a txt file .theanorc.txt at your USER fold, add in the content:

[global]
openmp=False 
device = gpu   
optimizer_including=cudnn  
floatX = float32  
allow_input_downcast=True  
[lib]
cnmem = 0.8 
[blas]
ldflags=  
[gcc]
cxxflags=-ID:Anaconda2MinGW  
[nvcc]
fastmath = True  
--flags=-LD:Anaconda2libs #change it to your own directory
--compiler_bindir=D:Microsoft Visual Studio 12.0VCin #change it to your own directory

#delete all annotation 

Till now, everything has been done.
Open your python environment(cmd or ipython notebook or spyder) and try to import~!

python
import numpy as np
import theano #or "import tensorflow as tf" 
import keras

If you want to do more, try to use keras and nimst database train a multi-layer perceptron model.

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/40772.html

相关文章

  • 用免费TPU训练Keras模型,速度还能提高20倍!

    摘要:本文介绍了如何利用上的免费资源更快地训练模型。本文将介绍如何在上使用训练已有的模型,其训练速度是在上训练速度的倍。使用静态训练模型,并将权重保存到文件。使用推理模型进行预测。 本文介绍了如何利用 Google Colab 上的免费 Cloud TPU 资源更快地训练 Keras 模型。很长一段时间以来,我在单个 GTX 1070 显卡上训练模型,其单精度大约为 8.18 TFlops。后来谷...

    IamDLY 评论0 收藏0
  • GPU训练机器学习模型哪家强?AWS、谷歌云、IBM等6大平台对比

    摘要:在低端领域,在上训练模型的价格比便宜两倍。硬件定价价格变化频繁,但目前提供的实例起价为美元小时,以秒为增量计费,而更强大且性能更高的实例起价为美元小时。 随着越来越多的现代机器学习任务都需要使用GPU,了解不同GPU供应商的成本和性能trade-off变得至关重要。初创公司Rare Technologies最近发布了一个超大规模机器学习基准,聚焦GPU,比较了几家受欢迎的硬件提供商,在机器学...

    史占广 评论0 收藏0
  • 从硬件配置到软件安装,一台深度学习机器的配备指南

    摘要:很明显这台机器受到了英伟达的部分启发至少机箱是这样,但价格差不多只有的一半。这篇个文章将帮助你安装英伟达驱动,以及我青睐的一些深度学习工具与库。 本文作者 Roelof Pieters 是瑞典皇家理工学院 Institute of Technology & Consultant for Graph-Technologies 研究深度学习的一位在读博士,他同时也运营着自己的面向客户的深度学习产...

    joywek 评论0 收藏0
  • 使用AMD CPU,3000美元打造自己的深度学习服务器

    摘要:本文作者详细描述了自己组装深度学习服务器的过程,从主板电源机箱等的选取到部件的安装,再到服务器的设置,可谓面面俱到。注本文旨在讨论服务器设置及多用户协作,部件组装和软件安装过程是关于创建自己的的文章的简化版本。本文作者详细描述了自己组装深度学习服务器的过程,从 CPU、GPU、主板、电源、机箱等的选取到部件的安装,再到服务器的设置,可谓面面俱到。作者指出,组装者首先要弄清自己的需求,然后根据...

    Vultr 评论0 收藏0

发表评论

0条评论

hzc

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<