Datasets:
Download scripts/hf_export/reexport.sh from PrentisAI/ScreenRef-Annotations: direct link, hf CLI and curl.
- Browser
- Download file 1.23 kB
-
https://huggingface.co/datasets/PrentisAI/ScreenRef-Annotations/resolve/main/scripts/hf_export/reexport.sh
- Command line
-
hf download hf://datasets/PrentisAI/ScreenRef-Annotations/scripts/hf_export/reexport.sh
-
curl -L -o reexport.sh https://huggingface.co/datasets/PrentisAI/ScreenRef-Annotations/resolve/main/scripts/hf_export/reexport.sh
1.23 kB
| # Rebuild the Parquet release from annotations + an extracted image tree. | |
| # | |
| # Usage: | |
| # 1. Extract the screenshots to <root>/images/ (see README, "Getting the screenshots") | |
| # 2. Put this repository's anno/ anno_point/ meta/ scripts/ under <root>/ | |
| # 3. cd <root> && bash scripts/hf_export/reexport.sh [meta file] [output dir] | |
| # | |
| # Paths inside meta/ are relative, so the working directory must be <root>. | |
| set -euo pipefail | |
| META="${1:-meta/meta_full.json}" | |
| OUT="${2:-parquet_out/data}" | |
| PY="${PYTHON:-python3}" | |
| JOBS="${JOBS:-8}" | |
| [ -f "$META" ] || { echo "cannot find $META (cwd must be the data root)" >&2; exit 1; } | |
| [ -d images ] || { echo "cannot find ./images/ - extract the screenshots first" >&2; exit 1; } | |
| mkdir -p "$OUT" | |
| NTASK=$("$PY" -c "import json; print(len(json.load(open('$META'))))") | |
| echo "== exporting $NTASK tasks -> $OUT ==" | |
| seq 0 $((NTASK - 1)) | xargs -P "$JOBS" -I{} \ | |
| "$PY" scripts/hf_export/build_shards.py --meta "$META" --out "$OUT" --task-index {} | |
| echo "== renaming to train-XXXXX-of-YYYYY.parquet ==" | |
| "$PY" scripts/hf_export/finalize.py --dir "$OUT" --meta "$META" --apply | |
| echo "== result ==" | |
| ls "$OUT" | grep -cE '^train-[0-9]{5}-of-[0-9]{5}\.parquet$' | |
| du -sh "$OUT" | |