持久会话管理

后台脚本 + nohup

  1. 写一个脚本,包含需要创建的环境和想运行的程序
code #!/bin/bash
1
2
3
4
5
6
7
8
9
export PATH="/code/miniconda3/bin:$PATH"
source /code/miniconda3/etc/profile.d/conda.sh
conda activate pulid

# 切换到项目目录(按你自己的路径)
cd /code/1015lyric/image-animator/

# 执行你的程序
python train.py -e test --predumped_motion y --emotion_dropout_prob 0.1 --resume_path /code/0915lyric/image-animator/experiments/yianlia_baseline/checkpoints/iter_1500000.pt --max_iter 3000000 --save_iter 10000 --lr 1e-6 --finetuning data
  1. 运行

    nohup bash run_pulid.sh > run.log 2>&1 & disown

  2. 查看进度:

    tail -f run.log,或者直接看run.log文件

  3. 杀死进程:

    ps -ef | grep train.py

    pkill -f train.py

tmux

  1. 创建新会话

    tmux new -s pulid

  2. 在这个会话里运行

    export PATH=”/code/miniconda3/bin:$PATH”
    source /code/miniconda3/etc/profile.d/conda.sh
    conda activate pulid
    python train.py

  3. 之后恢复一下会话就行:

    tmux attach -t pulid

  4. 查看所有会话:

       tmux ls