| #!/bin/bash |
| |
| |
|
|
| SHARD_DIR="${1:-data}" |
| OUT_DIR="${2:-llava178k_merged}" |
| WORKERS="${3:-8}" |
|
|
| mkdir -p "$OUT_DIR" |
|
|
| shards=("$SHARD_DIR"/shard_*.tar.gz) |
| total=${#shards[@]} |
| echo "Found $total shards, extracting with $WORKERS workers -> $OUT_DIR" |
|
|
| |
| if command -v parallel &>/dev/null; then |
| printf '%s\n' "${shards[@]}" | parallel -j "$WORKERS" --bar \ |
| tar xf {} --strip-components=1 -C "$OUT_DIR/" |
| else |
| printf '%s\n' "${shards[@]}" | xargs -P "$WORKERS" -I{} \ |
| bash -c 'echo "Extracting {}..." && tar xf "{}" --strip-components=1 -C '"$OUT_DIR/" |
| fi |
|
|
| echo "Done. Extracted $total shards to $OUT_DIR/" |
|
|