File size: 827 Bytes
0b3aa8c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
27
28
29
30
31
32
33
34
35
# original dataset: https://huggingface.co/datasets/ezipe/lichess_2023_janoct
# you'll need around 6TB or so for this. it'll take around 8 hours or so
import os

NUM_SPLITS = 32

def SPLIT_CMD(fname, num=32):
    return f'split -d -n l/{num} {fname} {fname}.'


# for each file in dir that ends in zstd: uncompress, save fnames
fnames = []
for fname in os.listdir():
    if fname.endswith('.zst') and os.path.getsize(fname) > 15072192300:
        #os.system(f'unzstd -T0 {fname}')
        fnames.append(fname[:-4])
        

# split each
#for fname in fnames:
#    os.system(SPLIT_CMD(fname, NUM_SPLITS))

# recompress each
for fname in fnames:
    for i in range(NUM_SPLITS):
        rm = (f'rm {fname}.{i:02d}.zst')
        os.system(rm)

        cm = (f'zstd -T0 {fname}.{i:02d}')
        print(cm)
        os.system(cm)