NVIDIA Tao Toolkit环境配置

NVIDIA Tao Toolkit环境配置

此文档用于NVIDIA Developer Community第八届Sky Hackathon训练服务器端环境配置

目录

Ubuntu系统–这部分请自行安装系统, 您可以选择双系统, 云服务器, 或者单独的ubuntu系统
环境配置的主要流程为:

  1. NVIDIA 驱动环境
  2. Docker环境配置
  3. Tao Toolkit的安装
  4. 下载示例

1.NVIDIA驱动环境

注意:如果您已经安装过最新的CUDA(11.0以上), 则无需安装驱动环境

a.添加源:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:graphics-drivers/ppa

b.安装驱动

注意: 这里的Tao要求的驱动版本>520

sudo apt-get install nvidia-driver-530 

c.重启机器

只有重启之后驱动才能生效

sudo reboot 

d.检查驱动

nvidia-smi

比如我当前用的是NVIDIA A10 GPU, 就会出现如下输出:

Sat May  6 14:51:49 2023
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 530.30.02              Driver Version: 530.30.02    CUDA Version: 12.1     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                  Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf            Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA A10                      On | 00000000:00:07.0 Off |                    0 |
|  0%   36C    P0               40W / 150W|      4MiB / 23028MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A       853      G   /usr/lib/xorg/Xorg                            4MiB |
+---------------------------------------------------------------------------------------+

2. Docker环境配置

a.安装docker

sudo apt-get install -y ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update 
sudo apt-get install -y docker-ce docker-ce-cli containerd.io

测试安装:

sudo docker run hello-world

b.安装nvidia-docker2

curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - 
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) 
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update && sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker

测试安装结果:

sudo docker run --rm --gpus all nvidia/cuda:11.0.3-base-ubuntu20.04 nvidia-smi

如果出现上面nvidia-smi的信息,表示docker与nvidia-docker2都安装完成.

c.录NGC:只要登录一次就行

sudo docker login -u '$oauthtoken' --password-stdin nvcr.io <<< '申请的密钥'

如果出现下面的内容, 则代表安装成功:

Authenticating with existing credentials...
WARNING! Your password will be stored unencrypted in /home/hekun/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

3. Tao Toolkit的安装

a.安装nvidia-pyindex与nvidia-tao

下载Tao安装脚本

wget --content-disposition https://api.ngc.nvidia.com/v2/resources/nvidia/tao/tao-getting-started/versions/4.0.1/zip -O getting_started_v4.0.1.zip
unzip -u getting_started_v4.0.1.zip  -d ./getting_started_v4.0.1 && rm -rf getting_started_v4.0.1.zip && cd ./getting_started_v4.0.1

安装nvidia-pyindex与nvidia-tao

bash setup/quickstart_launcher.sh --install

检查安装

tao info
tao --help

完成到这里, 您会在您的系统中getting_started_v4.0.1/notebooks/tao_launcher_starter_kit目录下看到Tao的一些入门案例, 包含了各种模型的训练教程

b.安装jupyter-lab

pip install jupyter jupyterlab

设置登录密码

export PW='自己填这里'
python3 -c "from notebook.auth.security import set_password;
set_password('$PW','$HOME/.jupyter/jupyter_notebook_config.json')"

c.启动Jupyter-lab命令

jupyter lab --ip 0.0.0.0 --port 8888 --allow-root

d.获取NGC秘钥

  1. 创建NGC账号:这个帐号与NVIDIA Developer账号是独立的,需要单独申请。如果已经有NGC帐号的,请跳过下面申请的流程,直接到第2步“创建NGC密钥”
    1. 登录 https://ngc.nvidia.com 会直接出现 CATALOG画面
    2. 请点击下图右上角 ”Welcome Guest”,然后点选下方 ”Sing in/Sing Up”
    3. 进入后点选 ”NVIDIA Account” 旁边的”Continue”,就会进入下图右的“登陆”或“创建一个账户”的画面,然后按照标准开帐户的流程执行就可以。
  2. 获取NGC密钥:
    1. 登陆NGC,点选右上角用户名,在下拉菜单中选择 ”setup” 选项
    2. 进入下面选项后,点击 ”Get API Key”
    3. 在下面点击右上角”Generate API KEY”会跳出“确认”,点击”confirm”就可以
    4. 生成的这组密钥在整个训练过程以及最后推理时都需要用到,非常关键。由于密钥只有在创建时候能看到内容,日后无法在NGC独立查询,请自行复制做好记录
    5. https://docs.nvidia.com/ngc/ngc-overview/index.html有NGC更完整说明。

4.下载示例

从下面地址下载组委会提供的中文示例和数据集:

链接:https://pan.baidu.com/s/17938QctADI6qaRhJ9FpoCg
提取码:0512

解压之后在jupyter lab里面打开ssd/ssd.ipynb文件按照步骤开始训练模型

猜你喜欢

转载自blog.csdn.net/kunhe0512/article/details/130529766
今日推荐