jasonfan's picture
2026-03-19: ICL code
64bce2a verified
#!/bin/bash
#SBATCH --partition=scavenger-gpu
#SBATCH --exclude=dcc-youlab-gpu-28,dcc-gehmlab-gpu-56
#SBATCH --array=0,1,2,3,4,5 # 6 configurations to test
#SBATCH --ntasks=1
#SBATCH --nodes=1
#SBATCH --cpus-per-task=4
#SBATCH --mem-per-cpu=64G
#SBATCH --gres=gpu:1
#SBATCH --time=72:00:00
#SBATCH --output=/work/jf381/code/code/ICL_LOG/3_30_18/%A_%a_%j.out
#SBATCH --error=/work/jf381/code/code/ICL_LOG/3_30_18/%A_%a_%j.err
#SBATCH --nodelist=dcc-allenlab-gpu-[01-04],dcc-allenlab-gpu-[05-12],dcc-majoroslab-gpu-[01-08],dcc-yaolab-gpu-[01-08],dcc-wengerlab-gpu-01,dcc-engelhardlab-gpu-[01-04],dcc-motesa-gpu-[01-04],dcc-pbenfeylab-gpu-[01-04],dcc-vossenlab-gpu-[01-04],dcc-youlab-gpu-[01-56],dcc-mastatlab-gpu-01,dcc-viplab-gpu-01,dcc-youlab-gpu-57
#SBATCH --requeue
set -e
# nvidia-smi | grep 'python' | awk '{ print $5 }' | xargs -n1 kill -9
# SLURM_ARRAY_TASK_ID=3
# conda activate /work/jf381/cache/conda_envs/paul31
# source activate /work/jf381/cache/conda_envs/paul31
# use SLURM_ARRAY_TASK_ID to control
# cd /work/jf381/code/code/ICL_Jay
# distribute 1000 tasks on
# python /work/jf381/code/code/ICL_Jay/train_end2end_new.py --test_mode $SLURM_ARRAY_TASK_ID --n_epochs 3001 --data_type sphere --data_generation --slurm_id --slurm_tasks
# n_epochs_stride
# SLURM_ARRAY_TASK_ID=0
python /work/jf381/code/code/ICL_Jay/train_end2end_new.py --test_mode $SLURM_ARRAY_TASK_ID --n_epochs 30001 --data_type swiss_roll
# python /work/jf381/code/code/ICL_Jay/train_end2end_new_test.py --test_mode 3 --n_epochs 31 --load_model
# Test Mode 0: Full Training
# This is the "full package" mode where everything is turned on. We're training all components simultaneously - Laplacian prediction (lap_weight=1), positional encoding (pe_weight=1), and in-context learning (icl_weight=1). We just give the model raw data and let it handle everything end-to-end. This tests how well all components work together.
# Test Mode 1: Pretrain Laplacian Only
# This focuses just on pretraining the Laplacian prediction component (lap_weight=1) while turning off the other parts (pe_weight=0, icl_weight=0). It's like teaching the model to understand the graph structure first before worrying about embeddings or classification. We're laying the foundation.
# Test Mode 2: Pretrain Positional Encoding
# Here, we're assuming we already have the correct Laplacian (we feed in real_lap), and we're training just the positional encoding component (pe_weight=1). We're skipping the Laplacian prediction (lap_weight=0) and not worrying about classification yet (icl_weight=0). This lets us focus on learning good embeddings from a known graph structure.
# Test Mode 3: Pretrain In-Context Learning
# In this mode, we're assuming we already have the perfect embeddings (we feed in real_ev), and we're only training the classification component (icl_weight=1). Both Laplacian and positional encoding parts are disabled (lap_weight=0, pe_weight=0). This tests how well the model can do classification when given ideal embeddings.
# Test Mode 4: Pretrain Laplacian + Positional Encoding
# This mode trains both the Laplacian prediction and positional encoding components together (lap_weight=1, pe_weight=1), but doesn't train the classification part (icl_weight=0). It's about getting the underlying representation right before trying to do any classification.