Add files using upload-large-folder tool
Browse files- benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--H0016--2d_none--0000_000.png +3 -0
- benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--N0002--2d_none--0000_000.png +3 -0
- benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--P0043--2d_none--0000_000.png +3 -0
- benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--P0126--2d_none--0000_000.png +3 -0
- benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--P0180--2d_none--0000_000.png +3 -0
- benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--P0204--2d_none--0000_000.png +3 -0
- benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--P0205--2d_none--0000_000.png +3 -0
- benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--T0007--2d_none--0000_000.png +3 -0
- benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--T0394--2d_none--0000_000.png +3 -0
- benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--V0121--2d_none--0000_000.png +3 -0
- benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--V0149--2d_none--0000_000.png +3 -0
- benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--V0399--2d_none--0000_000.png +3 -0
- 之前的代码版本/注意力关键词用于sam的/HuatuoGPT-Vision/results_attnbias/HuatuoGPT-Vision-7B/sam_both/_snapshot/run_eval_attnbias_sam_both_amplify_only.sh +56 -0
- 之前的代码版本/注意力关键词用于sam的/HuatuoGPT-Vision/results_attnbias/HuatuoGPT-Vision-7B/sam_both/_snapshot/run_eval_attnbias_sam_none.sh +40 -0
- 之前的代码版本/注意力关键词用于sam的/HuatuoGPT-Vision/results_attnbias/HuatuoGPT-Vision-7B/sam_both_noauction/HuatuoGPT-Vision-7B_medical_multimodel_evaluation_data_both_Lt17_kt3.0_nt-3.0_Lv17_kv3.0_nv-3.0.json +0 -0
- 之前的代码版本/注意力关键词用于sam的/HuatuoGPT-Vision/results_attnbias/HuatuoGPT-Vision-7B/sam_both_noauction/HuatuoGPT-Vision-7B_medical_multimodel_evaluation_data_both_Lt17_kt3.0_nt-3.0_Lv17_kv3.0_nv-3.0_result.json +22 -0
- 之前的代码版本/注意力关键词用于sam的/HuatuoGPT-Vision/results_attnbias/HuatuoGPT-Vision-7B/sam_both_noauction/_snapshot/run_all_attnbias_sam.sh +28 -0
- 之前的代码版本/注意力关键词用于sam的/HuatuoGPT-Vision/results_attnbias/HuatuoGPT-Vision-7B/sam_both_noauction/_snapshot/run_eval.sh +14 -0
- 之前的代码版本/注意力关键词用于sam的/HuatuoGPT-Vision/results_attnbias/HuatuoGPT-Vision-7B/sam_both_noauction/_snapshot/run_eval_attnbias_sam_both.sh +53 -0
- 之前的代码版本/注意力关键词用于sam的/HuatuoGPT-Vision/results_attnbias/HuatuoGPT-Vision-7B/sam_both_noauction/_snapshot/run_eval_attnbias_sam_text.sh +50 -0
benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--H0016--2d_none--0000_000.png
ADDED
|
Git LFS Details
|
benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--N0002--2d_none--0000_000.png
ADDED
|
Git LFS Details
|
benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--P0043--2d_none--0000_000.png
ADDED
|
Git LFS Details
|
benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--P0126--2d_none--0000_000.png
ADDED
|
Git LFS Details
|
benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--P0180--2d_none--0000_000.png
ADDED
|
Git LFS Details
|
benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--P0204--2d_none--0000_000.png
ADDED
|
Git LFS Details
|
benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--P0205--2d_none--0000_000.png
ADDED
|
Git LFS Details
|
benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--T0007--2d_none--0000_000.png
ADDED
|
Git LFS Details
|
benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--T0394--2d_none--0000_000.png
ADDED
|
Git LFS Details
|
benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--V0121--2d_none--0000_000.png
ADDED
|
Git LFS Details
|
benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--V0149--2d_none--0000_000.png
ADDED
|
Git LFS Details
|
benchmarks/VGMED/image_folder/SAMed2D_v1/fundus_photography/masks/fundus_photography--PALM19--V0399--2d_none--0000_000.png
ADDED
|
Git LFS Details
|
之前的代码版本/注意力关键词用于sam的/HuatuoGPT-Vision/results_attnbias/HuatuoGPT-Vision-7B/sam_both/_snapshot/run_eval_attnbias_sam_both_amplify_only.sh
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
cd "$(dirname "$0")"
|
| 3 |
+
|
| 4 |
+
DATA_PATH="/home/jinhua/ExplainableVQA/benchmarks/Medical_Multimodal_Evaluation_Data/medical_multimodel_evaluation_data.json"
|
| 5 |
+
MODEL_PATH="FreedomIntelligence/HuatuoGPT-Vision-7B"
|
| 6 |
+
OUTPUT_PATH="results_attnbias/HuatuoGPT-Vision-7B/sam_both_amplify_only"
|
| 7 |
+
|
| 8 |
+
SEED=42
|
| 9 |
+
MAX_NEW_TOKENS=256
|
| 10 |
+
|
| 11 |
+
MEDSAM3_CONFIG="/home/jinhua/ExplainableVQA/HuatuoGPT-Vision/MedSAM3/configs/full_lora_config.yaml"
|
| 12 |
+
MEDSAM3_DIR="/home/jinhua/ExplainableVQA/HuatuoGPT-Vision/MedSAM3"
|
| 13 |
+
|
| 14 |
+
# Ablation: amplify-only. Key positions still get the positive bias, but
|
| 15 |
+
# nonkey_bias_* is 0 instead of negative -- isolates how much of the "both"
|
| 16 |
+
# result comes from amplifying keyword text / SAM patches, with no suppression
|
| 17 |
+
# of distractors. Auction stays ON with the same ratio/alpha/beta as
|
| 18 |
+
# run_eval_attnbias_sam_both.sh, so this differs from "both" by exactly one
|
| 19 |
+
# factor (nonkey_bias_*); compare against run_eval_attnbias_sam_both_suppress_only.sh
|
| 20 |
+
# (same setup, opposite side zeroed) and run_eval_attnbias_sam_both.sh.
|
| 21 |
+
INTERVENTION="both"
|
| 22 |
+
ATTN_LAYERS_TEXT=17
|
| 23 |
+
ATTN_KEY_BIAS_TEXT=3.0
|
| 24 |
+
ATTN_NONKEY_BIAS_TEXT=0.0
|
| 25 |
+
ATTN_LAYERS_VIS=17
|
| 26 |
+
ATTN_KEY_BIAS_VIS=3.0
|
| 27 |
+
ATTN_NONKEY_BIAS_VIS=0.0
|
| 28 |
+
|
| 29 |
+
AUCTION_TOTAL_RATIO=0.7
|
| 30 |
+
AUCTION_NEG_RATIO=0.7
|
| 31 |
+
AUCTION_ALPHA=1.0
|
| 32 |
+
AUCTION_BETA=0.5
|
| 33 |
+
|
| 34 |
+
MAX_SAMPLES=""
|
| 35 |
+
|
| 36 |
+
accelerate launch eval_attnbias_sam.py \
|
| 37 |
+
--data_path "$DATA_PATH" \
|
| 38 |
+
--model_path "$MODEL_PATH" \
|
| 39 |
+
--seed "$SEED" \
|
| 40 |
+
--max_new_tokens "$MAX_NEW_TOKENS" \
|
| 41 |
+
--output_path "$OUTPUT_PATH" \
|
| 42 |
+
--intervention "$INTERVENTION" \
|
| 43 |
+
--attn_layers_text "$ATTN_LAYERS_TEXT" \
|
| 44 |
+
--attn_key_bias_text "$ATTN_KEY_BIAS_TEXT" \
|
| 45 |
+
--attn_nonkey_bias_text "$ATTN_NONKEY_BIAS_TEXT" \
|
| 46 |
+
--attn_layers_vis "$ATTN_LAYERS_VIS" \
|
| 47 |
+
--attn_key_bias_vis "$ATTN_KEY_BIAS_VIS" \
|
| 48 |
+
--attn_nonkey_bias_vis "$ATTN_NONKEY_BIAS_VIS" \
|
| 49 |
+
--medsam3_config "$MEDSAM3_CONFIG" \
|
| 50 |
+
--medsam3_dir "$MEDSAM3_DIR" \
|
| 51 |
+
--auction_enable \
|
| 52 |
+
--auction_total_ratio "$AUCTION_TOTAL_RATIO" \
|
| 53 |
+
--auction_neg_ratio "$AUCTION_NEG_RATIO" \
|
| 54 |
+
--auction_alpha "$AUCTION_ALPHA" \
|
| 55 |
+
--auction_beta "$AUCTION_BETA" \
|
| 56 |
+
${MAX_SAMPLES:+--max_samples "$MAX_SAMPLES"}
|
之前的代码版本/注意力关键词用于sam的/HuatuoGPT-Vision/results_attnbias/HuatuoGPT-Vision-7B/sam_both/_snapshot/run_eval_attnbias_sam_none.sh
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
cd "$(dirname "$0")"
|
| 3 |
+
|
| 4 |
+
DATA_PATH="/home/jinhua/ExplainableVQA/benchmarks/Medical_Multimodal_Evaluation_Data/medical_multimodel_evaluation_data.json"
|
| 5 |
+
MODEL_PATH="FreedomIntelligence/HuatuoGPT-Vision-7B"
|
| 6 |
+
OUTPUT_PATH="results_attnbias/HuatuoGPT-Vision-7B/sam_none"
|
| 7 |
+
|
| 8 |
+
SEED=42
|
| 9 |
+
MAX_NEW_TOKENS=256
|
| 10 |
+
|
| 11 |
+
MEDSAM3_CONFIG="/home/jinhua/ExplainableVQA/HuatuoGPT-Vision/MedSAM3/configs/full_lora_config.yaml"
|
| 12 |
+
MEDSAM3_DIR="/home/jinhua/ExplainableVQA/HuatuoGPT-Vision/MedSAM3"
|
| 13 |
+
|
| 14 |
+
# none: no attention intervention (model_output reuses plain inference result)
|
| 15 |
+
INTERVENTION="none"
|
| 16 |
+
ATTN_LAYERS_TEXT="17"
|
| 17 |
+
ATTN_KEY_BIAS_TEXT=3.0
|
| 18 |
+
ATTN_NONKEY_BIAS_TEXT=-3.0
|
| 19 |
+
ATTN_LAYERS_VIS="17"
|
| 20 |
+
ATTN_KEY_BIAS_VIS=3.0
|
| 21 |
+
ATTN_NONKEY_BIAS_VIS=-3.0
|
| 22 |
+
|
| 23 |
+
MAX_SAMPLES=""
|
| 24 |
+
|
| 25 |
+
accelerate launch eval_attnbias_sam.py \
|
| 26 |
+
--data_path "$DATA_PATH" \
|
| 27 |
+
--model_path "$MODEL_PATH" \
|
| 28 |
+
--seed "$SEED" \
|
| 29 |
+
--max_new_tokens "$MAX_NEW_TOKENS" \
|
| 30 |
+
--output_path "$OUTPUT_PATH" \
|
| 31 |
+
--intervention "$INTERVENTION" \
|
| 32 |
+
--attn_layers_text "$ATTN_LAYERS_TEXT" \
|
| 33 |
+
--attn_key_bias_text "$ATTN_KEY_BIAS_TEXT" \
|
| 34 |
+
--attn_nonkey_bias_text "$ATTN_NONKEY_BIAS_TEXT" \
|
| 35 |
+
--attn_layers_vis "$ATTN_LAYERS_VIS" \
|
| 36 |
+
--attn_key_bias_vis "$ATTN_KEY_BIAS_VIS" \
|
| 37 |
+
--attn_nonkey_bias_vis "$ATTN_NONKEY_BIAS_VIS" \
|
| 38 |
+
--medsam3_config "$MEDSAM3_CONFIG" \
|
| 39 |
+
--medsam3_dir "$MEDSAM3_DIR" \
|
| 40 |
+
${MAX_SAMPLES:+--max_samples "$MAX_SAMPLES"}
|
之前的代码版本/注意力关键词用于sam的/HuatuoGPT-Vision/results_attnbias/HuatuoGPT-Vision-7B/sam_both_noauction/HuatuoGPT-Vision-7B_medical_multimodel_evaluation_data_both_Lt17_kt3.0_nt-3.0_Lv17_kv3.0_nv-3.0.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
之前的代码版本/注意力关键词用于sam的/HuatuoGPT-Vision/results_attnbias/HuatuoGPT-Vision-7B/sam_both_noauction/HuatuoGPT-Vision-7B_medical_multimodel_evaluation_data_both_Lt17_kt3.0_nt-3.0_Lv17_kv3.0_nv-3.0_result.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"OmniMedVQA": 0.7445163610212154,
|
| 3 |
+
"PMC-VQA_test": 0.5495,
|
| 4 |
+
"PathVQA_test": 0.5746579417013682,
|
| 5 |
+
"VQA-RAD_test": 0.5976095617529881,
|
| 6 |
+
"SLAKE_test": 0.7620192307692307,
|
| 7 |
+
"MMMU_Medical_Validation": 0.5586206896551724,
|
| 8 |
+
"The total score for multiple-choice questions": 0.685686206497861,
|
| 9 |
+
"OmniMedVQA_MR (Mag-netic Resonance Imaging)": 0.7254950495049505,
|
| 10 |
+
"OmniMedVQA_ultrasound": 0.7784342688330872,
|
| 11 |
+
"OmniMedVQA_OCT (Optical Coherence Tomography": 0.8719298245614036,
|
| 12 |
+
"OmniMedVQA_Dermoscopy": 0.7223618090452262,
|
| 13 |
+
"OmniMedVQA_X-Ray": 0.8086359175662414,
|
| 14 |
+
"OmniMedVQA_CT(Computed Tomography)": 0.6619789050728278,
|
| 15 |
+
"OmniMedVQA_Fundus Photography": 0.8306709265175719,
|
| 16 |
+
"OmniMedVQA_Microscopy Images": 0.7733516483516484,
|
| 17 |
+
"MMMU_Medical_Validation_validation_Public_Health": 0.5,
|
| 18 |
+
"MMMU_Medical_Validation_validation_Pharmacy": 0.5185185185185185,
|
| 19 |
+
"MMMU_Medical_Validation_validation_Basic_Medical_Science": 0.5714285714285714,
|
| 20 |
+
"MMMU_Medical_Validation_validation_Clinical_Medicine": 0.7,
|
| 21 |
+
"MMMU_Medical_Validation_validation_Diagnostics_and_Laboratory_Medicine": 0.5
|
| 22 |
+
}
|
之前的代码版本/注意力关键词用于sam的/HuatuoGPT-Vision/results_attnbias/HuatuoGPT-Vision-7B/sam_both_noauction/_snapshot/run_all_attnbias_sam.sh
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
cd "$(dirname "$0")"
|
| 3 |
+
|
| 4 |
+
# 先跑 baseline(无干预的 eval.py),再依次跑完主干对比三组:
|
| 5 |
+
# none(无attention干预)/ both_noauction(传统全有全无)/ both(auction精选,正式配置)
|
| 6 |
+
# 任意一个失败就停止,避免在错误的环境下继续浪费时间
|
| 7 |
+
set -e
|
| 8 |
+
|
| 9 |
+
# 默认使用 huatuovision conda 环境,不依赖调用者当前激活的环境
|
| 10 |
+
source "$(conda info --base)/etc/profile.d/conda.sh"
|
| 11 |
+
conda activate huatuovision
|
| 12 |
+
|
| 13 |
+
SCRIPTS=(
|
| 14 |
+
#"run_eval.sh"
|
| 15 |
+
#"run_eval_attnbias_sam_none.sh"
|
| 16 |
+
"run_eval_attnbias_sam_both_noauction.sh"
|
| 17 |
+
"run_eval_attnbias_sam_both.sh"
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
for script in "${SCRIPTS[@]}"; do
|
| 21 |
+
echo "=================================================="
|
| 22 |
+
echo "[run_all] 开始运行 $script"
|
| 23 |
+
echo "=================================================="
|
| 24 |
+
bash "$script"
|
| 25 |
+
echo "[run_all] $script 运行完成"
|
| 26 |
+
done
|
| 27 |
+
|
| 28 |
+
echo "[run_all] 全部干预模式运行完成"
|
之前的代码版本/注意力关键词用于sam的/HuatuoGPT-Vision/results_attnbias/HuatuoGPT-Vision-7B/sam_both_noauction/_snapshot/run_eval.sh
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
cd "$(dirname "$0")"
|
| 3 |
+
|
| 4 |
+
DATA_PATH="/home/jinhua/ExplainableVQA/benchmarks/Medical_Multimodal_Evaluation_Data/medical_multimodel_evaluation_data.json"
|
| 5 |
+
MODEL_PATH="FreedomIntelligence/HuatuoGPT-Vision-7B"
|
| 6 |
+
|
| 7 |
+
SEED=42
|
| 8 |
+
MAX_NEW_TOKENS=256
|
| 9 |
+
|
| 10 |
+
accelerate launch eval.py \
|
| 11 |
+
--data_path "$DATA_PATH" \
|
| 12 |
+
--model_path "$MODEL_PATH" \
|
| 13 |
+
--seed "$SEED" \
|
| 14 |
+
--max_new_tokens "$MAX_NEW_TOKENS"
|
之前的代码版本/注意力关键词用于sam的/HuatuoGPT-Vision/results_attnbias/HuatuoGPT-Vision-7B/sam_both_noauction/_snapshot/run_eval_attnbias_sam_both.sh
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
cd "$(dirname "$0")"
|
| 3 |
+
|
| 4 |
+
DATA_PATH="/home/jinhua/ExplainableVQA/benchmarks/Medical_Multimodal_Evaluation_Data/medical_multimodel_evaluation_data.json"
|
| 5 |
+
MODEL_PATH="FreedomIntelligence/HuatuoGPT-Vision-7B"
|
| 6 |
+
OUTPUT_PATH="results_attnbias/HuatuoGPT-Vision-7B/sam_both"
|
| 7 |
+
|
| 8 |
+
SEED=42
|
| 9 |
+
MAX_NEW_TOKENS=256
|
| 10 |
+
|
| 11 |
+
MEDSAM3_CONFIG="/home/jinhua/ExplainableVQA/HuatuoGPT-Vision/MedSAM3/configs/full_lora_config.yaml"
|
| 12 |
+
MEDSAM3_DIR="/home/jinhua/ExplainableVQA/HuatuoGPT-Vision/MedSAM3"
|
| 13 |
+
|
| 14 |
+
# both mode + Budgeted Token Auction: instead of amplifying every SAM patch /
|
| 15 |
+
# scispaCy keyword and suppressing everything else, score every candidate by its
|
| 16 |
+
# original attention and select only top-k under a fixed budget (see
|
| 17 |
+
# BudgetedTokenAuction in eval_attnbias_sam.py).
|
| 18 |
+
INTERVENTION="both"
|
| 19 |
+
ATTN_LAYERS_TEXT=17
|
| 20 |
+
ATTN_KEY_BIAS_TEXT=3.0
|
| 21 |
+
ATTN_NONKEY_BIAS_TEXT=-3.0
|
| 22 |
+
ATTN_LAYERS_VIS=17
|
| 23 |
+
ATTN_KEY_BIAS_VIS=3.0
|
| 24 |
+
ATTN_NONKEY_BIAS_VIS=-3.0
|
| 25 |
+
|
| 26 |
+
AUCTION_TOTAL_RATIO=0.7
|
| 27 |
+
AUCTION_NEG_RATIO=0.7
|
| 28 |
+
AUCTION_ALPHA=1.0
|
| 29 |
+
AUCTION_BETA=0.5
|
| 30 |
+
|
| 31 |
+
MAX_SAMPLES=""
|
| 32 |
+
|
| 33 |
+
accelerate launch eval_attnbias_sam.py \
|
| 34 |
+
--data_path "$DATA_PATH" \
|
| 35 |
+
--model_path "$MODEL_PATH" \
|
| 36 |
+
--seed "$SEED" \
|
| 37 |
+
--max_new_tokens "$MAX_NEW_TOKENS" \
|
| 38 |
+
--output_path "$OUTPUT_PATH" \
|
| 39 |
+
--intervention "$INTERVENTION" \
|
| 40 |
+
--attn_layers_text "$ATTN_LAYERS_TEXT" \
|
| 41 |
+
--attn_key_bias_text "$ATTN_KEY_BIAS_TEXT" \
|
| 42 |
+
--attn_nonkey_bias_text "$ATTN_NONKEY_BIAS_TEXT" \
|
| 43 |
+
--attn_layers_vis "$ATTN_LAYERS_VIS" \
|
| 44 |
+
--attn_key_bias_vis "$ATTN_KEY_BIAS_VIS" \
|
| 45 |
+
--attn_nonkey_bias_vis "$ATTN_NONKEY_BIAS_VIS" \
|
| 46 |
+
--medsam3_config "$MEDSAM3_CONFIG" \
|
| 47 |
+
--medsam3_dir "$MEDSAM3_DIR" \
|
| 48 |
+
--auction_enable \
|
| 49 |
+
--auction_total_ratio "$AUCTION_TOTAL_RATIO" \
|
| 50 |
+
--auction_neg_ratio "$AUCTION_NEG_RATIO" \
|
| 51 |
+
--auction_alpha "$AUCTION_ALPHA" \
|
| 52 |
+
--auction_beta "$AUCTION_BETA" \
|
| 53 |
+
${MAX_SAMPLES:+--max_samples "$MAX_SAMPLES"}
|
之前的代码版本/注意力关键词用于sam的/HuatuoGPT-Vision/results_attnbias/HuatuoGPT-Vision-7B/sam_both_noauction/_snapshot/run_eval_attnbias_sam_text.sh
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
cd "$(dirname "$0")"
|
| 3 |
+
|
| 4 |
+
DATA_PATH="/home/jinhua/ExplainableVQA/benchmarks/Medical_Multimodal_Evaluation_Data/medical_multimodel_evaluation_data.json"
|
| 5 |
+
MODEL_PATH="FreedomIntelligence/HuatuoGPT-Vision-7B"
|
| 6 |
+
OUTPUT_PATH="results_attnbias/HuatuoGPT-Vision-7B/sam_text"
|
| 7 |
+
|
| 8 |
+
SEED=42
|
| 9 |
+
MAX_NEW_TOKENS=256
|
| 10 |
+
|
| 11 |
+
# Modality ablation: text-only. Only the scispaCy keyword text positions get
|
| 12 |
+
# biased (key_bias_text / nonkey_bias_text); the vis side is forced to 0 bias
|
| 13 |
+
# inside _make_attn_ctx regardless of what's passed here. SAM/MedSAM3 is
|
| 14 |
+
# skipped entirely (_needs_sam is False for "text"), so no medsam3_* args.
|
| 15 |
+
# Auction stays ON with the same ratio/alpha/beta as run_eval_attnbias_sam_both.sh
|
| 16 |
+
# (clear_market sizes its budget off only the text-side candidate pool here,
|
| 17 |
+
# since vis_enabled=False when intervention=="text" -- see clear_market's
|
| 18 |
+
# text_enabled/vis_enabled params), so this differs from "both" by exactly one
|
| 19 |
+
# factor (modality); compare against run_eval_attnbias_sam_vis.sh and
|
| 20 |
+
# run_eval_attnbias_sam_both.sh.
|
| 21 |
+
INTERVENTION="text"
|
| 22 |
+
ATTN_LAYERS_TEXT=17
|
| 23 |
+
ATTN_KEY_BIAS_TEXT=3.0
|
| 24 |
+
ATTN_NONKEY_BIAS_TEXT=-3.0
|
| 25 |
+
ATTN_LAYERS_VIS="17"
|
| 26 |
+
|
| 27 |
+
AUCTION_TOTAL_RATIO=0.7
|
| 28 |
+
AUCTION_NEG_RATIO=0.7
|
| 29 |
+
AUCTION_ALPHA=1.0
|
| 30 |
+
AUCTION_BETA=0.5
|
| 31 |
+
|
| 32 |
+
MAX_SAMPLES=""
|
| 33 |
+
|
| 34 |
+
accelerate launch eval_attnbias_sam.py \
|
| 35 |
+
--data_path "$DATA_PATH" \
|
| 36 |
+
--model_path "$MODEL_PATH" \
|
| 37 |
+
--seed "$SEED" \
|
| 38 |
+
--max_new_tokens "$MAX_NEW_TOKENS" \
|
| 39 |
+
--output_path "$OUTPUT_PATH" \
|
| 40 |
+
--intervention "$INTERVENTION" \
|
| 41 |
+
--attn_layers_text "$ATTN_LAYERS_TEXT" \
|
| 42 |
+
--attn_key_bias_text "$ATTN_KEY_BIAS_TEXT" \
|
| 43 |
+
--attn_nonkey_bias_text "$ATTN_NONKEY_BIAS_TEXT" \
|
| 44 |
+
--attn_layers_vis "$ATTN_LAYERS_VIS" \
|
| 45 |
+
--auction_enable \
|
| 46 |
+
--auction_total_ratio "$AUCTION_TOTAL_RATIO" \
|
| 47 |
+
--auction_neg_ratio "$AUCTION_NEG_RATIO" \
|
| 48 |
+
--auction_alpha "$AUCTION_ALPHA" \
|
| 49 |
+
--auction_beta "$AUCTION_BETA" \
|
| 50 |
+
${MAX_SAMPLES:+--max_samples "$MAX_SAMPLES"}
|