hf_train_job: monkey-patch XetProgressReporter to avoid upload crash
Browse files- scripts/hf_train_job.py +12 -8
scripts/hf_train_job.py
CHANGED
|
@@ -190,14 +190,18 @@ if TOKEN and checkpoint_path and Path(checkpoint_path).exists():
|
|
| 190 |
repo_id = "mattbitzesty/pino-pimt-checkpoint"
|
| 191 |
_log(f"[HF-JOB] Uploading {checkpoint_path} to {repo_id} as pimt_v4.pt")
|
| 192 |
try:
|
| 193 |
-
#
|
| 194 |
-
# progress
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
from huggingface_hub import HfApi, create_repo
|
| 202 |
|
| 203 |
create_repo(repo_id, private=True, token=TOKEN, exist_ok=True)
|
|
|
|
| 190 |
repo_id = "mattbitzesty/pino-pimt-checkpoint"
|
| 191 |
_log(f"[HF-JOB] Uploading {checkpoint_path} to {repo_id} as pimt_v4.pt")
|
| 192 |
try:
|
| 193 |
+
# Monkey-patch the Xet progress reporter to work around a
|
| 194 |
+
# huggingface_hub/hf_xet bug where progress events are passed with an
|
| 195 |
+
# unexpected item type and close() is called without its _success arg.
|
| 196 |
+
try:
|
| 197 |
+
from huggingface_hub.utils import _xet_progress_reporting as _xpr
|
| 198 |
+
|
| 199 |
+
_xpr.XetProgressReporter.update_progress = lambda self, *args, **kwargs: None
|
| 200 |
+
_xpr.XetProgressReporter.close = lambda self, *args, **kwargs: None
|
| 201 |
+
_log("[HF-JOB] Patched XetProgressReporter to avoid progress-reporter crash")
|
| 202 |
+
except Exception as patch_exc:
|
| 203 |
+
_log(f"[HF-JOB] Could not patch XetProgressReporter: {patch_exc}")
|
| 204 |
+
|
| 205 |
from huggingface_hub import HfApi, create_repo
|
| 206 |
|
| 207 |
create_repo(repo_id, private=True, token=TOKEN, exist_ok=True)
|