p-doom/crowd-code-dataset-0.2 huggingface dataset:
[tab] slurm/dev/franz/berlin/atari/tokenizer.sh (shellscript)
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:1
#SBATCH --time=24:00:00
#SBATCH --cpus-per-task=8
#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/tokenizer/%x_%j.log
#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/tokenizer/%x_%j.log
#SBATCH --job-name=tokenizer_atari_alien_dev
#SBATCH --requeue
#SBATCH --signal=b:usr1@300 # 5 min before timeout

# --- signal trap to requeue job before timeout ---
requeue_job() {
    echo "[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID..."
    # optional: trigger checkpoint saving here
    # e.g., touch $checkpoint_dir/requeue_trigger
    scontrol requeue $SLURM_JOB_ID
    exit 0
}

trap requeue_job sigusr1

# set checkpoint flag based on restart count
restart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)

if [ $restart_count -eq 0 ]; then
    restore_ckpt_flag="--no-restore-ckpt"
else
    restore_ckpt_flag="--restore-ckpt"
fi

# Log the sbatch script
cat $0

source .venv/bin/activate

job_name=$SLURM_JOB_NAME
slurm_job_id=$SLURM_JOB_ID

# Require ENV_NAME to be provided via sbatch --export=ENV_NAME=...
if [ -z "${ENV_NAME:-}" ]; then
    echo "ENV_NAME must be provided (e.g., sbatch --export=ALL,ENV_NAME=alien $0)" >&2
    exit 2
fi

tags="atari ${ENV_NAME} tokenizer dev lr_3e-5"

array_records_dir="/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/${ENV_NAME}"
CHECKPOINT_DIR="/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/atari/${ENV_NAME}/tokenizer/${job_name}_${slurm_job_id}"
mkdir -p $CHECKPOINT_DIR

env | grep SLURM

current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" != "prepend-action-maskgit" ]; then
    echo "This script must be run from the prepend-action-maskgit branch. Current branch is $current_branch. Exiting."
    exit 1
fi

srun python jasmine/train_tokenizer.py \
    --patch_size=16 \
    --image_height=84 \
    --image_width=84 \
    --num_steps=50_000 \
    --max_lr=3e-5 \
    --warmup_steps=5000 \
    --wsd_decay_steps=5000 \
    --save_ckpt \
    $restore_ckpt_flag \
    --wandb_id $SLURM_JOB_ID \
    --ckpt_dir $CHECKPOINT_DIR \
    --name="${job_name}_${slurm_job_id}" \
    --tags $tags \
    --entity instant-uv \
    --project jafar \
    --data_dir="${array_records_dir}/train" \
    --val_data_dir="${array_records_dir}/val" &

child_pid=$!

wait $child_pid
[tab] slurm/dev/franz/berlin/atari/dynamics.sh (shellscript)
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --time=24:00:00
#SBATCH --cpus-per-task=8
#SBATCH --gres=gpu:1
#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/dynamics/%x_%j.log
#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/dynamics/%x_%j.log
#SBATCH --job-name=dynamics_atari_alien_dev
#SBATCH --requeue
#SBATCH --signal=b:usr1@300 # 5 min before timeout

# --- signal trap to requeue job before timeout ---
requeue_job() {
    echo "[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID..."
    # optional: trigger checkpoint saving here
    # e.g., touch $checkpoint_dir/requeue_trigger
    scontrol requeue $SLURM_JOB_ID
    exit 0
}

trap requeue_job sigusr1

# set checkpoint flag based on restart count
restart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)

if [ $restart_count -eq 0 ]; then
    restore_ckpt_flag="--no-restore-ckpt"
else
    restore_ckpt_flag="--restore-ckpt"
fi



# Log the sbatch script
cat $0

source .venv/bin/activate

job_name=$SLURM_JOB_NAME
slurm_job_id=$SLURM_JOB_ID

# Require ENV_NAME to be provided via sbatch --export=ENV_NAME=...
if [ -z "${ENV_NAME:-}" ]; then
    echo "ENV_NAME must be provided (e.g., sbatch --export=ALL,ENV_NAME=alien $0)" >&2
    exit 2
fi

tags="atari ${ENV_NAME} dynamics dev"

array_records_dir="/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/${ENV_NAME}"

# Require TOKENIZER_CKPT_DIR to be provided to avoid hardcoding
if [ -z "${TOKENIZER_CKPT_DIR:-}" ]; then
    echo "TOKENIZER_CKPT_DIR must be provided (e.g., sbatch --export=ALL,ENV_NAME=$ENV_NAME,TOKENIZER_CKPT_DIR=/path/to/tokenizer_ckpt $0)" >&2
    exit 2
fi

tokenizer_ckpt_dir="${TOKENIZER_CKPT_DIR}"
CHECKPOINT_DIR="/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/atari/${ENV_NAME}/dynamics/${job_name}/${slurm_job_id}"
mkdir -p $CHECKPOINT_DIR

env | grep SLURM

current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" != "prepend-action-maskgit" ]; then
    echo "This script must be run from the prepend-action-maskgit branch. Current branch is $current_branch. Exiting."
    exit 1
fi

srun python jasmine/train_dynamics.py \
    --patch_size=16 \
    --image_height=84 \
    --image_width=84 \
    --save_ckpt \
    $restore_ckpt_flag \
    --wandb_id $SLURM_JOB_ID \
    --ckpt_dir $CHECKPOINT_DIR \
    --name="${job_name}_${slurm_job_id}" \
    --tags ${tags} \
    --entity instant-uv \
    --project jafar \
    --tokenizer_checkpoint="${tokenizer_ckpt_dir}" \
    --val_data_dir="${array_records_dir}/val" \
    --data_dir="${array_records_dir}/train" &

child_pid=$!

wait $child_pid
[tab] slurm/dev/franz/berlin/coinrun/dynamics_debug/debug_gt_actions.sh (shellscript)
# Log the sbatch script
cat $0

source .venv/bin/activate

array_records_dir="/fast/project/HFMI_SynergyUnit/jafar_ws/data/coinrun/array_records_500m_seed_w_increment"
tokenizer_ckpt_dir="/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/tokenizer/tokenizer_coinrun_mila_submission_29736/"

env | grep SLURM

current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" != "prepend-action-maskgit" ]; then
    echo "This script must be run from the prepend-action-maskgit branch. Current branch is $current_branch. Exiting."
    exit 1
fi

srun python jasmine/train_dynamics.py \
    --use_gt_actions \
    --no-log \
    --ckpt_dir test_ckpt_dir \
    --tokenizer_checkpoint="${tokenizer_ckpt_dir}" \
    --val_data_dir="${array_records_dir}/val" \
    --data_dir="${array_records_dir}/train" &

child_pid=$!

wait $child_pid
[tab] slurm/jobs/franz/berlin/coinrun/mila_submission/legacy_runs_50M_dataset/coinrun_tokenizer_base.sh (shellscript)
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:1
#SBATCH --time=24:00:00
#SBATCH --cpus-per-task=8
#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/coinrun/tokenizer/%x_%j.log
#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/coinrun/tokenizer/%x_%j.log
#SBATCH --job-name=tokenizer_coinrun_mila_submission
#SBATCH --requeue
#SBATCH --signal=b:usr1@300 # 5 min before timeout

# --- signal trap to requeue job before timeout ---
requeue_job() {
    echo "[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID..."
    # optional: trigger checkpoint saving here
    # e.g., touch $checkpoint_dir/requeue_trigger
    scontrol requeue $SLURM_JOB_ID
    exit 0
}

trap requeue_job sigusr1

# set checkpoint flag based on restart count
restart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)

if [ $restart_count -eq 0 ]; then
    restore_ckpt_flag="--no-restore-ckpt"
else
    restore_ckpt_flag="--restore-ckpt"
fi

# Log the sbatch script
cat $0

source .venv/bin/activate

job_name=$SLURM_JOB_NAME
slurm_job_id=$SLURM_JOB_ID

tags="coinrun tokenizer 500m_dataset mila_submission"

array_records_dir="/fast/project/HFMI_SynergyUnit/jafar_ws/data/coinrun/array_records_500m_seed_w_increment"
CHECKPOINT_DIR="/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/coinrun/tokenizer/${job_name}_${slurm_job_id}"
mkdir -p $CHECKPOINT_DIR

env | grep SLURM

srun python jasmine/train_tokenizer.py \
    --save_ckpt \
    $restore_ckpt_flag \
    --wandb_id $SLURM_JOB_ID \
    --ckpt_dir $CHECKPOINT_DIR \
    --name="${job_name}_${slurm_job_id}" \
    --tags $tags \
    --entity instant-uv \
    --project jafar \
    --data_dir="${array_records_dir}/train" \
    --val_data_dir="${array_records_dir}/val" &

child_pid=$!

wait $child_pid
[terminal_command] TERMINAL ()
uv run jasmine_data/atari/visualize_array_record.py --input=/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/bank_heist/train/data_0575.array_record --output_dir=test_vis --height=84 --width=84 --env_id=ALE/BankHeist-v5
[terminal_command] TERMINAL ()
uv run jasmine_data/atari/visualize_array_record.py --input=/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/bank_heist/train/data_0001.array_record --output_dir=test_vis --height=84 --width=84 --env_id=ALE/BankHeist-v5
[tab] slurm/dev/franz/berlin/atari/spawn_tokenizers.sh (shellscript)
#!/usr/bin/env bash

set -euo pipefail

REPO_ROOT="/home/franz.srambical/jafar"

DATA_ROOT="${DATA_ROOT:-/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari}"

TOKENIZER_SCRIPT="${TOKENIZER_SCRIPT:-$REPO_ROOT/slurm/dev/franz/berlin/atari/tokenizer.sh}"

if [ "$#" -gt 0 ]; then
    ENV_LIST=("$@")
else
    if [ ! -d "$DATA_ROOT" ]; then
        echo "DATA_ROOT does not exist: $DATA_ROOT" >&2
        exit 1
    fi
    # list immediate subdirectories (candidate env names)
    mapfile -t ENV_LIST < <(find "$DATA_ROOT" -mindepth 1 -maxdepth 1 -type d -printf '%f
' | sort)
fi

echo "Submitting tokenizer jobs for environments: ${ENV_LIST[*]}"

for env in "${ENV_LIST[@]}"; do
    env_dir="$DATA_ROOT/$env"
    if [ ! -d "$env_dir/train" ] || [ ! -d "$env_dir/val" ]; then
        echo "Skipping $env (missing train/val under $env_dir)"
        continue
    fi

    job_name="tokenizer_atari_${env}_dev"

    job_id=$(sbatch --parsable \
        --job-name="$job_name" \
        --chdir="$REPO_ROOT" \
        --export=ALL,ENV_NAME="$env" \
        "$TOKENIZER_SCRIPT")

    echo "Submitted $job_name (ENV_NAME=$env) as job $job_id"
done
[tab] slurm/dev/franz/berlin/atari/spawn_lams.sh (shellscript)
#!/usr/bin/env bash

set -euo pipefail

REPO_ROOT="/home/franz.srambical/jafar"

DATA_ROOT="${DATA_ROOT:-/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari}"

LAM_SCRIPT="${LAM_SCRIPT:-$REPO_ROOT/slurm/dev/franz/berlin/atari/lam.sh}"

if [ "$#" -gt 0 ]; then
    ENV_LIST=("$@")
else
    if [ ! -d "$DATA_ROOT" ]; then
        echo "DATA_ROOT does not exist: $DATA_ROOT" >&2
        exit 1
    fi
    mapfile -t ENV_LIST < <(find "$DATA_ROOT" -mindepth 1 -maxdepth 1 -type d -printf '%f
' | sort)
fi

echo "Submitting LAM jobs for environments: ${ENV_LIST[*]}"

for env in "${ENV_LIST[@]}"; do
    env_dir="$DATA_ROOT/$env"
    if [ ! -d "$env_dir/train" ] || [ ! -d "$env_dir/val" ]; then
        echo "Skipping $env (missing train/val under $env_dir)"
        continue
    fi

    job_name="lam_atari_${env}_dev"

    job_id=$(sbatch --parsable \
        --job-name="$job_name" \
        --chdir="$REPO_ROOT" \
        --export=ALL,ENV_NAME="$env" \
        "$LAM_SCRIPT")

    echo "Submitted $job_name (ENV_NAME=$env) as job $job_id"
done
[tab] slurm/dev/franz/berlin/atari/tokenizer_lr_3e-4/spawn_tokenizers.sh (shellscript)
#!/usr/bin/env bash

set -euo pipefail

REPO_ROOT="/home/franz.srambical/jafar"

DATA_ROOT="${DATA_ROOT:-/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari}"

TOKENIZER_SCRIPT="${TOKENIZER_SCRIPT:-$REPO_ROOT/slurm/dev/franz/berlin/atari/tokenizer.sh}"

if [ "$#" -gt 0 ]; then
    ENV_LIST=("$@")
else
    if [ ! -d "$DATA_ROOT" ]; then
        echo "DATA_ROOT does not exist: $DATA_ROOT" >&2
        exit 1
    fi
    # list immediate subdirectories (candidate env names)
    mapfile -t ENV_LIST < <(find "$DATA_ROOT" -mindepth 1 -maxdepth 1 -type d -printf '%f
' | sort)
fi

echo "Submitting tokenizer jobs for environments: ${ENV_LIST[*]}"

for env in "${ENV_LIST[@]}"; do
    env_dir="$DATA_ROOT/$env"
    if [ ! -d "$env_dir/train" ] || [ ! -d "$env_dir/val" ]; then
        echo "Skipping $env (missing train/val under $env_dir)"
        continue
    fi

    job_name="tokenizer_atari_${env}_dev_lr_3e-6"

    job_id=$(sbatch --parsable \
        --job-name="$job_name" \
        --chdir="$REPO_ROOT" \
        --export=ALL,ENV_NAME="$env" \
        "$TOKENIZER_SCRIPT")

    echo "Submitted $job_name (ENV_NAME=$env) as job $job_id"
done
[tab] slurm/dev/franz/berlin/atari/tokenizer_lr_3e-4/tokenizer.sh (shellscript)
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:1
#SBATCH --time=24:00:00
#SBATCH --cpus-per-task=8
#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/tokenizer/%x_%j.log
#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/tokenizer/%x_%j.log
#SBATCH --job-name=tokenizer_atari_dev
#SBATCH --requeue
#SBATCH --signal=b:usr1@300 # 5 min before timeout

# --- signal trap to requeue job before timeout ---
requeue_job() {
    echo "[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID..."
    # optional: trigger checkpoint saving here
    # e.g., touch $checkpoint_dir/requeue_trigger
    scontrol requeue $SLURM_JOB_ID
    exit 0
}

trap requeue_job sigusr1

# set checkpoint flag based on restart count
restart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)

if [ $restart_count -eq 0 ]; then
    restore_ckpt_flag="--no-restore-ckpt"
else
    restore_ckpt_flag="--restore-ckpt"
fi

# Log the sbatch script
cat $0

source .venv/bin/activate

job_name=$SLURM_JOB_NAME
slurm_job_id=$SLURM_JOB_ID

# Require ENV_NAME to be provided via sbatch --export=ENV_NAME=...
if [ -z "${ENV_NAME:-}" ]; then
    echo "ENV_NAME must be provided (e.g., sbatch --export=ALL,ENV_NAME=alien $0)" >&2
    exit 2
fi

tags="atari ${ENV_NAME} tokenizer dev lr_3e-6"

array_records_dir="/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/${ENV_NAME}"
CHECKPOINT_DIR="/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/atari/${ENV_NAME}/tokenizer/${job_name}_${slurm_job_id}"
mkdir -p $CHECKPOINT_DIR

env | grep SLURM

current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" != "prepend-action-maskgit" ]; then
    echo "This script must be run from the prepend-action-maskgit branch. Current branch is $current_branch. Exiting."
    exit 1
fi

srun python jasmine/train_tokenizer.py \
    --patch_size=16 \
    --image_height=84 \
    --image_width=84 \
    --num_steps=50_000 \
    --max_lr=3e-6 \
    --warmup_steps=5000 \
    --wsd_decay_steps=5000 \
    --save_ckpt \
    $restore_ckpt_flag \
    --wandb_id $SLURM_JOB_ID \
    --ckpt_dir $CHECKPOINT_DIR \
    --name="${job_name}_${slurm_job_id}" \
    --tags $tags \
    --entity instant-uv \
    --project jafar \
    --data_dir="${array_records_dir}/train" \
    --val_data_dir="${array_records_dir}/val" &

child_pid=$!

wait $child_pid
[tab] slurm/dev/franz/berlin/atari/tokenizer_lr_3e-5/tokenizer.sh (shellscript)
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:1
#SBATCH --time=24:00:00
#SBATCH --cpus-per-task=8
#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/tokenizer/%x_%j.log
#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/tokenizer/%x_%j.log
#SBATCH --job-name=tokenizer_atari_dev_lr_3e-4
#SBATCH --requeue
#SBATCH --signal=b:usr1@300 # 5 min before timeout

# --- signal trap to requeue job before timeout ---
requeue_job() {
    echo "[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID..."
    # optional: trigger checkpoint saving here
    # e.g., touch $checkpoint_dir/requeue_trigger
    scontrol requeue $SLURM_JOB_ID
    exit 0
}

trap requeue_job sigusr1

# set checkpoint flag based on restart count
restart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)

if [ $restart_count -eq 0 ]; then
    restore_ckpt_flag="--no-restore-ckpt"
else
    restore_ckpt_flag="--restore-ckpt"
fi

# Log the sbatch script
cat $0

source .venv/bin/activate

job_name=$SLURM_JOB_NAME
slurm_job_id=$SLURM_JOB_ID

# Require ENV_NAME to be provided via sbatch --export=ENV_NAME=...
if [ -z "${ENV_NAME:-}" ]; then
    echo "ENV_NAME must be provided (e.g., sbatch --export=ALL,ENV_NAME=alien $0)" >&2
    exit 2
fi

tags="atari ${ENV_NAME} tokenizer dev lr_3e-4"

array_records_dir="/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/${ENV_NAME}"
CHECKPOINT_DIR="/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/atari/${ENV_NAME}/tokenizer/${job_name}_${slurm_job_id}"
mkdir -p $CHECKPOINT_DIR

env | grep SLURM

current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" != "prepend-action-maskgit" ]; then
    echo "This script must be run from the prepend-action-maskgit branch. Current branch is $current_branch. Exiting."
    exit 1
fi

srun python jasmine/train_tokenizer.py \
    --patch_size=16 \
    --image_height=84 \
    --image_width=84 \
    --num_steps=50_000 \
    --max_lr=3e-4 \
    --warmup_steps=5000 \
    --wsd_decay_steps=5000 \
    --save_ckpt \
    $restore_ckpt_flag \
    --wandb_id $SLURM_JOB_ID \
    --ckpt_dir $CHECKPOINT_DIR \
    --name="${job_name}_${slurm_job_id}" \
    --tags $tags \
    --entity instant-uv \
    --project jafar \
    --data_dir="${array_records_dir}/train" \
    --val_data_dir="${array_records_dir}/val" &

child_pid=$!

wait $child_pid
[tab] slurm/dev/franz/berlin/atari/tokenizer_lr_3e-5/spawn_tokenizers.sh (shellscript)
#!/usr/bin/env bash

set -euo pipefail

REPO_ROOT="/home/franz.srambical/jafar"

DATA_ROOT="${DATA_ROOT:-/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari}"

TOKENIZER_SCRIPT="${TOKENIZER_SCRIPT:-$REPO_ROOT/slurm/dev/franz/berlin/atari/tokenizer_lr_3e-4/tokenizer.sh}"

if [ "$#" -gt 0 ]; then
    ENV_LIST=("$@")
else
    if [ ! -d "$DATA_ROOT" ]; then
        echo "DATA_ROOT does not exist: $DATA_ROOT" >&2
        exit 1
    fi
    # list immediate subdirectories (candidate env names)
    mapfile -t ENV_LIST < <(find "$DATA_ROOT" -mindepth 1 -maxdepth 1 -type d -printf '%f
' | sort)
fi

echo "Submitting tokenizer jobs for environments: ${ENV_LIST[*]}"

for env in "${ENV_LIST[@]}"; do
    env_dir="$DATA_ROOT/$env"
    if [ ! -d "$env_dir/train" ] || [ ! -d "$env_dir/val" ]; then
        echo "Skipping $env (missing train/val under $env_dir)"
        continue
    fi

    job_name="tokenizer_atari_${env}_dev_lr_3e-4"

    job_id=$(sbatch --parsable \
        --job-name="$job_name" \
        --chdir="$REPO_ROOT" \
        --export=ALL,ENV_NAME="$env" \
        "$TOKENIZER_SCRIPT")

    echo "Submitted $job_name (ENV_NAME=$env) as job $job_id"
done
[tab] slurm/dev/franz/berlin/atari/tokenizer_lr_3e-6/spawn_tokenizers.sh (shellscript)
#!/usr/bin/env bash

set -euo pipefail

REPO_ROOT="/home/franz.srambical/jafar"

DATA_ROOT="${DATA_ROOT:-/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari}"

TOKENIZER_SCRIPT="${TOKENIZER_SCRIPT:-$REPO_ROOT/slurm/dev/franz/berlin/atari/tokenizer_lr_3e-5/tokenizer.sh}"

if [ "$#" -gt 0 ]; then
    ENV_LIST=("$@")
else
    if [ ! -d "$DATA_ROOT" ]; then
        echo "DATA_ROOT does not exist: $DATA_ROOT" >&2
        exit 1
    fi
    # list immediate subdirectories (candidate env names)
    mapfile -t ENV_LIST < <(find "$DATA_ROOT" -mindepth 1 -maxdepth 1 -type d -printf '%f
' | sort)
fi

echo "Submitting tokenizer jobs for environments: ${ENV_LIST[*]}"

for env in "${ENV_LIST[@]}"; do
    env_dir="$DATA_ROOT/$env"
    if [ ! -d "$env_dir/train" ] || [ ! -d "$env_dir/val" ]; then
        echo "Skipping $env (missing train/val under $env_dir)"
        continue
    fi

    job_name="tokenizer_atari_${env}_dev_lr_3e-5"

    job_id=$(sbatch --parsable \
        --job-name="$job_name" \
        --chdir="$REPO_ROOT" \
        --export=ALL,ENV_NAME="$env" \
        "$TOKENIZER_SCRIPT")

    echo "Submitted $job_name (ENV_NAME=$env) as job $job_id"
done
[tab] slurm/dev/franz/berlin/atari/tokenizer_lr_3e-6/tokenizer.sh (shellscript)
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:1
#SBATCH --time=24:00:00
#SBATCH --cpus-per-task=8
#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/tokenizer/%x_%j.log
#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/tokenizer/%x_%j.log
#SBATCH --job-name=tokenizer_atari_dev_lr_3e-5
#SBATCH --requeue
#SBATCH --signal=b:usr1@300 # 5 min before timeout

# --- signal trap to requeue job before timeout ---
requeue_job() {
    echo "[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID..."
    # optional: trigger checkpoint saving here
    # e.g., touch $checkpoint_dir/requeue_trigger
    scontrol requeue $SLURM_JOB_ID
    exit 0
}

trap requeue_job sigusr1

# set checkpoint flag based on restart count
restart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)

if [ $restart_count -eq 0 ]; then
    restore_ckpt_flag="--no-restore-ckpt"
else
    restore_ckpt_flag="--restore-ckpt"
fi

# Log the sbatch script
cat $0

source .venv/bin/activate

job_name=$SLURM_JOB_NAME
slurm_job_id=$SLURM_JOB_ID

# Require ENV_NAME to be provided via sbatch --export=ENV_NAME=...
if [ -z "${ENV_NAME:-}" ]; then
    echo "ENV_NAME must be provided (e.g., sbatch --export=ALL,ENV_NAME=alien $0)" >&2
    exit 2
fi

tags="atari ${ENV_NAME} tokenizer dev lr_3e-5"

array_records_dir="/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/${ENV_NAME}"
CHECKPOINT_DIR="/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/atari/${ENV_NAME}/tokenizer/${job_name}_${slurm_job_id}"
mkdir -p $CHECKPOINT_DIR

env | grep SLURM

current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" != "prepend-action-maskgit" ]; then
    echo "This script must be run from the prepend-action-maskgit branch. Current branch is $current_branch. Exiting."
    exit 1
fi

srun python jasmine/train_tokenizer.py \
    --patch_size=16 \
    --image_height=84 \
    --image_width=84 \
    --num_steps=50_000 \
    --max_lr=3e-5 \
    --warmup_steps=5000 \
    --wsd_decay_steps=5000 \
    --save_ckpt \
    $restore_ckpt_flag \
    --wandb_id $SLURM_JOB_ID \
    --ckpt_dir $CHECKPOINT_DIR \
    --name="${job_name}_${slurm_job_id}" \
    --tags $tags \
    --entity instant-uv \
    --project jafar \
    --data_dir="${array_records_dir}/train" \
    --val_data_dir="${array_records_dir}/val" &

child_pid=$!

wait $child_pid
[tab] slurm/dev/franz/berlin/atari/tokenizer_lr_3e-4_full_precision/tokenizer.sh (shellscript)
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:1
#SBATCH --time=24:00:00
#SBATCH --cpus-per-task=8
#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/tokenizer/%x_%j.log
#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/tokenizer/%x_%j.log
#SBATCH --job-name=tokenizer_atari_dev_lr_3e-4
#SBATCH --requeue
#SBATCH --signal=b:usr1@300 # 5 min before timeout

# --- signal trap to requeue job before timeout ---
requeue_job() {
    echo "[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID..."
    # optional: trigger checkpoint saving here
    # e.g., touch $checkpoint_dir/requeue_trigger
    scontrol requeue $SLURM_JOB_ID
    exit 0
}

trap requeue_job sigusr1

# set checkpoint flag based on restart count
restart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)

if [ $restart_count -eq 0 ]; then
    restore_ckpt_flag="--no-restore-ckpt"
else
    restore_ckpt_flag="--restore-ckpt"
fi

# Log the sbatch script
cat $0

source .venv/bin/activate

job_name=$SLURM_JOB_NAME
slurm_job_id=$SLURM_JOB_ID

# Require ENV_NAME to be provided via sbatch --export=ENV_NAME=...
if [ -z "${ENV_NAME:-}" ]; then
    echo "ENV_NAME must be provided (e.g., sbatch --export=ALL,ENV_NAME=alien $0)" >&2
    exit 2
fi

tags="atari ${ENV_NAME} tokenizer dev lr_3e-4"

array_records_dir="/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/${ENV_NAME}"
CHECKPOINT_DIR="/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/atari/${ENV_NAME}/tokenizer/${job_name}_${slurm_job_id}"
mkdir -p $CHECKPOINT_DIR

env | grep SLURM

current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" != "prepend-action-maskgit" ]; then
    echo "This script must be run from the prepend-action-maskgit branch. Current branch is $current_branch. Exiting."
    exit 1
fi

srun python jasmine/train_tokenizer.py \
    --patch_size=16 \
    --image_height=84 \
    --image_width=84 \
    --num_steps=50_000 \
    --max_lr=3e-4 \
    --warmup_steps=5000 \
    --wsd_decay_steps=5000 \
    --save_ckpt \
    $restore_ckpt_flag \
    --wandb_id $SLURM_JOB_ID \
    --ckpt_dir $CHECKPOINT_DIR \
    --name="${job_name}_${slurm_job_id}" \
    --tags $tags \
    --entity instant-uv \
    --project jafar \
    --data_dir="${array_records_dir}/train" \
    --val_data_dir="${array_records_dir}/val" &

child_pid=$!

wait $child_pid
[tab] slurm/dev/franz/berlin/atari/tokenizer_lr_3e-5_full_precision/tokenizer.sh (shellscript)
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:1
#SBATCH --time=24:00:00
#SBATCH --cpus-per-task=8
#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/tokenizer/%x_%j.log
#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/tokenizer/%x_%j.log
#SBATCH --job-name=tokenizer_atari_dev_lr_3e-5
#SBATCH --requeue
#SBATCH --signal=b:usr1@300 # 5 min before timeout

# --- signal trap to requeue job before timeout ---
requeue_job() {
    echo "[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID..."
    # optional: trigger checkpoint saving here
    # e.g., touch $checkpoint_dir/requeue_trigger
    scontrol requeue $SLURM_JOB_ID
    exit 0
}

trap requeue_job sigusr1

# set checkpoint flag based on restart count
restart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)

if [ $restart_count -eq 0 ]; then
    restore_ckpt_flag="--no-restore-ckpt"
else
    restore_ckpt_flag="--restore-ckpt"
fi

# Log the sbatch script
cat $0

source .venv/bin/activate

job_name=$SLURM_JOB_NAME
slurm_job_id=$SLURM_JOB_ID

# Require ENV_NAME to be provided via sbatch --export=ENV_NAME=...
if [ -z "${ENV_NAME:-}" ]; then
    echo "ENV_NAME must be provided (e.g., sbatch --export=ALL,ENV_NAME=alien $0)" >&2
    exit 2
fi

tags="atari ${ENV_NAME} tokenizer dev lr_3e-5"

array_records_dir="/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/${ENV_NAME}"
CHECKPOINT_DIR="/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/atari/${ENV_NAME}/tokenizer/${job_name}_${slurm_job_id}"
mkdir -p $CHECKPOINT_DIR

env | grep SLURM

current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" != "prepend-action-maskgit" ]; then
    echo "This script must be run from the prepend-action-maskgit branch. Current branch is $current_branch. Exiting."
    exit 1
fi

srun python jasmine/train_tokenizer.py \
    --patch_size=16 \
    --image_height=84 \
    --image_width=84 \
    --num_steps=50_000 \
    --max_lr=3e-5 \
    --warmup_steps=5000 \
    --wsd_decay_steps=5000 \
    --save_ckpt \
    $restore_ckpt_flag \
    --wandb_id $SLURM_JOB_ID \
    --ckpt_dir $CHECKPOINT_DIR \
    --name="${job_name}_${slurm_job_id}" \
    --tags $tags \
    --entity instant-uv \
    --project jafar \
    --data_dir="${array_records_dir}/train" \
    --val_data_dir="${array_records_dir}/val" &

child_pid=$!

wait $child_pid
[tab] slurm/dev/franz/berlin/atari/tokenizer_lr_3e-6_full_precision/tokenizer.sh (shellscript)
#!/usr/bin/env bash

#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gres=gpu:1
#SBATCH --time=24:00:00
#SBATCH --cpus-per-task=8
#SBATCH --output=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/tokenizer/%x_%j.log
#SBATCH --error=/fast/project/HFMI_SynergyUnit/jafar_ws/logs/franz/atari/tokenizer/%x_%j.log
#SBATCH --job-name=tokenizer_atari_dev_lr_3e-6
#SBATCH --requeue
#SBATCH --signal=b:usr1@300 # 5 min before timeout

# --- signal trap to requeue job before timeout ---
requeue_job() {
    echo "[$(date)] caught sigusr1 (timeout warning), requeueing slurm job $SLURM_JOB_ID..."
    # optional: trigger checkpoint saving here
    # e.g., touch $checkpoint_dir/requeue_trigger
    scontrol requeue $SLURM_JOB_ID
    exit 0
}

trap requeue_job sigusr1

# set checkpoint flag based on restart count
restart_count=$(scontrol show job $SLURM_JOB_ID | grep -o 'Restarts=[0-9]*' | cut -d'=' -f2)

if [ $restart_count -eq 0 ]; then
    restore_ckpt_flag="--no-restore-ckpt"
else
    restore_ckpt_flag="--restore-ckpt"
fi

# Log the sbatch script
cat $0

source .venv/bin/activate

job_name=$SLURM_JOB_NAME
slurm_job_id=$SLURM_JOB_ID

# Require ENV_NAME to be provided via sbatch --export=ENV_NAME=...
if [ -z "${ENV_NAME:-}" ]; then
    echo "ENV_NAME must be provided (e.g., sbatch --export=ALL,ENV_NAME=alien $0)" >&2
    exit 2
fi

tags="atari ${ENV_NAME} tokenizer dev lr_3e-6"

array_records_dir="/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari/${ENV_NAME}"
CHECKPOINT_DIR="/fast/project/HFMI_SynergyUnit/jafar_ws/checkpoints/atari/${ENV_NAME}/tokenizer/${job_name}_${slurm_job_id}"
mkdir -p $CHECKPOINT_DIR

env | grep SLURM

current_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$current_branch" != "prepend-action-maskgit" ]; then
    echo "This script must be run from the prepend-action-maskgit branch. Current branch is $current_branch. Exiting."
    exit 1
fi

srun python jasmine/train_tokenizer.py \
    --patch_size=16 \
    --image_height=84 \
    --image_width=84 \
    --num_steps=50_000 \
    --max_lr=3e-6 \
    --warmup_steps=5000 \
    --wsd_decay_steps=5000 \
    --save_ckpt \
    $restore_ckpt_flag \
    --wandb_id $SLURM_JOB_ID \
    --ckpt_dir $CHECKPOINT_DIR \
    --name="${job_name}_${slurm_job_id}" \
    --tags $tags \
    --entity instant-uv \
    --project jafar \
    --data_dir="${array_records_dir}/train" \
    --val_data_dir="${array_records_dir}/val" &

child_pid=$!

wait $child_pid
[tab] slurm/dev/franz/berlin/atari/tokenizer_lr_3e-4_full_precision/spawn_tokenizers.sh (shellscript)
#!/usr/bin/env bash

set -euo pipefail

REPO_ROOT="/home/franz.srambical/jafar"

DATA_ROOT="${DATA_ROOT:-/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari}"

TOKENIZER_SCRIPT="${TOKENIZER_SCRIPT:-$REPO_ROOT/slurm/dev/franz/berlin/atari/tokenizer_lr_3e-4/tokenizer.sh}"

if [ "$#" -gt 0 ]; then
    ENV_LIST=("$@")
else
    if [ ! -d "$DATA_ROOT" ]; then
        echo "DATA_ROOT does not exist: $DATA_ROOT" >&2
        exit 1
    fi
    # list immediate subdirectories (candidate env names)
    mapfile -t ENV_LIST < <(find "$DATA_ROOT" -mindepth 1 -maxdepth 1 -type d -printf '%f
' | sort)
fi

echo "Submitting tokenizer jobs for environments: ${ENV_LIST[*]}"

for env in "${ENV_LIST[@]}"; do
    env_dir="$DATA_ROOT/$env"
    if [ ! -d "$env_dir/train" ] || [ ! -d "$env_dir/val" ]; then
        echo "Skipping $env (missing train/val under $env_dir)"
        continue
    fi

    job_name="tokenizer_atari_${env}_dev_lr_3e-4"

    job_id=$(sbatch --parsable \
        --job-name="$job_name" \
        --chdir="$REPO_ROOT" \
        --export=ALL,ENV_NAME="$env" \
        "$TOKENIZER_SCRIPT")

    echo "Submitted $job_name (ENV_NAME=$env) as job $job_id"
done
[tab] slurm/dev/franz/berlin/atari/tokenizer_lr_3e-5_full_precision/spawn_tokenizers.sh (shellscript)
#!/usr/bin/env bash

set -euo pipefail

REPO_ROOT="/home/franz.srambical/jafar"

DATA_ROOT="${DATA_ROOT:-/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari}"

TOKENIZER_SCRIPT="${TOKENIZER_SCRIPT:-$REPO_ROOT/slurm/dev/franz/berlin/atari/tokenizer_lr_3e-5/tokenizer.sh}"

if [ "$#" -gt 0 ]; then
    ENV_LIST=("$@")
else
    if [ ! -d "$DATA_ROOT" ]; then
        echo "DATA_ROOT does not exist: $DATA_ROOT" >&2
        exit 1
    fi
    # list immediate subdirectories (candidate env names)
    mapfile -t ENV_LIST < <(find "$DATA_ROOT" -mindepth 1 -maxdepth 1 -type d -printf '%f
' | sort)
fi

echo "Submitting tokenizer jobs for environments: ${ENV_LIST[*]}"

for env in "${ENV_LIST[@]}"; do
    env_dir="$DATA_ROOT/$env"
    if [ ! -d "$env_dir/train" ] || [ ! -d "$env_dir/val" ]; then
        echo "Skipping $env (missing train/val under $env_dir)"
        continue
    fi

    job_name="tokenizer_atari_${env}_dev_lr_3e-5"

    job_id=$(sbatch --parsable \
        --job-name="$job_name" \
        --chdir="$REPO_ROOT" \
        --export=ALL,ENV_NAME="$env" \
        "$TOKENIZER_SCRIPT")

    echo "Submitted $job_name (ENV_NAME=$env) as job $job_id"
done
[tab] slurm/dev/franz/berlin/atari/tokenizer_lr_3e-6_full_precision/spawn_tokenizers.sh (shellscript)
#!/usr/bin/env bash

set -euo pipefail

REPO_ROOT="/home/franz.srambical/jafar"

DATA_ROOT="${DATA_ROOT:-/fast/project/HFMI_SynergyUnit/jafar_ws/data/atari}"

TOKENIZER_SCRIPT="${TOKENIZER_SCRIPT:-$REPO_ROOT/slurm/dev/franz/berlin/atari/tokenizer_lr_3e-6/tokenizer.sh}"

if [ "$#" -gt 0 ]; then
    ENV_LIST=("$@")
else
    if [ ! -d "$DATA_ROOT" ]; then
        echo "DATA_ROOT does not exist: $DATA_ROOT" >&2
        exit 1
    fi
    # list immediate subdirectories (candidate env names)
    mapfile -t ENV_LIST < <(find "$DATA_ROOT" -mindepth 1 -maxdepth 1 -type d -printf '%f
' | sort)
fi

echo "Submitting tokenizer jobs for environments: ${ENV_LIST[*]}"

for env in "${ENV_LIST[@]}"; do
    env_dir="$DATA_ROOT/$env"
    if [ ! -d "$env_dir/train" ] || [ ! -d "$env_dir/val" ]; then
        echo "Skipping $env (missing train/val under $env_dir)"
        continue
    fi

    job_name="tokenizer_atari_${env}_dev_lr_3e-6"

    job_id=$(sbatch --parsable \
        --job-name="$job_name" \
        --chdir="$REPO_ROOT" \
        --export=ALL,ENV_NAME="$env" \
        "$TOKENIZER_SCRIPT")

    echo "Submitted $job_name (ENV_NAME=$env) as job $job_id"
done
[terminal_command] TERMINAL ()
bash /home/franz.srambical/jafar/slurm/dev/franz/berlin/atari/tokenizer_lr_3e-4_full_precision/spawn_tokenizers.sh alien amidar assault asterix bank_heist battle_zone boxing breakout chopper_command crazy_climber demon_attack pong
[terminal_command] TERMINAL ()
bash /home/franz.srambical/jafar/slurm/dev/franz/berlin/atari/tokenizer_lr_3e-5_full_precision/spawn_tokenizers.sh alien amidar assault asterix bank_heist battle_zone boxing breakout chopper_command crazy_climber demon_attack pong
[terminal_command] TERMINAL ()
bash /home/franz.srambical/jafar/slurm/dev/franz/berlin/atari/tokenizer_lr_3e-6_full_precision/spawn_tokenizers.sh alien amidar assault asterix bank_heist battle_zone boxing breakout chopper_command crazy_climber demon_attack pong