tzvc commited on
Commit
b829241
2 Parent(s): c5f11ad 45b301e

Merge branch 'main' of https://huggingface.co/datasets/tzvc/organization-logos

Browse files
chunk-dataset.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import os
3
+ import shutil
4
+
5
+ def file_exists(file_path):
6
+ return os.path.isfile(file_path)
7
+
8
+ def read_jsonl(file_path):
9
+ data = []
10
+ with open(file_path, 'r') as f:
11
+ for line in f:
12
+ data.append(json.loads(line))
13
+ return data
14
+
15
+ if __name__ == "__main__":
16
+ count = 0
17
+ chunk_nb = 0
18
+ data = read_jsonl("./data/metadata.jsonl")
19
+ os.mkdir("./data/" + f"chunk_{chunk_nb}/")
20
+ print(len(data))
21
+ for d in data:
22
+ # check if file exist
23
+ if not file_exists("./data/" + d.get("file_name")):
24
+ print("File not found: " + d.get("file_name"))
25
+ continue
26
+ new_path = "./data/" + f"chunk_{chunk_nb}/" + d.get("file_name")
27
+ shutil.copyfile("./data/" + d.get("file_name"), new_path)
28
+ # update file name in JSONL recor
29
+ d["file_name"] = f"./chunk_{chunk_nb}/" + d.get("file_name")
30
+ count += 1
31
+ if count >= 10:
32
+ chunk_nb += 1
33
+ count = 0
34
+ os.mkdir("./data/" + f"chunk_{chunk_nb}/")
35
+ # write to new JSONL file
36
+ with open("./data/metadata-chunked.jsonl", "a") as f:
37
+ f.write(json.dumps(d) + "\n")
38
+ # print(d.get("file_name"))
39
+ print(len(data))
40
+ print(count)
data/train-00000-of-00014-21f64ccdbd92b6a4.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:03a0822e39f2cf6e7d35443847e124f123bd8fb01707ec4367dd4a90f7a147b7
3
+ size 468899948
data/train-00001-of-00014-65d4ae0d45d580b0.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:16f1bfe8ba4b8f677fab6b1bc9770376f8e6f9a5a839ad6eb1e906fec89a0208
3
+ size 474370046
data/train-00002-of-00014-2d52b35850197f36.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f652316883307f14e87e05e3f4dea8ba403f971417449a42220dd529daabf869
3
+ size 472565461
data/train-00003-of-00014-a69c3e75ea2a1aae.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0e7cd0dbb007ee89c283e776ff534893435fe5f3ba7b29edbf15c5bd3631f9c
3
+ size 480945458
data/train-00004-of-00014-647e8117a7503b86.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:215cf08bfa203d58c3ecbf8e268c2fe9c4ef665a3fbe7b705f03eb370f298524
3
+ size 472333722
data/train-00005-of-00014-06d96c1fdbdf39ef.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:da3c3fcfd3203dbcb5c7e7ee1af2c244b27fd6bce8c1852e19f81d540f82f042
3
+ size 480137254
data/train-00006-of-00014-f5297f0b41e6ba13.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:dd1a241dcf3c4fa546d335772fee303c0b17aefd9c342bb8d6a85b345a6c2016
3
+ size 466290959
data/train-00007-of-00014-f5d439ae2cdf3279.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5593816ec15af7ff4c427a982ca35fdef0a5049827c6631a3d6c193802786356
3
+ size 485943622
data/train-00008-of-00014-32b617d5af85f293.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:77bb17865ecb268e7d1611701d7ce2ef0e96e36357fe2e512f4999996542de54
3
+ size 485556916
data/train-00009-of-00014-96761be834a43e98.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:72979e2282499dccc296efe8d23cd100339a5bd52ec9bf7879ba42fc45617385
3
+ size 481942953
data/train-00010-of-00014-ef5cffa2be645a4c.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e3494777d49ecea41bccb9f34bd13952a5721ae59e6563735e7c401a00a7720c
3
+ size 483001546
data/train-00011-of-00014-c1859e9436651f15.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:22636378f9d6236de74e5d6b12b3470a057c8b095a9982ed97442348b9a0cd58
3
+ size 474565746
data/train-00012-of-00014-97baf426d40972f6.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f36a66364d654968efdd5f21fa8b04e6ae031327175bd7f0e966e0e06a608d7d
3
+ size 469862944
data/train-00013-of-00014-d7a7713c350e18e4.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bf4922aa680fbc47b1bf5f0a5360f1fe9bf4da5e15e2b470bb80c17052b4c8ec
3
+ size 470759160