deep learning 入门资料和环境配置
Published:
deep learning 入门资料和环境配置
- deep learning 入门资料和环境配置
- 资料
- cuda and cudnn
- TensorFlow gpu 安装
- pytorch 安装
- Github操作
- windows 环境配置
- 使用pycharm 连接服务器写代码
- 用浏览器+jupyter 在服务器上写代码
- Shell 命令行配置
- tensorboard 使用
- conda 安装各种包
- jupyter 使用tqdm
- jupyter 文件转pdf格式
- jupyter autoreload
- 使用pdb进行python 调试
- 后台运行程序
- keras 显式输出
- keras plot model:
- keras 结束当前计算图
- tf查看未初始化tensor
- tensorflow 尽量不要让向量shape 为(n,)而是(n,1)
- tf.reset_default_graph() 重置所有图(不会出现reuse 的bug)
- deep learning 入门资料和环境配置
资料
What are the best resources to learn about deep learning?
https://www.quora.com/What-are-the-best-resources-to-learn-about-deep-learning
Learning machine learning and data science
https://algorithmsdatascience.quora.com/Learning-machine-learning-and-data-science
machine learning yearning
https://github.com/mbadry1/DeepLearning.ai-Summary
deep learning bengio
https://www.deeplearningbook.org/
深度学习500问
https://github.com/scutan90/DeepLearning-500-questions
机器之心ML-Tutorial-Experiment
https://github.com/jiqizhixin/ML-Tutorial-Experiment
pytorch 项目模板:
https://github.com/victoresque/pytorch-template
tensorflow项目模板:
https://github.com/756481896/DLPDE_Project/tree/master/DLPDE_Project_origin
keras 项目模板:
https://github.com/Ahmkel/Keras-Project-Template
deep learning.ai 课程by Andrew Ng
https://mooc.study.163.com/university/deeplearning_ai#/c
Effective TensorFlow
https://github.com/vahidk/EffectiveTensorflow
deeplearning-papernotes
https://github.com/dennybritz/deeplearning-papernotes
An awesome Data Science repository to learn and apply for real world problems.
https://github.com/bulutyazilim/awesome-datascience
Quiz & Assignment of Coursera
https://github.com/shenweichen/Coursera
TensorFlow Tutorial and Examples for Beginners with Latest APIs
https://github.com/aymericdamien/TensorFlow-Examples
cuda and cudnn
下载安装cuda
sudo dpkg -i cuda-repo-ubuntu1604-8-0-rc_8.0.27-1_amd64.deb
sudo apt-get update
sudo apt-get install cuda
下载cudnn
tar xvzf cudnn-8.0-linux-x64-v5.1.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
sudo vi ~/.bash_profile
加入
export LD_LIBRARY_PATH=”$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64”
export CUDA_HOME=/usr/local/cuda
导入
source ~/.bash_profile
报错:ImportError: libcudnn.so.6: cannot open shared object file: No such file or directory解决:升级cudnn到6
报错:ImportError: libcublas.so.8.0: cannot open shared object file: No such file or directory
解决python3 -m pip install tf-nightly-gpu
TensorFlow gpu 安装
conda install -c anaconda tensorflow-gpu tensorflow=1.12.0
pytorch 安装
sh Anaconda-…
conda install pytorch -c pytorch
conda install pytorch torchvision -c pytorch
pip install tensorboard
pip install tensorboardx
Github操作
安装:
git config –global user.name “shen”
git config –global user.email “756481896@qq.com”
ssh-keygen -t rsa -C “756481896@qq.com”
cat ~/.ssh/id_rsa.pub
复制结果
登录github账号,设置,ssh keys-new ssh key
输入
ssh -T git@github.com
测试是否连接成功
github简易指南
http://www.bootcss.com/p/git-guide/
biz=MzU1NTUxNTM0Mg==&mid=2247489742&idx=2&sn=84e713ef338a62feaeb4aa2297965252&chksm=fbd2746fcca5fd79aa9de2644e9d387722863f18ef460fcfccaaf103b735170cad8e40d25236&mpshare=1&scene=24&srcid=#rd”>http://mp.weixin.qq.com/s?biz=MzU1NTUxNTM0Mg==&mid=2247489742&idx=2&sn=84e713ef338a62feaeb4aa2297965252&chksm=fbd2746fcca5fd79aa9de2644e9d387722863f18ef460fcfccaaf103b735170cad8e40d25236&mpshare=1&scene=24&srcid=#rd
windows 环境配置
在windows 上安装Ubuntu 子系统
ubuntu on Windows
https://www.windows10.pro/bash-on-ubuntu-on-windows/
cmder
http://cmder.net/
使用pycharm 连接服务器写代码
https://blog.csdn.net/zhaihaifei/article/details/53691873
用浏览器+jupyter 在服务器上写代码
登录服务器
ssh xingshen@10.13.63.207
export PATH=~/anaconda3/bin:$PATH
ipython notebook –no-browser –port=8889
本地:
ssh -N -f -L localhost:8888:localhost:8889 xingshen@10.13.63.20
浏览器上打开http://localhost:8888
Shell 命令行配置
zsh:
sudo apt install zsh
on my zsh:
sh -c “$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)”
tensorboard 使用
代码中添加
tensorboard_dir = 'tensorboard/mnist' # 保存目录
if not os.path.exists(tensorboard_dir):
os.makedirs(tensorboard_dir)
writer = tf.summary.FileWriter(tensorboard_dir)
writer.add_graph(session.graph)
终端运行
$ tensorboard --logdir tensorboard/mnist
需要pip install tb-nightly
会出现
TensorBoard 1.5.0a20180110 at http://gpu-1:6006 (Press CTRL+C to quit)
点击网址即可
conda 安装各种包
conda install -c anaconda pygraphviz
安装各种不好安装的包
jupyter 使用tqdm
tqdm 可以把训练过程用动态进度条表示出来
from tqdm import tqdm_notebook as tqdm
import time
for i in tqdm(range(100)):
time.sleep(0.1)
for i in tqdm(range(100)):
time.sleep(0.5)
jupyter 文件转pdf格式
conda install nbconvert
sudo apt-get install texlive-xetex
安装好之后就可以用,但是不能用迅雷
jupyter autoreload
,py代码用jupyter 修改后,要有autoreload机制才可以在.ipynb中重新加载,否则要重开kernel。
%load_ext autoreload
%autoreload 2
使用pdb进行python 调试
import pdb
在断点处添上 pdb.set_trace()
运行
:p var 将变量var 打印出来
后台运行程序
nohup python train.py
keras 显式输出
keras.eval(ts)
keras plot model:
sudo yum install graphviz(不能用pip)
keras 结束当前计算图
K.clear_session()
tf查看未初始化tensor
print(sess.run(tf.report_uninitialized_variables()))