-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_image_exp.sh
More file actions
executable file
·72 lines (54 loc) · 1.92 KB
/
Copy pathrun_image_exp.sh
File metadata and controls
executable file
·72 lines (54 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# Define datasets
DATASETS=("CIFAR-10" "CIFAR-100" "SVHN" "FashionMNIST")
# Define models
MODELS=("vit_base.yaml" "conv_base.yaml")
# Configuration
SEED=20
BASE_PORT=29500
# Create logs directory
mkdir -p logs
echo "Starting image dataset experiments..."
echo "Datasets: ${DATASETS[*]}"
echo "Models: ${MODELS[*]}"
echo "Seed: $SEED"
echo "========================================"
for DATASET in "${DATASETS[@]}"; do
echo "Processing dataset: $DATASET"
# Ensure logs directory for dataset exists
mkdir -p "logs/${DATASET}"
PIDS=()
for MODEL_CFG in "${MODELS[@]}"; do
MODEL_NAME=$(basename "$MODEL_CFG" .yaml)
CFG="cfgs/${DATASET}/${MODEL_CFG}"
# Check if config exists
if [ ! -f "$CFG" ]; then
echo " Warning: Config $CFG not found, skipping..."
continue
fi
# Use simple tag like command.txt
TAG="seed_${SEED}"
# Unique port for each run to be safe
PORT=$BASE_PORT
BASE_PORT=$((BASE_PORT + 1))
echo " Running $MODEL_NAME on $DATASET (Port: $PORT)..."
# Run command in background
# Using nproc_per_node=4 as these are image models (referencing command.txt)
nohup torchrun --nproc_per_node=4 --master-port=$PORT main.py \
--cfg "$CFG" --seed $SEED --tag "$TAG" > "logs/${DATASET}/${MODEL_NAME}.logs" 2>&1 &
# Capture PID
PID=$!
PIDS+=($PID)
echo " Started $MODEL_NAME on $DATASET with PID: $PID"
done
# Wait for all models for this dataset to finish
if [ ${#PIDS[@]} -gt 0 ]; then
echo " Waiting for all models on $DATASET to complete..."
for PID in "${PIDS[@]}"; do
wait $PID
done
fi
echo "Completed all models for $DATASET"
echo "--------------------------------"
done
echo "All experiments completed!"