type
status
date
slug
summary
tags
category
icon
password
URL
 
 
 

0 最实用的小技巧: 不知道或者忘记了指令, 就使用 -h

 
-h 虽然不能提供所有的det 指令, 但是可以在很多场景下解决指令忘记的问题, 对于刚刚使用det的用户也很适用。
det 有那些可选参数
[user@host]$ det -h usage: det [-h] [-u username] [-m address] [-v] command ... Determined command-line client positional arguments: command help show help for this command auth manage auth agent (a) manage agents command (cmd) manage commands checkpoint (c) manage checkpoints deploy (d) manage deployments experiment (e) manage experiments job (j) manage jobs master manage master model (m) manage models notebook manage notebooks oauth manage OAuth preview-search preview search project (p) manage projects rbac manage roles based access controls resources (res) query historical resource allocation shell manage shells slot (s) manage slots task manage tasks (commands, experiments, notebooks, shells, tensorboards) template (tpl) manage config templates tensorboard manage TensorBoard instances trial (t) manage trials user-group manage user groups user (u) manage users version show version information workspace (w) manage workspaces options: -h, --help show this help message and exit -u username, --user username run as the given user (default: None) -m address, --master address master address (default: 192.168.5.173) -v, --version print CLI version and exit
det notebook 有那些参数
[user@host]$ det notebook -h usage: det notebook [-h] subcommand ... positional arguments: subcommand help show help for this command config display notebook config kill kill a notebook list (ls) list notebooks logs fetch notebook logs open open an existing notebook set set notebook attributes start start a new notebook options: -h, --help show this help message and exit

1 多种交互方式:

 
det是一款支持多种交互方式的开源深度学习训练平台。 里面有多种交互方式,用户可以根据自己喜好和需要选取适合的交互方式。
其中常用的有三种:
  • shell : 通过命令行终端,在一个docker镜像下进行交互。
  • jupyter notebook : 使用jupyter的交互,可以通过网页访问,其中也可以jupyter提供的用terminal交互。
  • determined experiment : 类似于slurm sbath的形式,以作业(实验)的形式,提交任务给determined, 提交的任务会根据determined的规则被调度和执行。
 

1.1 determined shell

determined 提供了一种terminal的shell交互方式,通过在DET MASTER上启动一个docker container使用户能够以root权限对资源进行操作。
 
  • 最简单的启动determined shell的方法:
    • det shell start
      利用上述代码将会启动一个使用默认镜像的, 拥有1块4090 GPU资源的docker container, 默认是ubuntu系统, root权限。
  • 使用startup-hook的 determined shell
    • 当你使用 det shell start 启动一个terminal之后, 你发现, 里面怎么什么都没有, 没有vim, 没有unzip, 虽然你此时有root权限, 可以随意安装软件, 但是下一次你再次启动的时候, 上一次安装的软件全消失了。
      有没有一种方法可以让我的环境固定下来, 每次启动后都有我需要的软件应用呢?
      1. 最简单的方法:你可以通过startup-hook 来解决(startup-hook 不仅针对shell,notebook适用, 对experiment也同样适用)
        1. 在启动目录下, 设置一个 hook 文件夹(名称可以随意), 在 hook 文件夹中,放置一个固定的称为startup-hook.sh 的文件,在其中, 你可以编写一些shell指令, 来安装常用应用等。
          startup-hook.sh 的一个example(对于shell 和 notebook来说)
          apt update apt install -y tmux htop vim unzip
          此时启动det shell需要增加一个额外的 —context 参数来使得det能够在启动过程中安装需要的软件和环境
          det shell start --context ./hook
           
          此外, startup-hook 还能为 experiment 提供软件和python 包等环境(experiment是提交任务式, 不能想shell上手动安装需要的软件和python包, 因此可能对于一些场景必须要使用到 startup-hook , 如官网docs演示的那样
          apt-get update && apt-get install -y wget python3 -m pip install pandas
      1. 较复杂的方法:除了startup-hook 之外, 也可以自己手动构建属于自己的镜像, 在镜像中预制相应的环境(软件, python包…) 每次使用det加载自己的镜像, 从而省去了繁琐的软件和环境安装过程。 startup-hook 并没有做到这一点, 它每次启动的时候仍然需要安装软件, 只不过从手动变成了自动而已。
  • 网络共享文件夹用起来
    • 4090集群上放置了一些具有较大存储的网络共享文件夹:如: /home/nfs_data/home/nfs_data_02 这些共享文件夹部署在ACT内网环境下, 可以通过ACT内网访问。
    • determined 每次shell 或者 jupyter notebook 退出后文件就没有了, 怎么办?
      • 在启动shell或notebook的时候, 使用带有config的启动方式, 在相应的 .yaml 文件中利用 bind_mount 指令来将网络文件夹映射到docker内部环境上
        • bind_mounts: - host_path: /home/nfs_data container_path: /root/data
          这时, 你就可以在det启动的docker中的 /root/data 目录下访问到 网络文件夹 /home/nfs_data 下的数据了, 并且可以将每次实验的结果也保存到 /home/nfs_data 下,通过这样的方式来实现数据可持久化操作。
    • determined的shell中也可以想裸机中一样方便的使用conda环境吗?
      • 这一点可以轻松利用网络共享文件夹和 .yaml config实现
        •  
          推荐不要在Miniconda安装的时候进行 bash init, 而是在后续使用到conda的时候 通过 source /path/miniconda3/bin/activate 的方式激活conda环境
 
 

1.2 jupyter notebook

 
 

1.3 determined experiment

 
 

2.通过ssh连接determined shell

 
 

3.自定义端口访问determined docker内部服务

 
 
SCI 斜体词(latin)汇总ChatGPT Plugins 使用记录

  • Twikoo
  • Giscus
  • Utterance