mrfakename commited on
Commit
874b03d
·
verified ·
1 Parent(s): 5c91465

Upload .mirror/mirror_worker.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. .mirror/mirror_worker.py +7 -3
.mirror/mirror_worker.py CHANGED
@@ -159,9 +159,13 @@ def main() -> None:
159
  if number % WORKER_COUNT == WORKER_INDEX
160
  and (item.get("Type") or item.get("type")) != "tree"
161
  ]
162
- # Each shard is processed in deterministic manifest order. Resume at its
163
- # first absent path instead of walking tens of thousands of committed files
164
- # after every hourly job restart.
 
 
 
 
165
  shard_total = len(selected)
166
  resume_at = next(
167
  (
 
159
  if number % WORKER_COUNT == WORKER_INDEX
160
  and (item.get("Type") or item.get("type")) != "tree"
161
  ]
162
+ # Prioritize payload throughput. ModelScope's path order begins with a
163
+ # massive collection of sub-kilobyte metrics JSONs; sending those first
164
+ # strands the workers in metadata while multi-gigabyte payloads wait.
165
+ # The order remains deterministic, and uploaded paths are still skipped.
166
+ selected.sort(key=lambda item: int(item.get("Size") or item.get("size") or 0), reverse=True)
167
+ # Resume at the first not-yet-uploaded file instead of walking committed
168
+ # files after every hourly job restart.
169
  shard_total = len(selected)
170
  resume_at = next(
171
  (