40G 100_book
114G 100_c4-vi
29G 100_code
13G 100_news_2020-2021
18G 100_news_2022-2023
100G 100_slimpajama
18G 300_laws
53G 500_epub
16G 999_gov
- - - - - -
400GB Total
TODOs
- Instruct data: chuyển chatgpt => 'tí-biết-tuốt', openai => Symato
- Lọc
gov/datachinhphu.jsonl,datatieusu.jsonl,canbo_bo_nganh_vietnam.jsonl - Bổ xung secret data
- 6G minipile
(( Trộn đều data ))
- Trộn ngẫu nhiên data trong cùng 1 thư mục
- Phân chia data trong cùng 1 thư mục ra 100 phần bằng nhau
- Đọc dữ liệu của 100 phần và chuẩn hóa về
{ "text": ... }write chung về 1 file -
zcat nam_ds.jsonl.gz | shuf | gzip -c > shuf_ds.jsonl.gz
(( thêm data muộn vào 100 file đã trộn, shuf 1 lần nữa ))
gzip -c late-data >> filename.gzzcat file.gz | shuf | gzip -c > new_file.gz
(( optional ))
- Review lại code sinh binidx để bỏ
{ "text": ... } - Convert sang binidx để đếm số tokens
import subprocess
for i in range(0, 100, 4):
cmd = f"nohup python3 join.py {i} 4 &"
print(cmd)
subprocess.run(cmd, shell=True)
gzip -c file1 > foo.gz
gzip -c file2 >> foo.gz
gunzip -c foo
# is equivalent to
cat file1 file2
zcat file.txt.gz | shuf -n1
cat 1/* | gzip -c > 1.jsonl.gz &
cat 2/* | gzip -c > 2.jsonl.gz &
cat 3/* | gzip -c > 3.jsonl.gz &
cat 4/* | gzip -c > 4.jsonl.gz &
cat 5/* | gzip -c > 5.jsonl.gz &
cat 6/* | gzip -c > 6.jsonl.gz &
cat 7/* | gzip -c > 7.jsonl.gz &
cat 8/* | gzip -c > 8.jsonl.gz &
- (( DONE )) - - -
Chọn lọc 121G từ SlimPajama
ls .utils/slimpajama.*
unzstd *.zst
Lọc lại dữ liệu forum (BỎ)
mongorestore --db databasename --verbose \path\dump\<dumpfolder>
Xem file tinhte.py
Cân bằng c4_vi filtered
https://huggingface.co/tiendung/c4_vi_filtered/tree/main/classified
Lọc bớt để fit 100b token limitation
=> Sau khi cân bằng từ 200GB còn 122GB (giảm 39%)
7z -y x "*.7z"
wget https://huggingface.co/tiendung/c4_vi_filtered/resolve/main/classified/cong_nghe.7z &
wget https://huggingface.co/tiendung/c4_vi_filtered/resolve/main/classified/doi_song.7z &
wget https://huggingface.co/tiendung/c4_vi_filtered/resolve/main/classified/giai_tri.7z &
wget https://huggingface.co/tiendung/c4_vi_filtered/resolve/main/classified/giao_duc.7z &
wget https://huggingface.co/tiendung/c4_vi_filtered/resolve/main/classified/khoa_hoc.7z &
wget https://huggingface.co/tiendung/c4_vi_filtered/resolve/main/classified/kinh_te.7z &
wget https://huggingface.co/tiendung/c4_vi_filtered/resolve/main/classified/nha_dat.7z &
wget https://huggingface.co/tiendung/c4_vi_filtered/resolve/main/classified/phap_luat.7z &
wget https://huggingface.co/tiendung/c4_vi_filtered/resolve/main/classified/the_gioi.7z &
wget https://huggingface.co/tiendung/c4_vi_filtered/resolve/main/classified/the_thao.7z &
wget https://huggingface.co/tiendung/c4_vi_filtered/resolve/main/classified/unknown.7z &
wget https://huggingface.co/tiendung/c4_vi_filtered/resolve/main/classified/van_hoa.7z &
wget https://huggingface.co/tiendung/c4_vi_filtered/resolve/main/classified/xa_hoi.7z &
wget https://huggingface.co/tiendung/c4_vi_filtered/resolve/main/classified/xe_co.7z &
Cân bằng News
31GB (balanced)
x2 giai_tri
18G news-2020-2021/ -5G (27%)
26G news-2022-2023/ -8G (30%)
- - - - - - - - - - - -
44G total => 31G
2022-2023
BY-LINE-COUNT
6364652 total
1296014 xa_hoi.jsonl
952884 kinh_te.jsonl
740499 phap_luat.jsonl
602891 doi_song.jsonl
514224 the_thao.jsonl
479060 giai_tri.jsonl
380726 the_gioi.jsonl
360872 van_hoa.jsonl
343918 nha_dat.jsonl
268879 cong_nghe.jsonl
246832 giao_duc.jsonl
91774 xe_co.jsonl
85400 khoa_hoc.jsonl
679 unknown.jsonl
shuf xa_hoi.jsonl | split -l $(( $(wc -l <xa_hoi.jsonl) * 66 / 100 ))
mv xaa .save/xa_hoi.jsonl; mv xab xa_hoi.jsonl
shuf kinh_te.jsonl | split -l $(( $(wc -l <kinh_te.jsonl) * 60 / 100 ))
mv xaa .save/kinh_te.jsonl; mv xab kinh_te.jsonl
shuf doi_song.jsonl | split -l $(( $(wc -l <doi_song.jsonl) * 66 / 100 ))
mv xab .save/doi_song.jsonl; mv xaa doi_song.jsonl
shuf nha_dat.jsonl | split -l $(( $(wc -l <nha_dat.jsonl) * 50 / 100 ))
mv xaa .save/nha_dat.jsonl; mv xab nha_dat.jsonl
BY-FILE-SIZE
6023720846 xa_hoi.jsonl
5012502465 kinh_te.jsonl
2739936418 doi_song.jsonl
2460018829 phap_luat.jsonl
1752318410 nha_dat.jsonl
1734247739 van_hoa.jsonl
1627705588 the_thao.jsonl
1680150745 giai_tri.jsonl
1199792764 cong_nghe.jsonl
1187043681 giao_duc.jsonl
1344303086 the_gioi.jsonl
341947997 khoa_hoc.jsonl
340266911 xe_co.jsonl
3287153 unknown.jsonl