['25 VLDB] Déjà Vu: Efficient Video-Language Query Engine with Learning-based Inter-Frame Computation Reuse
This repository provides the artifact for the paper "Déjà Vu: Efficient Video-Language Query Engine with Learning-based Inter-Frame Computation Reuse". It walks through dataset preparation, feature extraction, training, evaluation, and plotting for the NextQA experiments.
- Prerequisites
- Downloading videos
- Transcode videos
- Extracting input features for training
- Extracting compressed features
- Training ReuseViT
- Extracting ReuseViT and baselines for testing
- Running end tasks
- Plotting graph
git clone https://github.com/anonymous-dejavu/dejavu
cd dejavu
git submodule update --init --recursive
cd docker
./build.sh
We require a large amount of storage to keep the extracted features, so we recommend launching the Docker container with a mounted volume.
# Refer to the example script to launch the Docker container.
./launch.sh
From this point on, unless noted otherwise, we assume the commands are run inside the Docker container.
cd /workspace/configs/paths
vim data.yaml
Set data_dir to your desired path. The storage should be at least 2 TB.
Download the NextQA dataset from the official NextQA repository.
Place them under ${data_dir}/datasets/nextqa/videos.
mkdir -p ${data_dir}/datasets/nextqa/videos
cd ${data_dir}/datasets/nextqa/videos
unzip NExTVideo.zip
ls # Should show 0000/ 0001/ 0002/
cd /workspace
python -m src.scripts.transcode dry_run=false
python -m src.scripts.transcode split=val dry_run=false
python -m src.scripts.transcode split=test dry_run=false
cd /workspace
python -m src.scripts.extract dry_run=false
python -m src.scripts.extract split=val dry_run=false
python -m src.scripts.extract split=test target_features='i,o' num_gpus=4 num_workers=32 dry_run=false
cd /workspace
python -m src.scripts.extract_compressed dry_run=false
python -m src.scripts.extract_compressed split=val dry_run=false
python -m src.scripts.extract_compressed split=test dry_run=false
Check that dataset info is populated correctly.
python -m src.data.components.nextqa +split=train +fps=2 +base_model_name=openai/clip-vit-large-patch14 +return_compressed=true +regenerate_dataset_info=false
python -m src.data.components.nextqa +split=val +fps=2 +base_model_name=openai/clip-vit-large-patch14 +return_compressed=true +regenerate_dataset_info=false
python -m src.data.components.nextqa +split=test +fps=2 +base_model_name=openai/clip-vit-large-patch14 +return_compressed=true +regenerate_dataset_info=false
One can train the ReuseViT oneself, or use the checkpoint we provide.
items=(0.95 0.9 0.85 0.8)
for item in "${items[@]}"; do
python src/train.py model.compile=true experiment=nextqa model.loss.target_reuse_rate=${item} model.dry_run=false
done
Place the checkpoints under ${data_dir}/checkpoints/nextqa.
mkdir -p ${data_dir}/checkpoints/nextqa
# Download the checkpoints and place them under ${data_dir}/checkpoints/nextqa
ls ${data_dir}/checkpoints/nextqa # should look like nextqa-68.ckpt nextqa-85.ckpt nextqa-93.ckpt nextqa-95.ckpt
cd /workspace
items=(68 85 93 95)
for item in "${items[@]}"; do
python src/eval.py experiment=nextqa-hard-${item} model.dry_run=false data.test_split=test &
done
To run DiffRate, one should first obtain the pruning and merging decisions. For now, we provide the precomputed logs here, and plan on sharing the code to train DiffRate.
mkdir -p ${data_dir}/checkpoints/diffrate
tar xvzf nextqa.tar.gz -C ${data_dir}/checkpoints/diffrate
items=('31.0' '34.7' '38.5' '42.3' '46.1')
for item in "${items[@]}"; do
python -m src.scripts.extract mode=diffrate split=test target_features=o num_gpus=4 num_workers=24 batch_size=16 +diffrate_flops=${item} dry_run=false
done
for k in $(seq 1 15); do
python src/eval.py experiment=eventful reuse_module.decision.k=$((k*10)) model.dry_run=false &
done
for k in $(seq 3 3 45); do
python src/eval.py experiment=cmc reuse_module.decision.threshold=-$k model.dry_run=false data.test_split=test &
done
First, build and launch the Docker container for the end tasks. The following two commands are run on the host machine.
cd docker/next-gqa
./build.sh
./launch.sh
Make sure the third_parties/NExT-GQA submodule is initialized before this step.
We assume the following commands are run inside the Docker container.
cd /workspace/third_parties/NExT-GQA/code/TempGQA
# Original
CUDA_VISIBLE_DEVICES=0 ./shells/next_test_dual.sh original 2>&1 | tee log_original.txt &
items=('68' '85' '93' '95')
for item in "${items[@]}"; do
./shells/next_test_dual.sh reuse-$item 2>&1 | tee log_reuse-$item.txt &
done
for item in $(seq 1 15); do
target=$((item*10))
./shells/next_test_dual.sh eventful_${target} 2>&1 | tee log_eventful_${target}.txt &
done
for k in $(seq 3 3 45); do
threshold="-$k"
./shells/next_test_dual.sh cmc_${threshold} 2>&1 | tee log_cmc_${threshold}.txt &
done
cd /workspace/scripts
python plot-nextqa.py
After running the script, you should see results similar to the following.
