carin-jf381-data / ICL_code /ICL_Jay_final /script /data_generate_test.sh
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-999 # 6 configurations to test
#SBATCH --ntasks=1
#SBATCH --nodes=1
#SBATCH --cpus-per-task=1
#SBATCH --mem-per-cpu=8G
#SBATCH --gres=gpu:1
#SBATCH --time=8:00:00
#SBATCH --output=/work/jf381/code/code/ICL_LOG/data_generation/%A_%a_%j.out
#SBATCH --error=/work/jf381/code/code/ICL_LOG/data_generation/%A_%a_%j.err
#SBATCH --requeue
set -e
# load_pretrain_model 0
# rbf 1 2 4 971 067 971
# 30,31,32 softmax use_cf
# 18,19,20 softmax use_ff
# exp 9 10 11
# 678 softmax
# nvidia-smi | grep 'python' | awk '{ print $5 }' | xargs -n1 kill -9
# SLURM_ARRAY_TASK_ID=3
# conda activate /work/jf381/cache/conda_envs/paul3100
# source activate /work/jf381/cache/conda_envs/paul31
# use SLURM_ARRAY_TASK_ID to control
# cd /work/jf381/code/code/ICL_Jay
## pretrain useful for pe+lap
## add noise add performance
## test context size
## test model
# 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
#!/bin/bash
# 定义噪声水平列表
#!/bin/bash
# 获取SLURM任务ID
# SLURM_ARRAY_TASK_ID=34
# SLURM_ARRAY_TASK_ID=15
# SLURM_ID=${SLURM_ARRAY_TASK_ID:-0}
# SLURM_ARRAY_TASK_ID=15
SLURM_ID=15
# 设置数据类型
# 设置基础噪声水平(或从列表中选择)
add_noises=0 # 也可以从一个列表中基于SLURM_ID选择
# 使用SLURM_ID来确定模型配置
# 假设我们有以下变量组合:
# 1. n_layer_icl: 1, 2, 3, 4
# 2. kernel: 'linear', 'rbf', 'softmax', 'exp'
# 3. 使用选项: 无特殊选项, use_ff, use_ct
# /work/jf381/code/code/ICL_LOG/ICL_MODEL_TEST_TYPE2_Finetune_Pretrain_ENDEND
# NOW
# data_type="cylinder"
# test_data_type="cylinder"
# data_type="cylinder"
# test_data_type="cylinder"
# data_type="cylinder"
# test_data_type="cylinder"
# 计算层数 (1, 2, 4)
layer_options=(1 2 4)
layer_idx=$(( SLURM_ID % 3 ))
n_layer_icl=${layer_options[$layer_idx]}
# 计算kernel类型 (0-3)
kernel_idx=$(( (SLURM_ID / 3) % 4 ))
kernels=("linear" "rbf" "softmax" "exp")
kernel=${kernels[$kernel_idx]}
# 计算使用选项 (0-2)
option_idx=$(( (SLURM_ID / 12) % 3 ))
options=("" "--use_ff" "--use_cf")
option=${options[$option_idx]}
icl_type=2
echo "Running with configuration:"
echo "SLURM_ID = $SLURM_ID"
echo "n_layer_icl = $n_layer_icl"
echo "kernel = $kernel"
echo "option = $option"
echo "icl_type = $icl_type"
batch_size=200
data_type="combine-5"
test_data_type=$data_type
SLURM_ARRAY_TASK_ID=0
# echo $SLURM_ARRAY_TASK_ID/
load_pretrain_model=0
test_mode=$load_pretrain_model
seed=2
context_size=40
query_size=60
n_samples=$((context_size+query_size))
# SLURM_ARRAY_TASK_ID=0
python /work/jf381/code/code/ICL_Jay/train_end2end_new.py \
--test_mode $test_mode \
--n_epochs 30001 \
--data_type $data_type \
--n_layer_icl $n_layer_icl \
--test_data_type $test_data_type \
--add_noises $add_noises \
--kernel $kernel \
--load_pretrain_model -1 \
--fine_tune_n_epochs 31 \
--icl_type $icl_type \
--suffix n_samples_${n_samples}_context_size_${context_size} \
--train_context_size $context_size \
--test_context_size $context_size \
--n_samples $n_samples \
--seed $seed \
--batch_size $batch_size \
--data_generation \
--slurm_id $SLURM_ARRAY_TASK_ID \
--slurm_tasks 1 \
--batch_size $batch_size
# distribute 1000 tasks to generate
# python /work/jf381/code/code/ICL_Jay/train_end2end_new.py --n_epochs 3001 --data_type swiss_roll --data_generation --slurm_id $SLURM_ARRAY_TASK_ID --slurm_tasks 100 --batch_size 200