| # 一键完成 Lab 数据集预处理:生成 QV 风格 jsonl + 提取 CLIP 视频特征 + 提取 LLaMA 文本特征 | |
| # 用法: bash scripts/run_lab_preprocess.sh [gpu_id] | |
| # 默认 GPU 0;无 GPU 时自动用 CPU(CLIP/LLaMA 会较慢) | |
| set -e | |
| cd "$(dirname "$0")/.." | |
| LAB_DIR=${LAB_DIR:-features/lab} | |
| OUT_JSONL=${OUT_JSONL:-data/lab_val.jsonl} | |
| GPU_ID=${1:-0} | |
| echo "Lab dir: $LAB_DIR" | |
| echo "Output jsonl: $OUT_JSONL" | |
| echo "GPU: $GPU_ID" | |
| # 1) 生成 QV 风格标注(不依赖 GPU) | |
| python scripts/prepare_lab_dataset.py \ | |
| --lab_dir "$LAB_DIR" \ | |
| --out_jsonl "$OUT_JSONL" | |
| # 2) 提取 CLIP + LLaMA(需要 GPU 和 open_clip / transformers) | |
| export CUDA_VISIBLE_DEVICES=$GPU_ID | |
| python scripts/prepare_lab_dataset.py \ | |
| --lab_dir "$LAB_DIR" \ | |
| --out_jsonl "$OUT_JSONL" \ | |
| --extract_clip \ | |
| --extract_llama \ | |
| --device "${DEVICE:-cuda}" | |
| echo "Preprocess done. Next: run inference with --eval_path $OUT_JSONL and v_feat_dirs/t_feat_dir pointing to features/lab/clip_features and features/lab/llama_text_feature" | |