| # OCR-VQA Images — Download, Reassemble, and Place into LibMoE |
|
|
| This guide shows how to download split archives from Hugging Face, merge them into a single ZIP, extract, and place the images into the LibMoE data tree: |
|
|
| ``` |
| libmoe/ |
| └── data/ |
| ├── image_onevision/ |
| ├── coco/ |
| │ └── train2017/ |
| ├── gqa/ |
| │ └── images/ |
| ├── ocr_vqa/ |
| │ └── images/ |
| ├── textvqa/ |
| │ └── train_images/ |
| └── vg/ |
| ├── VG_100K/ |
| └── VG_100K_2/ |
| ``` |
|
|
| > Tested on Linux (bash). Requires ~100 GB free space for download + extraction room. |
|
|
| --- |
|
|
|
|
| ## 1) Download split parts from Hugging Face |
|
|
| Dataset: `DavidNguyen/ocr_vqa`, path: `ocr_vqa/images_part_*.zip.part` |
|
|
| ### Using `curl` directly (works anywhere) |
|
|
| ```bash |
| #!/usr/bin/env bash |
| set -euo pipefail |
| |
| DEST=./data/ocr_vqa/ocr_vqa_parts |
| mkdir -p "$DEST" |
| cd "$DEST" |
| |
| # List of parts |
| PARTS=$(echo a{a..x}) # aa ab ac ... ax |
| |
| # Download function |
| download_one() { |
| p="$1" |
| file="images_part_${p}.zip.part" |
| url="https://huggingface.co/datasets/DavidNguyen/ocr_vqa/resolve/main/ocr_vqa/${file}?download=true" |
| echo "[*] downloading $file" |
| curl -L --fail --retry 5 --retry-delay 3 -o "$file" "$url" |
| } |
| |
| export -f download_one |
| |
| echo "$PARTS" | xargs -n1 -P8 bash -c 'download_one "$@"' _ |
| |
| ``` |
|
|
| --- |
|
|
|
|
| ## 2) Concatenate parts → a single ZIP |
|
|
| If you already downloaded to `./data/`, the one-liner below (as requested) works: |
|
|
| ```bash |
| mkdir ./data/ocr_vqa |
| cat ./data/ocr_vqa/images_part_*.zip.part \ |
| > ./data/ocr_vqa/images.zip |
| ``` |
|
|
| --- |
|
|
| ## 3) Unzip |
|
|
| ```bash |
| cd ./data/ocr_vqa |
| unzip -q images.zip |
| |
| ``` |
|
|