#!/bin/bash
#SBATCH --job-name=gpt_vox
#SBATCH --nodes=8
#SBATCH --gres=gpu:8
#SBATCH --ntasks-per-node=8  # match this to n_gpu if python
#SBATCH --cpus-per-task=14  # n_cpu*n_task has to be <= cpus per node (~64)
#SBATCH --mem=0


# other useful slurm commands
##SBATCH --exclude=h100-ord01-03-[743,100,424,284]
# --nodelist=h100-ord01-03-[]

# this is fairly arbity
export MASTER_ADDR=$(scontrol show hostnames "$SLURM_JOB_NODELIST" | head -n 1)
export MASTER_PORT=12885

# cluster specific defaults
export OMP_NUM_THREADS=1
export NCCL_CROSS_NIC=2

# explicit cache dirs to not get user conflicts
export TRITON_CACHE_DIR=/mnt/localdisk/.triton_cache_1_$USER

export COMPILE_MERT=1

# using bare python rather than torchrun prevents hanging on nightly
# -K1 means slurm job will crash if run crashes rather than just hang
# -u means python will stream stoud as it comes rather than buffer

#--artist_condition=False \
#--cover_condition=False \
#--overpaint_condition=False \
#--underpaint_condition=False \
# --preload_checkpoint="/app/suno/checkpoints/2025-02-04_21-04-31/last_ckpt.pt" \
    # --train_metas_filename="metas_tr_mini.jsonl" \

# for continuing training
    # --preload_checkpoint="/app/suno/checkpoints/2025-04-24_12-49-10/last_ckpt.pt" \
    # --preload_optimizer=True \
echo "Starting train script..."
srun -K1 /home/victor/anaconda3/envs/suno_clone/bin/python -u train.py \
    --master_addr=$MASTER_ADDR \
    --master_port=$MASTER_PORT \
    \
    --out_dir="/app2/suno/checkpoints" \
    --data_dir="/app2/suno/data/auk_vox" \
    --train_metas_filename="metas_gpt_lyric_tr.jsonl" \
    --val_metas_filename="metas_gpt_lyric_val.jsonl" \
    --preload_strict=False \
    --preload_checkpoint="/app/suno/checkpoints/2025-02-04_21-04-31/last_ckpt.pt" \
    \
    --n_layer=32 \
    --n_head=32 \
    --d_head=128 \
    \
    --allow_infill=False \
    --allow_artist=False \
    --allow_cover=False \
    --allow_overpaint=False \
    --allow_underpaint=False \
    --allow_skip=False \
    --allow_playlist=False \
    --allow_mumble=False \
    --allow_lyrics_randomize=False \
    --allow_stem=False \
    --allow_vox=True \
    \
    --learning_rate=5e-4 \
    --max_iters=50_000 \
    --warmup_iters=1_000 \
    --eval_iters=20 \
    --batch_store_size=2 \
    \
    --fsdp=True \
    --grad_checkpointing=True \
    --compile=False \
    \
    --t_text=3000 \
    --t_audio=7500 \
    --block_size=10_530 \
    \
    --wandb_log=True \
    --wandb_dir="/app/suno/minz/wandb_logs" \
    --wandb_project="gpt-vox" \
    --wandb_run_name="auk_6b_vox_merge_lyric" \
    \
    --preload_optimizer=False \
    --local_cache_dir="/mnt/localdisk/tmp/minz"
