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


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

source /root/.bashrc
上传文件参考:AutoDL帮助文档
公开数据集参考:AutoDL帮助文档
从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

# 下载安装工具
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
# 将新的Conda虚拟环境加入jupyterlab中
conda activate tf # 切换到创建的虚拟环境:tf
conda install ipykernel
ipython kernel install --user --name=tf # 设置kernel,--user表示当前用户,tf为虚拟环境名称
运行代码时,可能会遇到路径错误的问题,可以用!pwd查看当前位置,然后用os.chdir()修改位置。下图中绿色框为原来位置,红色框为修改后的位置。

为了避免断开连接后,任务中断,可以参考守护进程文档:AutoDL帮助文档
服务器端生成的文件(图片视频权重文件等)无法同步到本地,需要自己下载。
需要注意的是,本地项目文件夹最好不要存放数据集,否则连接服务器会自动上传,而且速度很慢。

pychram连接远程终端:

#方法一:豆瓣镜像网站
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
# 查看视频
from IPython.display import HTML
from base64 import b64encodevideo = 'demo/demo.mp4' # 视频路径mp4 = open(video,'rb').read()
data_url = "data:video/mp4;base64," + b64encode(mp4).decode()
HTML("""
""" % data_url)

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