mattbitzesty commited on
Commit
52d7c1f
·
unverified ·
1 Parent(s): 048b196

hf_train_job: monkey-patch XetProgressReporter to avoid upload crash

Browse files
Files changed (1) hide show
  1. 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
- # Uninstall hf_xet to force the legacy HTTP upload path and avoid a
194
- # progress-reporter crash on large files.
195
- subprocess.check_call(
196
- [sys.executable, "-m", "pip", "uninstall", "-y", "hf_xet"],
197
- stdout=subprocess.DEVNULL,
198
- stderr=subprocess.DEVNULL,
199
- )
200
- _log("[HF-JOB] Uninstalled hf_xet; upload will use legacy HTTP path")
 
 
 
 
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)