"applications/ColossalChat/coati/ray/utils.py" did not exist on "07c2e3d09cd6bf42f280f20f0cc2ba2eb47677cc"
train_rm.sh 705 Bytes
Newer Older
1
2
3
set_n_least_used_CUDA_VISIBLE_DEVICES() {
    local n=${1:-"9999"}
    echo "GPU Memory Usage:"
4
5
6
7
8
9
10
    local FIRST_N_GPU_IDS=$(nvidia-smi --query-gpu=memory.used --format=csv |
        tail -n +2 |
        nl -v 0 |
        tee /dev/tty |
        sort -g -k 2 |
        awk '{print $1}' |
        head -n $n)
11
12
13
14
    export CUDA_VISIBLE_DEVICES=$(echo $FIRST_N_GPU_IDS | sed 's/ /,/g')
    echo "Now CUDA_VISIBLE_DEVICES is set to:"
    echo "CUDA_VISIBLE_DEVICES=$CUDA_VISIBLE_DEVICES"
}
Fazzie-Maqianli's avatar
Fazzie-Maqianli committed
15

16
17
18
set_n_least_used_CUDA_VISIBLE_DEVICES 2

torchrun --standalone --nproc_per_node=2 train_reward_model.py \
19
20
21
22
    --model 'bloom' \
    --strategy colossalai_zero2 \
    --loss_fn 'log_sig' \
    --dataset 'Anthropic/hh-rlhf'