-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheval_m2kr_single_gpu.sh
More file actions
81 lines (71 loc) · 2.2 KB
/
eval_m2kr_single_gpu.sh
File metadata and controls
81 lines (71 loc) · 2.2 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
73
74
75
76
77
78
79
80
81
#!/bin/bash
#SBATCH --job-name=eval_m2kr_single_gpu
#SBATCH --output=
#SBATCH --error=
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --gpus-per-node=1
#SBATCH --mem=128G
#SBATCH --cpus-per-task=8
#SBATCH --partition=
#SBATCH --account=
#SBATCH --time=00:50:00
#SBATCH --array=0-3
set -e
conda activate ret2
cd ~/ReT-2
export PYTHONPATH=.
export TRANSFORMERS_VERBOSITY=info
export TOKENIZERS_PARALLELISM=false
export OMP_NUM_THREADS=1
# https://huggingface.co/datasets/aimagelab/ReT-M2KR#download-images
IMAGE_ROOT_PATH=
# https://huggingface.co/datasets/aimagelab/ReT-M2KR/tree/main/jsonl
JSONL_ROOT_PATH=
DATASET_NAMES=(
"llava"
"kvqa_unique"
"oven"
"iglue"
)
dataset_name="${DATASET_NAMES[$SLURM_ARRAY_TASK_ID]}"
if [ "$dataset_name" = "kvqa_unique" ]; then
dataset_passages_name="kvqa"
else
dataset_passages_name="$dataset_name"
fi
dataset_path="${JSONL_ROOT_PATH}/m2kr/test/${dataset_name}_test.jsonl"
dataset_passages_path="${JSONL_ROOT_PATH}/m2kr/passages/${dataset_passages_name}_passages_test.jsonl"
index_root="./indices/m2kr"
index_model_name="ReT2-M2KR-CLIP-ViT-B"
index_dataset_name="${dataset_name}"
checkpoint_path="aimagelab/${index_model_name}"
batch_size=128
srun torchrun --nproc-per-node=1 --standalone \
src/evaluate.py \
--action "index" \
--index_root "${index_root}" \
--index_model_name "${index_model_name}" \
--index_dataset_name "${index_dataset_name}" \
--dataset_passages_path "${dataset_passages_path}" \
--image_root "${IMAGE_ROOT_PATH}" \
--checkpoint_path "${checkpoint_path}" \
--batch_size "${batch_size}" \
--dataloader_num_workers $SLURM_CPUS_PER_TASK
srun python src/evaluate.py \
--action "create_index" \
--index_root "${index_root}" \
--index_model_name "${index_model_name}" \
--index_dataset_name "${index_dataset_name}"
srun torchrun --nproc-per-node=1 --standalone \
src/evaluate.py \
--action "search" \
--index_root "${index_root}" \
--index_model_name "${index_model_name}" \
--index_dataset_name "${index_dataset_name}" \
--dataset_path "${dataset_path}" \
--dataset_passages_path "${dataset_passages_path}" \
--image_root "${IMAGE_ROOT_PATH}" \
--checkpoint_path "${checkpoint_path}" \
--batch_size "${batch_size}" \
--dataloader_num_workers $SLURM_CPUS_PER_TASK