round-8 fix: base64 chain cmd (HF mangles embedded quote mixes)
Browse files
scripts/hf_gpu_ab_multiseed_job.py
CHANGED
|
@@ -281,11 +281,19 @@ def main() -> int:
|
|
| 281 |
rem_seeds = sorted({s for s, _ in remaining})
|
| 282 |
log(f"[AB] chaining: relaunching job for remaining seeds {rem_seeds}")
|
| 283 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 284 |
chain_cmd = (
|
| 285 |
"set -e; pip install -q huggingface-hub; "
|
| 286 |
-
"
|
| 287 |
-
"
|
| 288 |
-
"runpy.run_path(p,run_name='__main__')\""
|
| 289 |
)
|
| 290 |
new_job = api.run_job(
|
| 291 |
image=JOB_IMAGE,
|
|
|
|
| 281 |
rem_seeds = sorted({s for s, _ in remaining})
|
| 282 |
log(f"[AB] chaining: relaunching job for remaining seeds {rem_seeds}")
|
| 283 |
try:
|
| 284 |
+
# base64-wrap the inner python: HF's job command handling mangles
|
| 285 |
+
# embedded quote mixes ('...' inside \"...\"), killing the chain at
|
| 286 |
+
# bash parse time. b64 has no quotes to mangle. (round-8 pitfall)
|
| 287 |
+
import base64
|
| 288 |
+
_inner = (
|
| 289 |
+
"from huggingface_hub import hf_hub_download; import runpy; "
|
| 290 |
+
f"p=hf_hub_download('{SOURCE_REPO}','scripts/hf_gpu_ab_multiseed_job.py',repo_type='model'); "
|
| 291 |
+
"runpy.run_path(p,run_name='__main__')"
|
| 292 |
+
)
|
| 293 |
chain_cmd = (
|
| 294 |
"set -e; pip install -q huggingface-hub; "
|
| 295 |
+
f"echo {base64.b64encode(_inner.encode()).decode()} | base64 -d > /tmp/chain_job.py; "
|
| 296 |
+
"python /tmp/chain_job.py"
|
|
|
|
| 297 |
)
|
| 298 |
new_job = api.run_job(
|
| 299 |
image=JOB_IMAGE,
|