Views
No views yet
tosc-model-weights/
├── benchmark/ # 5,969 triplets (origin / removed / replaced)
│ ├── original/images/ # {N}.jpg
│ ├── repair/images/ # {N}_masked_{obj}_repair.png (removed)
│ ├── insert/images/ # {N}_masked_{obj}_insert_{new}.png (replaced)
│ ├── TOSC_dataset.jsonl # generated index (regenerable)
│ └── insertions.jsonl # generated object metadata (regenerable)
├── eval/ # evaluation code (see eval/README.md for details)
│ ├── build_index.py # image folders -> the two .jsonl files
│ ├── run_eval.sh # end-to-end runner: caption -> merge -> score
│ ├── eval_tosc.py # scoring engine
│ └── eval_masked_obj_generative.py
├── llava/ # vendored inference package (imports as `llava`)
├── lora/ # 4 trained LoRA adapters (TSA-DPO)
└── requirements.txtAdapter (lora/…) | Base model |
|---|---|
LLaVA_v1_5_7b-TSA-DPO | liuhaotian/llava-v1.5-7b |
LLaVA_v1_5_13b-TSA-DPO | liuhaotian/llava-v1.5-13b |
Qwen2_VL_7B-TSA-DPO | Qwen/Qwen2-VL-7B-Instruct |
Qwen2_5_VL_7B-TSA-DPO | Qwen/Qwen2.5-VL-7B-Instruct |
1# 1. Get the repo (images + adapters are stored with Git LFS)
2git lfs install
3git clone https://huggingface.co/julyanghar/tosc-model-weights
4cd tosc-model-weights
5
6# 2. Create an environment and install dependencies
7conda create -n tosc python=3.10 -y && conda activate tosc # or use a venv
8pip install -r requirements.txt
9
10# 3. (Qwen models only) install flash-attn for the Qwen2-VL / Qwen2.5-VL path,
11# or change attn_implementation to "sdpa" in llava/eval/utils/hf_utils.py
12pip install flash-attn --no-build-isolationliuhaotian/llava-v1.5-*, Qwen/Qwen2*-VL-*-Instruct) and the
CLIP vision tower are downloaded automatically from the Hugging Face Hub on first
use; the LoRA adapters are loaded from lora/ in this repo.1# 1. Build the index files once (regenerable from the images at any time)
2python eval/build_index.py
3
4# 2. Evaluate a model. Pick one of the four presets in eval/run_eval.sh
5# (uncomment it), or select it via environment variables. Example: Qwen2.5-VL
6# on 4 GPUs.
7GPU_LIST=0,1,2,3 \
8OUTPUT_NAME=Qwen2_5_VL_7B-TSA-DPO \
9MODEL_NAME=Qwen/Qwen2.5-VL-7B-Instruct \
10LORA_NAME=$PWD/lora/Qwen2_5_VL_7B-TSA-DPO \
11bash eval/run_eval.shrun_eval.sh runs three steps: (1) generate a caption for every benchmark image
(multi-GPU, sharded by GPU_LIST), (2) merge the shards, (3) score with
eval/eval_tosc.py. The inference path is selected automatically — model names
containing llava + 1.5 use the LLaVA-1.5 loader, everything else uses the
Qwen path. Set LORA_NAME="" to evaluate a base model without the adapter.GPU_LIST=0 bash eval/run_eval.sh # single GPU (slower)QUESTION_FILE at a trimmed
copy of benchmark/TOSC_dataset.jsonl.${TOSC_RESULTS:-/home/yilin/tmp/tosc_results} (outside the repo
by default; override with OUTPUT_DIR):answers/<OUTPUT_NAME>.jsonl — merged captions<OUTPUT_NAME>_eval.json — full per-triplet results<OUTPUT_NAME>_eval_summary.json — aggregate metrics| Variable | Default | Meaning |
|---|---|---|
GPU_LIST | 0 | comma-separated GPU ids, e.g. 0,1,2,3 |
MODEL_NAME / LORA_NAME / OUTPUT_NAME | Qwen2.5 preset | model selection |
MAX_NEW_TOKENS | 512 | caption length |
TEMPERATURE | 0 | 0 = greedy / deterministic |
SEED | 42 | random seed |
OUTPUT_DIR | /home/yilin/tmp/tosc_results | where results are written |