| # Base URL for the chunked files | |
| BASE_URL="https://huggingface.co/datasets/LEAP/ChaosBench/resolve/main/$1/" | |
| # The base name of the files (without extension) | |
| BASE_NAME="$1_chunks" | |
| # Extension for the chunked files | |
| EXTENSION="tar.gz" | |
| # Download all chunked files | |
| for prefix in {a..z}; do | |
| for suffix in {a..z}; do | |
| FILE_NAME="${BASE_NAME}.${EXTENSION}.${prefix}${suffix}" | |
| wget "${BASE_URL}${FILE_NAME}" || break 2 | |
| done | |
| done | |
| # Combine the chunked files | |
| echo "COMBINING CHUNKS, THIS MAY TAKE A WHILE..." | |
| cat ${BASE_NAME}.${EXTENSION}.* > "$1".tar.gz | |
| # Remove the chunked files | |
| rm ${BASE_NAME}.${EXTENSION}.* | |
| # Extract the combined file | |
| echo "EXTRACTING FOLDER, THIS MAY TAKE A WHILE..." | |
| if [ "$2" == "with_pigz" ]; then | |
| echo "Use pigz for parallel decompression..." | |
| pigz -dc "$1".tar.gz | tar -xf - | |
| else | |
| # Use standard tar for decompression | |
| tar -xzf "$1".tar.gz | |
| fi | |
| # Remove the combined compressed file | |
| rm "$1".tar.gz | |
| # Rename folder | |
| mv "$1"_tmp "$1" | |