anaconda+pytorch+tensorflow+keras
环境
conda create --name py37 python=3.7
activate py37
新版本
pip install jupyterlab
jupyter lab
经典版本
#pip install ipykernel
pip install jupyter
python -m ipykernel install --user --name py37 --display-name "py37"
外部访问
生成配置文件
jupyter notebook --generate-config
(记录下地址)
生成密码
打开ipython,创建一个密文的密码
In [1]: from notebook.auth import passwd
In [2]: passwd()Enter password:
Verify password:
Out[2]: 'sha1:22bd77296e00:01bc151a1f7a6de107d31772e9c6c2ccaa773529'
修改默认配置文件
vi ~/.jupyter/jupyter_notebook_config.py
c.NotebookApp.ip='*'
c.NotebookApp.password = u'sha1:22...刚才复制的那个密文'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888
jupyter notebook
pytorch
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
更新的版本1.13.1:
pip install torch==1.13.1+cu117 torchvision==0.14.1+cu117 --extra-index-url https://download.pytorch.org/whl/cu117
https://pytorch.org/get-started/locally/
版本2.0:
pip install torch==2.0.0+cu118 torchvision==0.15.1+cu118 -f https://mirror.sjtu.edu.cn/pytorch-wheels/torch_stable.html -i https://mirrors.bfsu.edu.cn/pypi/web/simple -U
pip install -U -I --no-deps xformers==0.0.17rc482 -i https://mirrors.aliyun.com/pypi/simple/
版本2.0.1:
pip install torch==2.0.1+cu118 torchvision==0.15.2+cu118 torchaudio --extra-index-url https://download.pytorch.org/whl/cu118
tensorflow
https://developer.nvidia.com/cuda-downloads
https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_win10-exe
https://developer.nvidia.com/cudnn
http://developer2.download.nvidia.com/compute/machine-learning/cudnn/secure/v5.1/prod_20161129/8.0/cudnn-8.0-windows10-x64-v5.1.zip
pip install tensorflow-gpu
keras
conda install theano
conda install mingw libpython
pip install tensorflow
pip install keras
conda install h5py
mxnet
By popular demand, DMLC has added MXNet support for Keras. Please follow these steps for having it:
After having CUDA driver, install MXNet like
pip install mxnet-cu80
Install Keras with MXNet support:
git clone --recursive https://github.com/dmlc/keras
cd keras
python setup.py install
Assign MXNet as Keras backend:
KERAS_BACKEND=mxnet python -c "from keras import backend"
“Using MXNet backend.” means Keras+MXNet is successfully installed. Enjoy.
Q&A:
I am using Windows, can I have it? Yes, just replace step 1 with pip install mxnet-cu80-win
I don’t have a GPU, can I have a try? Yes, just replace step 1 with pip install mxnet or pip install mxnet–mkl if you have Intel CPU(s).
How is compared to TensorFlow backend? em, do you want to benchmark it? Please feel free to submit benchmark results and bugs to github issue.