v2-zeroshot: upload retries, guard relaunch
Browse files- v2-zeroshot/src/run.sh +5 -1
v2-zeroshot/src/run.sh
CHANGED
|
@@ -14,7 +14,11 @@ HfApi().upload_folder(folder_path='$W/out', repo_id='divakantpandey/code-embed-v
|
|
| 14 |
allow_patterns=['*.json','*.log'], commit_message='v2-zeroshot: $1')" >/dev/null 2>&1 || echo "upload failed: $1"
|
| 15 |
}
|
| 16 |
fail() { note "FAILED $1"; exit 1; }
|
|
|
|
|
|
|
| 17 |
note "booted"
|
|
|
|
|
|
|
| 18 |
[ -x $W/evenv/bin/python ] || ( uv venv -q -p 3.12 $W/evenv && uv pip install -q -p $W/evenv "torch==2.6.0" "mteb==2.26.17" "sentence-transformers==6.2.0" "transformers==5.20.2" > $W/evenv.log 2>&1 ) &
|
| 19 |
EVENV=$!
|
| 20 |
if [ ! -f $M/data ]; then
|
|
@@ -34,7 +38,7 @@ if [ ! -f $M/train ]; then
|
|
| 34 |
touch $M/train; note "trained"
|
| 35 |
fi
|
| 36 |
if [ ! -f $M/upload ]; then
|
| 37 |
-
uv run --no-sync python -c "
|
| 38 |
from huggingface_hub import HfApi
|
| 39 |
api = HfApi(); r = 'divakantpandey/code-embed-v2-zeroshot'
|
| 40 |
api.create_repo(r, private=True, exist_ok=True)
|
|
|
|
| 14 |
allow_patterns=['*.json','*.log'], commit_message='v2-zeroshot: $1')" >/dev/null 2>&1 || echo "upload failed: $1"
|
| 15 |
}
|
| 16 |
fail() { note "FAILED $1"; exit 1; }
|
| 17 |
+
# Host networking on Vast can drop for minutes; a single failed Hub call must not end the run.
|
| 18 |
+
retry() { for i in 1 2 3 4 5 6; do "$@" && return 0; echo "attempt $i failed: $1" >&2; sleep 120; done; return 1; }
|
| 19 |
note "booted"
|
| 20 |
+
# The guard must start after "booted" overwrites progress.json, or it would act on a stale FAILED note.
|
| 21 |
+
pgrep -f "bash $W/guard.sh" >/dev/null || { setsid nohup bash $W/guard.sh >/dev/null 2>&1 < /dev/null & }
|
| 22 |
[ -x $W/evenv/bin/python ] || ( uv venv -q -p 3.12 $W/evenv && uv pip install -q -p $W/evenv "torch==2.6.0" "mteb==2.26.17" "sentence-transformers==6.2.0" "transformers==5.20.2" > $W/evenv.log 2>&1 ) &
|
| 23 |
EVENV=$!
|
| 24 |
if [ ! -f $M/data ]; then
|
|
|
|
| 38 |
touch $M/train; note "trained"
|
| 39 |
fi
|
| 40 |
if [ ! -f $M/upload ]; then
|
| 41 |
+
retry uv run --no-sync python -c "
|
| 42 |
from huggingface_hub import HfApi
|
| 43 |
api = HfApi(); r = 'divakantpandey/code-embed-v2-zeroshot'
|
| 44 |
api.create_repo(r, private=True, exist_ok=True)
|