#!/usr/bin/env bash # Write the current results back to jamie33/926 under results/ (paths scrubbed; no logs, no tokens in files). # Needs HF_TOKEN in the environment. set -euo pipefail : "${HF_TOKEN:?}" MSG=${1:-"926 results: hourly write-back"} S=/tmp/926_stage rm -rf "$S"; mkdir -p "$S" cp -r /home/hubin/926/results "$S/" mkdir -p "$S/code" && cp /home/hubin/926/code/*.py /home/hubin/926/code/*.sh "$S/code/" find "$S" -name "*.log" -delete grep -rlI "/home/hubin\|/public/interns" "$S" | while read -r f; do sed -i -e 's#/home/hubin/workspace/July/brain3d_refs#$BB3D_REFS#g' -e 's#/public/interns/hubin/jmtseng/brain3d_refs#$BB3D_REFS#g' \ -e 's#/home/hubin/926#$RUN926#g' -e 's#/home/hubin/JAMIETSENG#$BB3D_REPO#g' -e 's#/home/hubin/workspace#$BB3D_WORKSPACE#g' \ -e 's#/home/hubin#~#g' "$f" done if grep -rIlE "hf_[A-Za-z0-9]{20,}" "$S"; then echo "token found, abort"; exit 1; fi python3 - "$S" "$MSG" <<'EOF' import sys from huggingface_hub import HfApi print(HfApi().upload_folder(repo_id="jamie33/926", repo_type="dataset", folder_path=sys.argv[1], commit_message=sys.argv[2])) EOF