使用矩池云
分为几个方面,装环境是大头,使用矩池云和使用VNC
一、矩池云
1.网盘
矩池云为每位用户提供 5G 的存储空间,您可将自己的数据等资料上传到个人中心 – 我的网盘(右上角用户名 —— 个人中心 —— 我的网盘),以便在租用的主机中使用。网盘中数据不会随着机器租用或释放而清空,同时矩池云保证数据的私密性和安全性,可放心使用。
2.租赁
在主机市场选择自己需要的服务器即可
为了在后续可以使用VNC,需要选择可以开启VNC的服务器
如果已经保存了环境,可以在历史保存中寻找
二、VNC
1.链接
下载VNC,并安装,详见这篇官方提供的文
https://www.matpool.com/supports/doc-vnc-connect-matpool/
接下来进入VNC中,将租用中提到的VNC链接进行复制,粘贴进VNC的输入界面
接下来会要求输入密码,这里的密码就是租用中提到的SSH和VNC两个链接右侧的那个密码。
进入界面后
点击左上角的application,选择terminal emulator
接下来就是安装环境部分了。
2.安装环境
进入root ,不进入无法使用conda虚拟环境。左上角applications 的地方打开命令行工具,输入:
su root
cd ~
设置conda镜像源
进入用户目录,创建配置文件
cd ~
conda config --set show_channel_urls yes
vi .condarc
按a进入编辑模式,复制下面的内容黏贴,然后按 ESC -> :->wq->enter 保存修改内容
channels:
- defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
清除索引缓存,保证用的是镜像站提供的索引
conda clean -i
设置pip镜像源
需要先手动创建配置文件
mkdir .pip
vi .pip/pip.conf
复制黏贴下面的内容
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn
保存修改即可。
矩池云官方提供了切换镜像源的脚本,操作起来会更加方便一些:
sh /public/script/switch_pip_source.sh
创建虚拟环境并激活
使用conda可以非常便捷的创建deepfacelab所需的运行环境。一个命令就会自动安装python,cuda,cudnn等必须的内容。因为上面已经做了一些处理,这个安装过程会很快完成。
conda create -n name python=3.6.8 cudnn=7.6.5 cudatoolkit=10.0.130
#这里可以调整一些自己需要的东西
conda activate deepfacelab
其他的就pip conda就可以了 非常的快速方便(pip不行就conda)
这里大致均来自于这篇博文
https://zhuanlan.zhihu.com/p/166349147
3.保存环境
在租用界面的更多选择保存环境,第一次需要保存,后续就可以不弄了,如果有更改也需要保存。
4.再次调用自己的环境
su root
cd ~
conda activate myconda #myconda是我环境的名字
cd /mnt/VT-main #VT-main是我文件夹的名字
CUDA_VISIBLE_DEVICES=0 python vni_fgsm.py #vni_fgsm.py是我py文件的名字
总结
以上就是我对矩池云使用的一个自我总结。