hallucination / experiment /scripts /data /build_original_cache.sh
ToiTenBao's picture
Upload hallucination folder
a2ffd07 verified
Raw
History Blame Contribute Delete
977 Bytes
#!/usr/bin/env bash
# Build the original-model output cache from caption_targets.json.
# Run this once before running any eval script to avoid loading the base model.
#
# Usage:
# bash experiment/scripts/data/build_original_cache.sh
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
source "${SCRIPT_DIR}/../baselines/_common.sh"
CAPTION_TARGETS="${CAPTION_TARGETS:-${PROJECT_ROOT}/experiment/data/caption_targets.json}"
ORIGINAL_CACHE_DIR="${ORIGINAL_CACHE_DIR:-./cached_original_outputs}"
if [ ! -f "${CAPTION_TARGETS}" ]; then
echo "ERROR: caption_targets.json not found at ${CAPTION_TARGETS}"
echo " Run experiment/scripts/data/run_build_caption_targets.sh first."
exit 1
fi
echo "Building original cache..."
echo " caption_targets: ${CAPTION_TARGETS}"
echo " output_dir: ${ORIGINAL_CACHE_DIR}"
python -m experiment.data.build_original_cache \
--caption_targets "${CAPTION_TARGETS}" \
--output_dir "${ORIGINAL_CACHE_DIR}" \
--use_val_split