DCGAN实现

文章目录

      • 1. 环境配置
        • 1.1 Anaconda&Jupyter Notebook安装
        • 1.2 远程访问Jupter notebook
      • 2. DCGAN实现
        • 2.1 数据下载

参考PyTorch 教程DCGAN,在Jupyter notebook上实现;

1. 环境配置

1.1 Anaconda&Jupyter Notebook安装

  • conda create -n tf_py36 python=3.6 创建环境
  • source activate tf_py36 激活环境
  • Install ptorch, torchvision 请参考官网
  • pip install jupyter 安装Jupyter

1.2 远程访问Jupter notebook

参考GPU云服务器配置

  • ssh 连接远程服务器,激活虚拟环境tf_py36
  • jupyter notebook的配置: 需要生成jupyter notebook配置文件
 jupyter notebook --generate-config
 Writing default config to: /home/cyli/.jupyter/jupyter_notebook_config.py
  • 调用ipython (或python)设置jupyter notebook密码
(tf_py36) cyli@ubuntu:/home/cyli$ ipython
Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 13:51:32) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password: 
Verify password: 
Out[2]: 'sha1:b804cd47ff66:7c1d4a54809c54c356ae406b05c4c50767cc7958'
In [3]: exit

记录下’sha1:b804cd47ff66:7c1d4a54809c54c356ae406b05c4c50767cc7958’,在文件配置时候要用。
配置jupyter notebook的config文件,同时记录自己所输入的密码。

  • 取消激活
source deactivate tf_py36
cyli@ubuntu:~$
  • 修改配置
cyli@ubuntu:~$ vi /home/cyli/.jupyter/jupyter_notebook_config.py
  • 修改如下
c.NotebookApp.ip = '*'
c.NotebookApp.password = 'sha1:b804cd47ff66:7c1d4a54809c54c356ae406b05c4c50767cc7958'
c.NotebookApp.open_browser = False                                       
  • 在项目文件夹下启动jupyter notebook
cyli@ubuntu:/media/sdc/cyli/tus/dcgan_pytorch001$ jupyter notebook
[W 16:22:42.594 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 16:22:42.697 NotebookApp] JupyterLab beta preview extension loaded from /home/zhouyi/anaconda2/lib/python2.7/site-packages/jupyterlab
[I 16:22:42.697 NotebookApp] JupyterLab application directory is /home/zhouyi/anaconda2/share/jupyter/lab
[I 16:22:42.703 NotebookApp] Serving notebooks from local directory: /media/sdc/cyli/tus/dcgan_pytorch001
[I 16:22:42.704 NotebookApp] 0 active kernels
[I 16:22:42.704 NotebookApp] The Jupyter Notebook is running at:
[I 16:22:42.704 NotebookApp] http://ubuntu:8888/
  • 在浏览端输入http://[your remote server ip]:8888/, 后在弹窗中输入密码即可进入。
    DCGAN实现_第1张图片

2. DCGAN实现

2.1 数据下载

你可能感兴趣的:(环境搭建,深度学习)