| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| REPO_ID="JasonCoderMaker/GRDR-TVR" |
| OUTPUT_DIR="./GRDR-TVR" |
|
|
| |
| RED='\033[0;31m' |
| GREEN='\033[0;32m' |
| YELLOW='\033[1;33m' |
| BLUE='\033[0;34m' |
| NC='\033[0m' |
|
|
| |
| print_msg() { |
| local color=$1 |
| shift |
| echo -e "${color}$@${NC}" |
| } |
|
|
| |
| check_hf_cli() { |
| if ! command -v huggingface-cli &> /dev/null; then |
| print_msg $RED "Error: huggingface-cli not found!" |
| print_msg $YELLOW "Please install: pip install huggingface_hub" |
| exit 1 |
| fi |
| } |
|
|
| |
| download_all() { |
| print_msg $BLUE "==================================================" |
| print_msg $BLUE "Downloading complete GRDR-TVR dataset..." |
| print_msg $BLUE "==================================================" |
| |
| huggingface-cli download $REPO_ID \ |
| --repo-type dataset \ |
| --local-dir $OUTPUT_DIR \ |
| --local-dir-use-symlinks False |
| |
| print_msg $GREEN "✓ Complete dataset downloaded to $OUTPUT_DIR" |
| } |
|
|
| |
| download_features() { |
| local dataset=$1 |
| print_msg $BLUE "==================================================" |
| print_msg $BLUE "Downloading InternVideo2 features..." |
| print_msg $BLUE "==================================================" |
| |
| if [ -z "$dataset" ]; then |
| |
| huggingface-cli download $REPO_ID \ |
| --repo-type dataset \ |
| --include "InternVideo2/*" \ |
| --local-dir $OUTPUT_DIR \ |
| --local-dir-use-symlinks False |
| else |
| |
| huggingface-cli download $REPO_ID \ |
| --repo-type dataset \ |
| --include "InternVideo2/${dataset}/*" \ |
| --local-dir $OUTPUT_DIR \ |
| --local-dir-use-symlinks False |
| fi |
| |
| print_msg $GREEN "✓ Features downloaded to $OUTPUT_DIR/InternVideo2" |
| } |
|
|
| |
| download_grdr() { |
| local dataset=$1 |
| print_msg $BLUE "==================================================" |
| print_msg $BLUE "Downloading GRDR checkpoints..." |
| print_msg $BLUE "==================================================" |
| |
| if [ -z "$dataset" ]; then |
| |
| huggingface-cli download $REPO_ID \ |
| --repo-type dataset \ |
| --include "GRDR/*" \ |
| --local-dir $OUTPUT_DIR \ |
| --local-dir-use-symlinks False |
| else |
| |
| huggingface-cli download $REPO_ID \ |
| --repo-type dataset \ |
| --include "GRDR/${dataset}/*" \ |
| --local-dir $OUTPUT_DIR \ |
| --local-dir-use-symlinks False |
| fi |
| |
| print_msg $GREEN "✓ GRDR checkpoints downloaded to $OUTPUT_DIR/GRDR" |
| } |
|
|
| |
| download_xpool() { |
| local dataset=$1 |
| print_msg $BLUE "==================================================" |
| print_msg $BLUE "Downloading Xpool reranker checkpoints..." |
| print_msg $BLUE "==================================================" |
| |
| if [ -z "$dataset" ]; then |
| |
| huggingface-cli download $REPO_ID \ |
| --repo-type dataset \ |
| --include "Xpool/*" \ |
| --local-dir $OUTPUT_DIR \ |
| --local-dir-use-symlinks False |
| else |
| |
| local filename="" |
| case $dataset in |
| msrvtt) |
| filename="msrvtt9k_model_best.pth" |
| ;; |
| actnet) |
| filename="actnet_model_best.pth" |
| ;; |
| didemo) |
| filename="didemo_model_best.pth" |
| ;; |
| lsmdc) |
| filename="lsmdc_model_best.pth" |
| ;; |
| *) |
| print_msg $RED "Error: Unknown dataset '$dataset'" |
| exit 1 |
| ;; |
| esac |
| |
| huggingface-cli download $REPO_ID \ |
| --repo-type dataset \ |
| --include "Xpool/${filename}" \ |
| --local-dir $OUTPUT_DIR \ |
| --local-dir-use-symlinks False |
| fi |
| |
| print_msg $GREEN "✓ Xpool checkpoints downloaded to $OUTPUT_DIR/Xpool" |
| } |
|
|
| |
| show_usage() { |
| cat << EOF |
| Usage: $0 [OPTIONS] [DATASET] |
| |
| Download GRDR-TVR dataset components from Hugging Face Hub. |
| |
| OPTIONS: |
| --all Download all components (default if no option specified) |
| --features Download InternVideo2 features only |
| --grdr Download GRDR checkpoints only |
| --xpool Download Xpool reranker checkpoints only |
| -o, --output Specify output directory (default: ./GRDR-TVR) |
| -h, --help Show this help message |
| |
| DATASET (optional): |
| msrvtt MSR-VTT dataset |
| actnet ActivityNet dataset |
| didemo DiDeMo dataset |
| lsmdc LSMDC dataset |
| |
| If not specified, downloads all datasets. |
| |
| EXAMPLES: |
| # Download everything |
| $0 --all |
| |
| # Download only GRDR checkpoints |
| $0 --grdr |
| |
| # Download InternVideo2 features for MSR-VTT |
| $0 --features msrvtt |
| |
| # Download Xpool reranker for ActivityNet |
| $0 --xpool actnet |
| |
| # Download to custom directory |
| $0 --all -o ./my_data |
| |
| EOF |
| } |
|
|
| |
| main() { |
| check_hf_cli |
| |
| |
| local mode="all" |
| local dataset="" |
| |
| while [[ $# -gt 0 ]]; do |
| case $1 in |
| --all) |
| mode="all" |
| shift |
| ;; |
| --features) |
| mode="features" |
| shift |
| ;; |
| --grdr) |
| mode="grdr" |
| shift |
| ;; |
| --xpool) |
| mode="xpool" |
| shift |
| ;; |
| -o|--output) |
| OUTPUT_DIR="$2" |
| shift 2 |
| ;; |
| -h|--help) |
| show_usage |
| exit 0 |
| ;; |
| msrvtt|actnet|didemo|lsmdc) |
| dataset="$1" |
| shift |
| ;; |
| *) |
| print_msg $RED "Error: Unknown option '$1'" |
| show_usage |
| exit 1 |
| ;; |
| esac |
| done |
| |
| print_msg $BLUE "==================================================" |
| print_msg $BLUE "GRDR-TVR Dataset Downloader" |
| print_msg $BLUE "==================================================" |
| print_msg $YELLOW "Repository: $REPO_ID" |
| print_msg $YELLOW "Output: $OUTPUT_DIR" |
| if [ -n "$dataset" ]; then |
| print_msg $YELLOW "Dataset: $dataset" |
| fi |
| print_msg $BLUE "==================================================\n" |
| |
| |
| case $mode in |
| all) |
| download_all |
| ;; |
| features) |
| download_features "$dataset" |
| ;; |
| grdr) |
| download_grdr "$dataset" |
| ;; |
| xpool) |
| download_xpool "$dataset" |
| ;; |
| esac |
| |
| print_msg $GREEN "\n==================================================" |
| print_msg $GREEN "✓ Download Complete!" |
| print_msg $GREEN "==================================================" |
| print_msg $YELLOW "\nNext steps:" |
| print_msg $YELLOW "1. Verify downloads in $OUTPUT_DIR" |
| print_msg $YELLOW "2. See README.md for usage instructions" |
| print_msg $YELLOW "3. Visit https://huggingface.co/datasets/$REPO_ID\n" |
| } |
|
|
| |
| main "$@" |
|
|