Upload entrypoint.py with huggingface_hub
Browse files- entrypoint.py +20 -1
entrypoint.py
CHANGED
|
@@ -217,6 +217,25 @@ def _run_training_subprocess(cmd: list[str]) -> int:
|
|
| 217 |
def run_job_mode() -> int:
|
| 218 |
os.chdir(REPO_ROOT)
|
| 219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
# Dynamic live patch from GitHub to bypass Space build errors
|
| 221 |
GIT_REF = os.environ.get('FEATHER_GIT_REF')
|
| 222 |
if GIT_REF:
|
|
@@ -288,4 +307,4 @@ def main() -> int:
|
|
| 288 |
|
| 289 |
|
| 290 |
if __name__ == '__main__':
|
| 291 |
-
raise SystemExit(main())
|
|
|
|
| 217 |
def run_job_mode() -> int:
|
| 218 |
os.chdir(REPO_ROOT)
|
| 219 |
|
| 220 |
+
# Guardian: force contrastive_rank=0 and disk-patch sdr_semantic.py
|
| 221 |
+
os.environ["HYDRA_CONTRASTIVE_RANK"] = "0"
|
| 222 |
+
_sdr_path = REPO_ROOT / 'subsystems' / 'sdr_semantic.py'
|
| 223 |
+
if _sdr_path.exists():
|
| 224 |
+
_text = _sdr_path.read_text()
|
| 225 |
+
if 'retina_contrastive' not in _text:
|
| 226 |
+
print('[guardian] patching sdr_semantic.py on disk ...', flush=True)
|
| 227 |
+
_text = _text.replace(
|
| 228 |
+
'super().__init__()\n' +
|
| 229 |
+
' # Audit 2026-05-13: allow disabling',
|
| 230 |
+
'super().__init__()\n' +
|
| 231 |
+
' self.retina_contrastive = None # guardian patch\n' +
|
| 232 |
+
' # Audit 2026-05-13: allow disabling',
|
| 233 |
+
)
|
| 234 |
+
_sdr_path.write_text(_text)
|
| 235 |
+
print('[guardian] patched sdr_semantic.py on disk', flush=True)
|
| 236 |
+
print('[guardian] HYDRA_CONTRASTIVE_RANK=0 enforced for checkpoint compat', flush=True)
|
| 237 |
+
|
| 238 |
+
|
| 239 |
# Dynamic live patch from GitHub to bypass Space build errors
|
| 240 |
GIT_REF = os.environ.get('FEATHER_GIT_REF')
|
| 241 |
if GIT_REF:
|
|
|
|
| 307 |
|
| 308 |
|
| 309 |
if __name__ == '__main__':
|
| 310 |
+
raise SystemExit(main())
|