mattbitzesty commited on
Commit
612854b
·
unverified ·
1 Parent(s): 4aa0448

fix: more aggressive Xet bypass for v5 checkpoint upload

Browse files
Files changed (1) hide show
  1. scripts/hf_train_job.py +22 -7
scripts/hf_train_job.py CHANGED
@@ -190,17 +190,32 @@ 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_v5.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
 
 
190
  repo_id = "mattbitzesty/pino-pimt-checkpoint"
191
  _log(f"[HF-JOB] Uploading {checkpoint_path} to {repo_id} as pimt_v5.pt")
192
  try:
193
+ # Monkey-patch / bypass Xet to avoid a hf_xet/huggingface_hub bug that
194
+ # crashes large-file uploads in the HF Jobs image.
 
195
  try:
196
+ import huggingface_hub
197
+
198
+ # Force the library to believe Xet is unavailable.
199
+ huggingface_hub.utils._xet_cache = None
200
+ huggingface_hub.utils._xet_initialized = False
201
+ _log("[HF-JOB] Forced Xet cache off and set _xet_initialized=False")
202
+ except Exception as patch_exc:
203
+ _log(f"[HF-JOB] Could not disable Xet: {patch_exc}")
204
 
205
+ try:
206
+ from huggingface_hub.utils import _xet_progress_reporting as _xpr
207
  _xpr.XetProgressReporter.update_progress = lambda self, *args, **kwargs: None
208
  _xpr.XetProgressReporter.close = lambda self, *args, **kwargs: None
209
+ except Exception:
210
+ pass
211
+
212
+ try:
213
+ import huggingface_hub._commit_api as _ca
214
+ _ca._upload_xet_files = lambda *args, **kwargs: None
215
+ except Exception:
216
+ pass
217
+
218
+ _log("[HF-JOB] Xet bypass complete")
219
 
220
  from huggingface_hub import HfApi, create_repo
221