Upload .mirror/mirror_worker.py with huggingface_hub
Browse files- .mirror/mirror_worker.py +6 -0
.mirror/mirror_worker.py
CHANGED
|
@@ -231,6 +231,12 @@ def main() -> None:
|
|
| 231 |
if len(pending) >= 200 or pending_bytes >= 5_000_000_000:
|
| 232 |
flush()
|
| 233 |
print(f"done {number}/{shard_total} {path}", flush=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
finally:
|
| 235 |
# Staged files remain until their batch commit succeeds.
|
| 236 |
if path not in uploaded:
|
|
|
|
| 231 |
if len(pending) >= 200 or pending_bytes >= 5_000_000_000:
|
| 232 |
flush()
|
| 233 |
print(f"done {number}/{shard_total} {path}", flush=True)
|
| 234 |
+
except Exception as exc:
|
| 235 |
+
# ModelScope occasionally returns an empty 200 response for an
|
| 236 |
+
# otherwise valid tiny object. Keep moving so a single flaky
|
| 237 |
+
# metadata file never terminates the whole shard; a later worker
|
| 238 |
+
# run will retry it because it was not added to `uploaded`.
|
| 239 |
+
print(f"ERROR {number}/{shard_total} {path}: {exc}", flush=True)
|
| 240 |
finally:
|
| 241 |
# Staged files remain until their batch commit succeeds.
|
| 242 |
if path not in uploaded:
|