zzsyppt commited on
Commit
957610d
·
verified ·
1 Parent(s): e5dfbcc

Add files using upload-large-folder tool

Browse files
Files changed (48) hide show
  1. images/part-00000/img_000000.png +3 -0
  2. images/part-00000/img_000001.png +3 -0
  3. images/part-00000/img_000002.png +3 -0
  4. images/part-00000/img_000003.png +3 -0
  5. images/part-00000/img_000004.png +3 -0
  6. images/part-00000/img_000005.png +3 -0
  7. images/part-00000/img_000006.png +3 -0
  8. images/part-00000/img_000007.png +3 -0
  9. images/part-00000/img_000008.png +3 -0
  10. images/part-00000/img_000009.png +3 -0
  11. images/part-00000/img_000010.png +3 -0
  12. images/part-00000/img_000011.png +3 -0
  13. images/part-00000/img_000012.png +3 -0
  14. images/part-00000/img_000013.png +3 -0
  15. images/part-00000/img_000014.png +3 -0
  16. images/part-00000/img_000015.png +3 -0
  17. images/part-00000/img_000016.png +3 -0
  18. images/part-00000/img_000017.png +3 -0
  19. images/part-00000/img_000018.png +3 -0
  20. images/part-00000/img_000019.png +3 -0
  21. images/part-00000/img_000020.png +3 -0
  22. images/part-00000/img_000021.png +3 -0
  23. images/part-00000/img_000022.png +3 -0
  24. images/part-00000/img_000023.png +3 -0
  25. images/part-00000/img_000024.png +3 -0
  26. images/part-00000/img_000025.png +3 -0
  27. images/part-00000/img_000026.png +3 -0
  28. images/part-00000/img_000027.png +3 -0
  29. images/part-00000/img_000028.png +3 -0
  30. images/part-00000/img_000029.png +3 -0
  31. images/part-00000/img_000030.png +3 -0
  32. images/part-00000/img_000031.png +3 -0
  33. images/part-00000/img_000032.png +3 -0
  34. images/part-00000/img_000033.png +3 -0
  35. images/part-00000/img_000034.png +3 -0
  36. images/part-00000/img_000035.png +3 -0
  37. images/part-00000/img_000036.png +3 -0
  38. images/part-00000/img_000037.png +3 -0
  39. images/part-00000/img_000038.png +3 -0
  40. images/part-00000/img_000039.png +3 -0
  41. images/part-00000/img_000040.png +3 -0
  42. images/part-00000/img_000041.png +3 -0
  43. images/part-00000/img_000042.png +3 -0
  44. images/part-00000/img_000043.png +3 -0
  45. images/part-00000/img_000044.png +3 -0
  46. images/part-00000/img_000045.png +3 -0
  47. metadata.jsonl +0 -0
  48. reshard_hf_dataset.py +94 -0
images/part-00000/img_000000.png ADDED

Git LFS Details

  • SHA256: 1c440c45e181ffd73585273e884751a6318b6c5090685f9446806e83ac6dbc04
  • Pointer size: 131 Bytes
  • Size of remote file: 480 kB
images/part-00000/img_000001.png ADDED

Git LFS Details

  • SHA256: 152be8c066c22a1ab2160baed0dfd01239f59fc119d5798d2834a8295b1687e6
  • Pointer size: 131 Bytes
  • Size of remote file: 660 kB
images/part-00000/img_000002.png ADDED

Git LFS Details

  • SHA256: 010e2c0d26abee296ade77bf554a037f9e7b882346042482d0f69ffc46dc32bb
  • Pointer size: 132 Bytes
  • Size of remote file: 1.15 MB
images/part-00000/img_000003.png ADDED

Git LFS Details

  • SHA256: b0303a7d0981330b9dbb723764b19d49e306bf727ef1645a4216bb1396f0d52f
  • Pointer size: 131 Bytes
  • Size of remote file: 520 kB
images/part-00000/img_000004.png ADDED

Git LFS Details

  • SHA256: 52c53b3a35c2e5aef70afbbe09cbd4bedac04a1a68d86cd7152298955da24d05
  • Pointer size: 131 Bytes
  • Size of remote file: 598 kB
images/part-00000/img_000005.png ADDED

Git LFS Details

  • SHA256: 2a9d95a5c6bba6cf52752ea4fbd29c012b2e699bb3a0272ecc5bda5af14c70a7
  • Pointer size: 132 Bytes
  • Size of remote file: 1.09 MB
images/part-00000/img_000006.png ADDED

Git LFS Details

  • SHA256: df7f4ab8a175de362a33580234a386ae028da7e21b26f8bc750ca15cfd810320
  • Pointer size: 131 Bytes
  • Size of remote file: 625 kB
images/part-00000/img_000007.png ADDED

Git LFS Details

  • SHA256: 955c1dffadfa9bbcd575e507080f6dd06fe73ac7461da8633f733dbb5144b84b
  • Pointer size: 132 Bytes
  • Size of remote file: 1.54 MB
images/part-00000/img_000008.png ADDED

Git LFS Details

  • SHA256: ffacaf6cd7793a2b86d1cf624b33a7becd17b2262081571ee1b7ffda60772e74
  • Pointer size: 131 Bytes
  • Size of remote file: 934 kB
images/part-00000/img_000009.png ADDED

Git LFS Details

  • SHA256: be5c702d1325de097a10a0178e93ae4da36be06fbc84bc95dfa8a03db51c63b1
  • Pointer size: 131 Bytes
  • Size of remote file: 388 kB
images/part-00000/img_000010.png ADDED

Git LFS Details

  • SHA256: 5ec9b75d3747f50ac0b193a86440ce4b55470c48f7370611e1e284859381d115
  • Pointer size: 132 Bytes
  • Size of remote file: 1.82 MB
images/part-00000/img_000011.png ADDED

Git LFS Details

  • SHA256: 040cb4c269d480ac29d5baff754000ece9623a3998cbc8f8bae9f4a652bc3f11
  • Pointer size: 131 Bytes
  • Size of remote file: 974 kB
images/part-00000/img_000012.png ADDED

Git LFS Details

  • SHA256: c0418acfebf5c57180e38d6c9987a0a09b33dd0a639a65637a2bdb4cb897fcb9
  • Pointer size: 131 Bytes
  • Size of remote file: 941 kB
images/part-00000/img_000013.png ADDED

Git LFS Details

  • SHA256: 85d28511099dfe183d060cb03c97e9de7c46e883fb1138020d5f6fafeca82fec
  • Pointer size: 132 Bytes
  • Size of remote file: 1.25 MB
images/part-00000/img_000014.png ADDED

Git LFS Details

  • SHA256: 1c7f56366bce8f1188144ffc4c2cf3ea477e584491b4897bc9b8d047f77e81aa
  • Pointer size: 131 Bytes
  • Size of remote file: 785 kB
images/part-00000/img_000015.png ADDED

Git LFS Details

  • SHA256: 56319163039ebbe3ccb1a33ffe68c7cac69679cf3f9553cabde3c84ea23f15ba
  • Pointer size: 131 Bytes
  • Size of remote file: 555 kB
images/part-00000/img_000016.png ADDED

Git LFS Details

  • SHA256: 39df9384ea8ead87d4816dfcb59e2787317d373084267ba33ead489e9162dc57
  • Pointer size: 131 Bytes
  • Size of remote file: 788 kB
images/part-00000/img_000017.png ADDED

Git LFS Details

  • SHA256: 0218aae1824ddd68bdc7cb34f035a5fa1cbf84deab83e2cc20ada0706cd30dc6
  • Pointer size: 131 Bytes
  • Size of remote file: 944 kB
images/part-00000/img_000018.png ADDED

Git LFS Details

  • SHA256: 285f93ed98a5337dce10933d6014610f4b253b2ed45c97d8d28049b6ba6726ff
  • Pointer size: 131 Bytes
  • Size of remote file: 922 kB
images/part-00000/img_000019.png ADDED

Git LFS Details

  • SHA256: 063cd4bbed394cac9cabb420a956f48eab4a50cf2761bbd223838770cba2cc2d
  • Pointer size: 131 Bytes
  • Size of remote file: 401 kB
images/part-00000/img_000020.png ADDED

Git LFS Details

  • SHA256: f5567dbac6a0a2514a962344f3f21da88a127c5a57c4c66a4223ba6bae47c3e0
  • Pointer size: 131 Bytes
  • Size of remote file: 307 kB
images/part-00000/img_000021.png ADDED

Git LFS Details

  • SHA256: 7c187f4aed8cc9428cc4d3da36aec8a0dd000337c837b09b53cf41fd6ada1969
  • Pointer size: 131 Bytes
  • Size of remote file: 598 kB
images/part-00000/img_000022.png ADDED

Git LFS Details

  • SHA256: 0b252643b58a48ecc7c2e0e525ebc0b944544085f892d92355df8e03684e15c5
  • Pointer size: 131 Bytes
  • Size of remote file: 625 kB
images/part-00000/img_000023.png ADDED

Git LFS Details

  • SHA256: 7093fc63219980caa4e036907b8d7d41caecfa2ccfcbe08f7be0ad49ff8225c9
  • Pointer size: 132 Bytes
  • Size of remote file: 1.45 MB
images/part-00000/img_000024.png ADDED

Git LFS Details

  • SHA256: 5a0a44338c0eba17452a839d1cc1e30a028cbeba3aafb92cc20efae8a10d3860
  • Pointer size: 131 Bytes
  • Size of remote file: 672 kB
images/part-00000/img_000025.png ADDED

Git LFS Details

  • SHA256: a5887c5844ddc7f1fe90e05b0d79416195e0c8a6a2176f798a016d6761cc5cf1
  • Pointer size: 131 Bytes
  • Size of remote file: 637 kB
images/part-00000/img_000026.png ADDED

Git LFS Details

  • SHA256: 1a6a9bf0ad665f2d6c53a24811ca354aa379d2753e63f7f4e73ee02cd1e693e6
  • Pointer size: 132 Bytes
  • Size of remote file: 1.07 MB
images/part-00000/img_000027.png ADDED

Git LFS Details

  • SHA256: c2829814548abb0b2888c5eadc82cf733783ed9219c517e470a5cff9b4abb223
  • Pointer size: 131 Bytes
  • Size of remote file: 708 kB
images/part-00000/img_000028.png ADDED

Git LFS Details

  • SHA256: bdacfd62d1dec4de15f78c33193a08e68568c40110ad374cf50112727804eb48
  • Pointer size: 131 Bytes
  • Size of remote file: 823 kB
images/part-00000/img_000029.png ADDED

Git LFS Details

  • SHA256: cf446fae13333cc4d16e293bc9d0301337dbe28f08415e7e37214c5efca4a90d
  • Pointer size: 131 Bytes
  • Size of remote file: 558 kB
images/part-00000/img_000030.png ADDED

Git LFS Details

  • SHA256: f487e5cde5ea172430db7530b84700c941ef6865928c5b609d817321790ca22b
  • Pointer size: 131 Bytes
  • Size of remote file: 700 kB
images/part-00000/img_000031.png ADDED

Git LFS Details

  • SHA256: d13b84a40ed403e8cb6ccf3e0382f7fcc4ba9888514f6cec8940fbbf3b784feb
  • Pointer size: 132 Bytes
  • Size of remote file: 1.28 MB
images/part-00000/img_000032.png ADDED

Git LFS Details

  • SHA256: eb04f7016c6d841fb870f71411b81406bfe304dd35b911a0e9b01cee7ce9f994
  • Pointer size: 132 Bytes
  • Size of remote file: 1.14 MB
images/part-00000/img_000033.png ADDED

Git LFS Details

  • SHA256: 2bf6ca31df94767cabe2775142b8e6c2598902df60c45e133e439c1f96377513
  • Pointer size: 131 Bytes
  • Size of remote file: 672 kB
images/part-00000/img_000034.png ADDED

Git LFS Details

  • SHA256: 9126381c65a33939f1d1a4909147eadf8cbed046cb8214c635976a10a469d1ab
  • Pointer size: 131 Bytes
  • Size of remote file: 751 kB
images/part-00000/img_000035.png ADDED

Git LFS Details

  • SHA256: 73b834a0b629fc178f9305ea6713c916aa3e100b8f2fa5790e2221ca5f4e74cd
  • Pointer size: 131 Bytes
  • Size of remote file: 761 kB
images/part-00000/img_000036.png ADDED

Git LFS Details

  • SHA256: e322479b9d741561efd5ffdd419bb97635f214ccb2c5bbc4cdc68a7830497605
  • Pointer size: 132 Bytes
  • Size of remote file: 1.66 MB
images/part-00000/img_000037.png ADDED

Git LFS Details

  • SHA256: c30efee76ca14c28250e6da8132735e9cbd05ba6cc99fbfc237527a073d7e2b9
  • Pointer size: 131 Bytes
  • Size of remote file: 918 kB
images/part-00000/img_000038.png ADDED

Git LFS Details

  • SHA256: 2b7ded15e271d9cf266fe8a6e699334db3c490d629ca00c9de8f468ac99918d9
  • Pointer size: 132 Bytes
  • Size of remote file: 1.07 MB
images/part-00000/img_000039.png ADDED

Git LFS Details

  • SHA256: 52099a0953dc853f61e288e44dcee8644f3bfdadc659214f9b166bbd64725d7c
  • Pointer size: 131 Bytes
  • Size of remote file: 750 kB
images/part-00000/img_000040.png ADDED

Git LFS Details

  • SHA256: 9bf5c585709438a441e24cb3365ad7655316c814bc2cb3b7f69978ebc19e9961
  • Pointer size: 131 Bytes
  • Size of remote file: 191 kB
images/part-00000/img_000041.png ADDED

Git LFS Details

  • SHA256: a275d8a59ed04ed324bd4c1363c6a035117cf6215e67e17753ce0b34d1b9891b
  • Pointer size: 131 Bytes
  • Size of remote file: 791 kB
images/part-00000/img_000042.png ADDED

Git LFS Details

  • SHA256: acf54cff1581f101dac75aa5c77c9e3c012183369dbbae9e25c28424c824d302
  • Pointer size: 131 Bytes
  • Size of remote file: 610 kB
images/part-00000/img_000043.png ADDED

Git LFS Details

  • SHA256: 1174167588942310148d096af8f5f01970eb68913a203c4d46e19ec3df4fb8c4
  • Pointer size: 131 Bytes
  • Size of remote file: 930 kB
images/part-00000/img_000044.png ADDED

Git LFS Details

  • SHA256: 023642ebfc23a43fa28147ee60ba29484e4b103a6f062a02e962ba18396a4988
  • Pointer size: 132 Bytes
  • Size of remote file: 1.04 MB
images/part-00000/img_000045.png ADDED

Git LFS Details

  • SHA256: e7c88ad9eab0ab8eedca033dc156a67fd271409ace4b0a5f5ca21660e4f1400d
  • Pointer size: 131 Bytes
  • Size of remote file: 754 kB
metadata.jsonl CHANGED
The diff for this file is too large to render. See raw diff
 
reshard_hf_dataset.py ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import argparse
2
+ import json
3
+ import os
4
+ import shutil
5
+ from pathlib import Path
6
+
7
+
8
+ def copy_or_link(src: Path, dst: Path, mode: str) -> None:
9
+ dst.parent.mkdir(parents=True, exist_ok=True)
10
+
11
+ if dst.exists():
12
+ return
13
+
14
+ if mode == "hardlink":
15
+ try:
16
+ os.link(src, dst)
17
+ return
18
+ except OSError:
19
+ pass
20
+
21
+ shutil.copy2(src, dst)
22
+
23
+
24
+ def main():
25
+ parser = argparse.ArgumentParser()
26
+ parser.add_argument("--src", default=".", help="Original hf_dataset directory")
27
+ parser.add_argument("--dst", default="../hf_dataset_sharded", help="Output sharded dataset directory")
28
+ parser.add_argument("--group-size", type=int, default=5000, help="Images per subdirectory")
29
+ parser.add_argument("--mode", choices=["copy", "hardlink"], default="hardlink")
30
+ args = parser.parse_args()
31
+
32
+ src = Path(args.src).resolve()
33
+ dst = Path(args.dst).resolve()
34
+
35
+ metadata_in = src / "metadata.jsonl"
36
+ metadata_out = dst / "metadata.jsonl"
37
+
38
+ if not metadata_in.exists():
39
+ raise FileNotFoundError(f"Cannot find {metadata_in}")
40
+
41
+ if dst.exists():
42
+ raise FileExistsError(f"{dst} already exists. Delete it first or choose another --dst.")
43
+
44
+ dst.mkdir(parents=True)
45
+
46
+ # Copy root files and folders except images/ and metadata.jsonl.
47
+ for item in src.iterdir():
48
+ if item.name in {"images", "metadata.jsonl"}:
49
+ continue
50
+
51
+ target = dst / item.name
52
+ if item.is_dir():
53
+ shutil.copytree(item, target)
54
+ else:
55
+ shutil.copy2(item, target)
56
+
57
+ count = 0
58
+ missing = []
59
+
60
+ with metadata_in.open("r", encoding="utf-8") as fin, metadata_out.open("w", encoding="utf-8", newline="\n") as fout:
61
+ for idx, line in enumerate(fin):
62
+ if not line.strip():
63
+ continue
64
+
65
+ row = json.loads(line)
66
+ old_rel = Path(row["file_name"].replace("\\", "/"))
67
+ old_img = src / old_rel
68
+
69
+ if not old_img.exists():
70
+ missing.append(str(old_rel))
71
+ continue
72
+
73
+ part_name = f"part-{idx // args.group_size:05d}"
74
+ new_rel = Path("images") / part_name / old_rel.name
75
+ new_img = dst / new_rel
76
+
77
+ copy_or_link(old_img, new_img, args.mode)
78
+
79
+ row["file_name"] = new_rel.as_posix()
80
+ fout.write(json.dumps(row, ensure_ascii=False) + "\n")
81
+ count += 1
82
+
83
+ print(f"Done. Wrote {count} samples to {dst}")
84
+ print(f"New metadata: {metadata_out}")
85
+
86
+ if missing:
87
+ print(f"Missing images: {len(missing)}")
88
+ for x in missing[:20]:
89
+ print(" ", x)
90
+ raise SystemExit(1)
91
+
92
+
93
+ if __name__ == "__main__":
94
+ main()