AutoDL使用手册

官网:AutoDL-品质GPU租用平台-租GPU就上AutoDL

1.服务器购买

AutoDL使用手册_第1张图片

AutoDL使用手册_第2张图片

2.新建虚拟环境

conda create -n tf python=3.8           # 构建一个虚拟环境,名为:tf
conda init bash && source /root/.bashrc # 更新bashrc中的环境变量
conda activate tf                       # 切换到创建的虚拟环境:tf

3.各个目录的介绍

AutoDL使用手册_第3张图片

source /root/.bashrc

4.文件上传(建议阿里云盘)/公开数据集 

上传文件参考:AutoDL帮助文档

公开数据集参考:AutoDL帮助文档

5.文件下载

github上下载代码时,可以启用加速。常用的加速:

# 芜湖区
export http_proxy=http://192.168.0.91:12798 && export https_proxy=http://192.168.0.91:12798

# 北京A区
export http_proxy=http://100.72.64.19:12798 && export https_proxy=http://100.72.64.19:12798

#内蒙古A区
export http_proxy=http://192.168.1.174:12798 && export https_proxy=http://192.168.1.174:1279

#南京新手区
export http_proxy=http://172.181.217.43:12798 && export https_proxy=http://172.181.217.43:12798

#A100专区
export http_proxy=http://172.31.1.127:12798 && export https_proxy=http://172.31.1.127:12798

使用结束后记关闭加速

unset http_proxy && unset https_proxy

AutoDL使用手册_第4张图片

6.文件解压 

# 下载安装工具
curl -L -o /usr/bin/arc http://autodl-public.ks3-cn-beijing.ksyun.com/tool/arc && chmod +x /usr/bin/arc

# 压缩/打包
arc compress xxx.zip path/to/directory

# 解压
arc decompress xxx.zip 
或者解压到指定目录
arc decompress xxx.zip path/to/directory

有个别zip的压缩包使用上边的命令以及unzip命令都不能解压时,先检查文件大小,如果文件大小和源文件一样,那么尝试下面的命令解压: 

apt-get update && apt-get install -y fastjar
jar xvf xxx.zip

7.Jupyter Notebook使用

# 将新的Conda虚拟环境加入jupyterlab中
conda activate tf                         # 切换到创建的虚拟环境:tf
conda install ipykernel
ipython kernel install --user --name=tf   # 设置kernel,--user表示当前用户,tf为虚拟环境名称

运行代码时,可能会遇到路径错误的问题,可以用!pwd查看当前位置,然后用os.chdir()修改位置。下图中绿色框为原来位置,红色框为修改后的位置。 

AutoDL使用手册_第5张图片

8.终端长时间运行项目

为了避免断开连接后,任务中断,可以参考守护进程文档:AutoDL帮助文档 

9.远程连接pycharm

服务器端生成的文件(图片视频权重文件等)无法同步到本地,需要自己下载。

需要注意的是,本地项目文件夹最好不要存放数据集,否则连接服务器会自动上传,而且速度很慢。

AutoDL使用手册_第6张图片

pychram连接远程终端:

AutoDL使用手册_第7张图片

 10.pip国内源下载

#方法一:豆瓣镜像网站
pip install 安装包名字 -i http://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com 


#方法二:豆瓣
pip install 安装包名字 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

#方法三:清华大学(推荐)
pip install 安装包名字 -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn 

 11.服务器端,利用jupyter查看视频的方法

# 查看视频
from IPython.display import HTML
from base64 import b64encode

video = 'demo/demo.mp4' # 视频路径

mp4 = open(video,'rb').read()
data_url = "data:video/mp4;base64," + b64encode(mp4).decode()
HTML("""

""" % data_url)

12.实例GPU数量不够无法开机怎么办?

  1. 将原来的实例保存镜像,这样就不用再次配置环境了。
  2. 去算力市场购买新的实例,镜像选择--我的镜像--选择刚保存好的镜像

AutoDL使用手册_第8张图片

以下两个是我自己保存的镜像 

AutoDL使用手册_第9张图片

# CUDA 11.1
pip3 install torch==1.8.2 torchvision==0.9.2 torchaudio==0.8.2 --extra-index-url https://download.pytorch.org/whl/lts/1.8/cu111

 

你可能感兴趣的:(深度学习,python,pycharm,开发语言)