#!/bin/bash
CKPT=/llava-v1.5-7b/
Model=llava-v1.5-7b

attn=flash_attention_2

# logits of text tokens
layer_list=(1 2 3 5 7 10 14 16 18 20 24 28 30 31)

size=2

for id_prune_layer in ${layer_list[@]}; do
    # TextVQA
    dataset=TextVQA
    DATASET=$dataset LAYER_INDEX=$id_prune_layer SIZE=$size python -m llava.eval.model_vqa_loader \
        --model-path $CKPT \
        --question-file ./playground/data/eval/textvqa/llava_textvqa_val_v051_ocr.jsonl \
        --image-folder /dataset/image/TextVQA/train_images \
        --answers-file ./playground/data/eval/textvqa/answers/$Model.jsonl \
        --temperature 0 \
        --conv-mode vicuna_v1 \
        --sparse \
        --attn_implementation $attn \
        --pruned_layer $id_prune_layer \
        --image_token_start_index 35 \
        --image_token_length 576 \
        --is_textvqa 
done

size=2

# visual token information

layer_list=(1 2 3 5 7 10 14 16 18 20 24 28 30 31)

x_list=(1 2 3 4 5 6 7 8 9 10 11 12)

y_list=(1 2 3 4 5 6 7 8 9 10 11 12)


for id_prune_layer in ${layer_list[@]}; do
    for x in ${x_list[@]}; do
        for y in ${y_list[@]}; do
            # TextVQA
            dataset=TextVQA
            DATASET=$dataset LAYER_INDEX=$id_prune_layer SIZE=$size X=$x  Y=$y  python -m llava.eval.model_vqa_loader \
                --model-path $CKPT \
                --question-file ./playground/data/eval/textvqa/llava_textvqa_val_v051_ocr.jsonl \
                --image-folder /dataset/image/TextVQA/train_images \
                --answers-file ./playground/data/eval/textvqa/answers/$Model.jsonl \
                --temperature 0 \
                --conv-mode vicuna_v1 \
                --sparse \
                --attn_implementation $attn \
                --pruned_layer $id_prune_layer \
                --image_token_start_index 35 \
                --image_token_length 576 \
                --is_textvqa 

        done
    done
done


