#!/usr/bin/env bash # Usage: run_formal_strict_task.sh TASK GPU SEED_START set -euo pipefail task="$1"; gpu="$2"; seed_start="$3" root="/workspace/RoboFactory/runs/strict640x480_v2/$task" workers="${FORMAL_WORKERS:-4}" export CUDA_VISIBLE_DEVICES="$gpu" OMP_NUM_THREADS=4 MKL_NUM_THREADS=4 audit_glob="${root}/*.h5" # Make recovery idempotent: a completed, valid corpus must be audited and # uploaded rather than needlessly recollected after a transient upload failure. if ! /workspace/venvs/robofactory-act/bin/python /workspace/act_liftbarrier/audit_strict640x480_corpus.py \ --task "$task" --data "$audit_glob" --expected-episodes 100 --output "$root/strict_audit.json"; then rm -f "$root/strict_audit.json" /bin/bash /workspace/act_liftbarrier/run_strict_task_collection.sh "$task" "$gpu" 100 "$root" "$seed_start" "$workers" /workspace/venvs/robofactory-act/bin/python /workspace/act_liftbarrier/audit_strict640x480_corpus.py \ --task "$task" --data "$audit_glob" --expected-episodes 100 --output "$root/strict_audit.json" fi token_file=/workspace/.hf_dinov3_token [[ -r "$token_file" ]] || { echo "missing Hugging Face upload credential" >&2; exit 1; } # Read the credential as data (not by sourcing the file); strip only line endings. export HF_TOKEN="$(tr -d '\r\n' < "$token_file")" /workspace/venvs/robofactory-act/bin/python /workspace/act_liftbarrier/upload_strict_task_hf.py --task "$task" --source "$root" unset HF_TOKEN