Upload process.sh with huggingface_hub
Browse files- process.sh +31 -16
process.sh
CHANGED
@@ -1,33 +1,48 @@
|
|
1 |
-
#!/bin/
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
# Base URL for the chunked files
|
4 |
-
BASE_URL="https://huggingface.co/datasets/
|
5 |
|
6 |
# The base name of the files (without extension)
|
7 |
BASE_NAME="$1_chunks"
|
8 |
|
9 |
# Extension for the chunked files
|
10 |
-
EXTENSION="
|
11 |
|
12 |
# Download all chunked files
|
13 |
-
|
14 |
-
for
|
15 |
-
|
16 |
-
|
|
|
17 |
done
|
18 |
|
19 |
# Combine the chunked files
|
20 |
-
|
21 |
|
22 |
# Remove the chunked files
|
23 |
-
rm
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
-
#
|
29 |
-
|
30 |
|
31 |
-
# Remove the combined zip file
|
32 |
-
rm "$1".zip
|
33 |
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
#
|
3 |
+
#SBATCH --account=glab
|
4 |
+
#SBATCH -N 1
|
5 |
+
#SBATCH -c 24
|
6 |
+
#SBATCH --mem=100gb
|
7 |
+
#SBATCH --time=05-00:00
|
8 |
|
9 |
# Base URL for the chunked files
|
10 |
+
BASE_URL="https://huggingface.co/datasets/LEAP/ChaosBench/resolve/main/$1/"
|
11 |
|
12 |
# The base name of the files (without extension)
|
13 |
BASE_NAME="$1_chunks"
|
14 |
|
15 |
# Extension for the chunked files
|
16 |
+
EXTENSION="tar.gz"
|
17 |
|
18 |
# Download all chunked files
|
19 |
+
for prefix in {a..z}; do
|
20 |
+
for suffix in {a..z}; do
|
21 |
+
FILE_NAME="${BASE_NAME}.${EXTENSION}.${prefix}${suffix}"
|
22 |
+
wget "${BASE_URL}${FILE_NAME}" || break 2
|
23 |
+
done
|
24 |
done
|
25 |
|
26 |
# Combine the chunked files
|
27 |
+
cat ${BASE_NAME}.${EXTENSION}.* > "$1".tar.gz
|
28 |
|
29 |
# Remove the chunked files
|
30 |
+
rm ${BASE_NAME}.${EXTENSION}.*
|
31 |
+
|
32 |
+
# Extract the combined file
|
33 |
+
echo "EXTRACTING FOLDER, THIS MAY TAKE A WHILE..."
|
34 |
+
if [ "$2" == "with_pigz" ]; then
|
35 |
+
echo "Use pigz for parallel decompression..."
|
36 |
+
pigz -dc "$1".tar.gz | tar -xf -
|
37 |
+
else
|
38 |
+
# Use standard tar for decompression
|
39 |
+
tar -xzf "$1".tar.gz
|
40 |
+
fi
|
41 |
+
|
42 |
+
# Remove the combined compressed file
|
43 |
+
rm "$1".tar.gz
|
44 |
|
45 |
+
# Rename folder
|
46 |
+
mv "$1"_tmp "$1"
|
47 |
|
|
|
|
|
48 |
|