ultralytics
juliozhao commited on
Commit
17ee7e2
·
verified ·
1 Parent(s): 0d1aa04

Simplify dataset download instructions

Browse files
Files changed (1) hide show
  1. README.md +3 -19
README.md CHANGED
@@ -64,34 +64,18 @@ The four downstream benchmarks are released as separate dataset repositories, ea
64
 
65
  ```python
66
  # pip install huggingface_hub
67
- from pathlib import Path
68
  from huggingface_hub import snapshot_download
69
 
70
- def flatten_shards(root):
71
- """Move shard_NN/* back into images/ resp. labels/ (D4LA, M6Doc only)."""
72
- root = Path(root)
73
- for sub in ("images", "labels"):
74
- d = root / sub
75
- for shard in sorted(d.glob("shard_*")):
76
- for f in shard.iterdir():
77
- target = d / f.name
78
- if target.exists():
79
- raise FileExistsError(target) # names are unique across shards
80
- f.rename(target)
81
- shard.rmdir()
82
-
83
  for repo, local in [
84
  ("juliozhao/D4LA", "D4LA"), # keep these exact directory names
85
- ("juliozhao/M6Doc", "m6doc"), # (the pipeline aliases depend on them)
86
  ("juliozhao/HJDataset", "HJDataset"),
87
  ("juliozhao/PRIMA-LAD", "prima-lad"),
88
  ]:
89
- snapshot_download(repo, repo_type="dataset", local_dir=local,
90
- ignore_patterns=["v1.zip"])
91
- flatten_shards(local)
92
  ```
93
 
94
- > **Shard note.** D4LA and M6Doc exceed HuggingFace's 10,000-files-per-directory limit, so overflow files are stored in `shard_NN/` subdirectories. The `flatten_shards` helper above restores the standard flat layout after download. HJDataset's `v1.zip` is excluded by the same code — it is a redundant re-pack of the same pages and is not needed.
95
 
96
  ## Usage
97
 
 
64
 
65
  ```python
66
  # pip install huggingface_hub
 
67
  from huggingface_hub import snapshot_download
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  for repo, local in [
70
  ("juliozhao/D4LA", "D4LA"), # keep these exact directory names
71
+ ("juliozhao/M6Doc", "m6doc"), # (the val/train scripts depend on them)
72
  ("juliozhao/HJDataset", "HJDataset"),
73
  ("juliozhao/PRIMA-LAD", "prima-lad"),
74
  ]:
75
+ snapshot_download(repo, repo_type="dataset", local_dir=local)
 
 
76
  ```
77
 
78
+ Each repository is ready to use as-is: the split lists point to the actual file locations, so no post-processing is needed after download.
79
 
80
  ## Usage
81