hf_train_job: add upload diagnostics and skip guard
Browse files- scripts/hf_train_job.py +3 -0
scripts/hf_train_job.py
CHANGED
|
@@ -130,6 +130,7 @@ if TOKEN and checkpoint_path and Path(checkpoint_path).exists():
|
|
| 130 |
create_repo(repo_id, private=True, token=TOKEN, exist_ok=True)
|
| 131 |
except Exception as exc: # noqa: BLE001
|
| 132 |
_log(f"Repo create/exists check: {exc}")
|
|
|
|
| 133 |
HfApi(token=TOKEN).upload_file(
|
| 134 |
path_or_fileobj=str(checkpoint_path),
|
| 135 |
path_in_repo="pimt_v4.pt",
|
|
@@ -137,6 +138,8 @@ if TOKEN and checkpoint_path and Path(checkpoint_path).exists():
|
|
| 137 |
repo_type="model",
|
| 138 |
)
|
| 139 |
_log(f"🤗 Checkpoint uploaded to https://huggingface.co/{repo_id}")
|
|
|
|
|
|
|
| 140 |
|
| 141 |
_upload_log()
|
| 142 |
|
|
|
|
| 130 |
create_repo(repo_id, private=True, token=TOKEN, exist_ok=True)
|
| 131 |
except Exception as exc: # noqa: BLE001
|
| 132 |
_log(f"Repo create/exists check: {exc}")
|
| 133 |
+
_log(f"[HF-JOB] Uploading {checkpoint_path} to {repo_id} as pimt_v4.pt")
|
| 134 |
HfApi(token=TOKEN).upload_file(
|
| 135 |
path_or_fileobj=str(checkpoint_path),
|
| 136 |
path_in_repo="pimt_v4.pt",
|
|
|
|
| 138 |
repo_type="model",
|
| 139 |
)
|
| 140 |
_log(f"🤗 Checkpoint uploaded to https://huggingface.co/{repo_id}")
|
| 141 |
+
else:
|
| 142 |
+
_log(f"[HF-JOB] Skipping upload: token={bool(TOKEN)} checkpoint_path={checkpoint_path} exists={Path(checkpoint_path).exists() if checkpoint_path else None}")
|
| 143 |
|
| 144 |
_upload_log()
|
| 145 |
|