File size: 1,012 Bytes
fe1c232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
CC_SNAPSHOT="2023-14"
LANG="en"
BASE_URL="https://data.together.xyz/redpajama-data-v2/v1.0.0"
BASE_DIR="/mnt/weka/peacock/enfm-dataprocessing/RedPajamaV2/data"

listings_tag="${LANG}-${CC_SNAPSHOT}-head_middle"
mkdir -p ${BASE_DIR}/listings
wget "${BASE_URL}/listings/${listings_tag}.txt" -O "${BASE_DIR}/listings/${listings_tag}.txt" # already downloaded
listings_file="${BASE_DIR}/listings/${listings_tag}.txt"

# create aria2c input filenames
component="documents"
component_extension="json.gz"
aria2c_inputfile="${BASE_DIR}/listings/${component}-${listings_tag}.txt"
out_dir="${BASE_DIR}/${component}" # for downloaded files
truncate -s 0 $aria2c_inputfile
while read line; do
  url="${BASE_URL}/${component}/${line}.${component_extension}"
  dest="${line}.${component_extension}" # path relative to --dir option of aria2c
  echo $url >> $aria2c_inputfile
  echo " out=${dest}" >> $aria2c_inputfile
done <"$listings_file"

# download
aria2c -x 8 --dir=$out_dir --input-file=$aria2c_inputfile --continue=true