
if [ $# -ne 2 ]; then
    echo "Please specify exactly two arguments: the folder to save the experiments' log and checkpoints, and the folder of the dataset."
    exit 1
fi

expe_folder=$1
echo "The experiments will be saved in $expe_folder"
dataset_folder=$2
echo "The dataset is in $dataset_folder"

SCENE=(garden bicycle)
BSZ=1
expe_set_name="1g_1b_4k"

# Monitoring Settings
monitor_opts="--enable_timer \
--end2end_time \
--check_gpu_memory \
--check_cpu_memory"

# 4k reconstruction requires even denser sampling
densify_opts="--densify_grad_threshold 0.0001 --percent_dense 0.002"

for scene in ${SCENE[@]}; do
    expe_name="e_${scene}"
    image_folder="images" # train original resolution

    torchrun --standalone --nnodes=1 --nproc-per-node=1 train.py \
        -s ${dataset_folder}/${scene} \
        --images ${image_folder} \
        --llffhold 8 \
        --iterations 50000 \
        --log_interval 250 \
        --model_path ${expe_folder}/1g_1b_4k/${expe_name} \
        --bsz $BSZ \
        $monitor_opts \
        --test_iterations 7000 15000 30000 50000 \
        --save_iterations 7000 30000 50000 \
        --preload_dataset_to_gpu_threshold 0 \
        --eval
done

