Spaces:
Runtime error
Runtime error
deploy: sync a95ecfec from GitHub Actions
Browse filesFiles changed (3)
- assets/reward_grid.jsonlAdded+3
- assets/train.jsonlAdded+21
- validate-submission.shDeleted-185
123{"difficulty": "Easy", "task_id": 0, "variants": [{"name": "perfect", "score": 0.9773}, {"name": "no_layout", "score": 0.5222}, {"name": "no_style", "score": 0.4424}]}{"difficulty": "Medium", "task_id": 5, "variants": [{"name": "minor_diff", "score": 0.9551}, {"name": "bad_colors", "score": 0.7327}, {"name": "no_style", "score": 0.35}]}{"difficulty": "Hard", "task_id": 10, "variants": [{"name": "perfect", "score": 0.9773}, {"name": "minor_diff", "score": 0.8818}, {"name": "no_style", "score": 0.2505}]}123456789101112131415161718192021{"iter": 0, "easy": 0.629, "medium": 0.488, "hard": 0.346, "mean": 0.4877}{"iter": 1, "easy": 0.6352, "medium": 0.468, "hard": 0.3817, "mean": 0.495, "loss": -0.054}{"iter": 2, "easy": 0.6507, "medium": 0.4529, "hard": 0.2997, "mean": 0.4678, "loss": -0.215}{"iter": 3, "easy": 0.6257, "medium": 0.5345, "hard": 0.3579, "mean": 0.506, "loss": -0.077}{"iter": 4, "easy": 0.5959, "medium": 0.5994, "hard": 0.3955, "mean": 0.5303, "loss": -0.225}{"iter": 5, "easy": 0.6193, "medium": 0.6283, "hard": 0.3866, "mean": 0.5447, "loss": -0.199}{"iter": 6, "easy": 0.5911, "medium": 0.619, "hard": 0.3309, "mean": 0.5137, "loss": 0.047}{"iter": 7, "easy": 0.6375, "medium": 0.6226, "hard": 0.3676, "mean": 0.5426, "loss": -0.315}{"iter": 8, "easy": 0.5915, "medium": 0.6905, "hard": 0.3731, "mean": 0.5517, "loss": -0.052}{"iter": 9, "easy": 0.5963, "medium": 0.6501, "hard": 0.4062, "mean": 0.5509, "loss": -0.186}{"iter": 10, "easy": 0.606, "medium": 0.683, "hard": 0.388, "mean": 0.559, "loss": -0.123}{"iter": 11, "easy": 0.619, "medium": 0.6938, "hard": 0.4237, "mean": 0.5788, "loss": -0.007}{"iter": 12, "easy": 0.6716, "medium": 0.6578, "hard": 0.4017, "mean": 0.577, "loss": 0.207}{"iter": 13, "easy": 0.5916, "medium": 0.6917, "hard": 0.4882, "mean": 0.5905, "loss": -0.151}{"iter": 14, "easy": 0.614, "medium": 0.6315, "hard": 0.4238, "mean": 0.5564, "loss": 0.142}{"iter": 15, "easy": 0.6382, "medium": 0.6867, "hard": 0.4988, "mean": 0.6079, "loss": -0.012}{"iter": 16, "easy": 0.6042, "medium": 0.6624, "hard": 0.4985, "mean": 0.5884, "loss": -0.044}{"iter": 17, "easy": 0.6317, "medium": 0.6818, "hard": 0.5206, "mean": 0.6114, "loss": 0.019}{"iter": 18, "easy": 0.6474, "medium": 0.6464, "hard": 0.5409, "mean": 0.6116, "loss": -0.066}{"iter": 19, "easy": 0.6489, "medium": 0.5835, "hard": 0.533, "mean": 0.5885, "loss": 0.008}{"iter": 20, "easy": 0.634, "medium": 0.634, "hard": 0.564, "mean": 0.6107, "loss": 0.021}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185#!/usr/bin/env bash## validate-submission.sh — OpenEnv Submission Validator## Checks that your HF Space is live, Docker image builds, and openenv validate passes.## Prerequisites:# - Docker: https://docs.docker.com/get-docker/# - openenv-core: pip install openenv-core# - curl (usually pre-installed)## Run:# curl -fsSL https://raw.githubusercontent.com/<owner>/<repo>/main/scripts/validate-submission.sh | bash -s -- <ping_url> [repo_dir]## Or download and run locally:# chmod +x validate-submission.sh# ./validate-submission.sh <ping_url> [repo_dir]## Arguments:# ping_url Your HuggingFace Space URL (e.g. https://your-space.hf.space)# repo_dir Path to your repo (default: current directory)## Examples:# ./validate-submission.sh https://my-team.hf.space# ./validate-submission.sh https://my-team.hf.space ./my-repo#
set -uo pipefail
DOCKER_BUILD_TIMEOUT=600if [ -t 1 ]; then RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BOLD='\033[1m' NC='\033[0m'else RED='' GREEN='' YELLOW='' BOLD='' NC=''fi
run_with_timeout() { local secs="$1"; shift if command -v timeout &>/dev/null; then timeout "$secs" "$@" elif command -v gtimeout &>/dev/null; then gtimeout "$secs" "$@" else "$@" & local pid=$! ( sleep "$secs" && kill "$pid" 2>/dev/null ) & local watcher=$! wait "$pid" 2>/dev/null local rc=$? kill "$watcher" 2>/dev/null wait "$watcher" 2>/dev/null return $rc fi}
portable_mktemp() { local prefix="${1:-validate}" mktemp "${TMPDIR:-/tmp}/${prefix}-XXXXXX" 2>/dev/null || mktemp}
CLEANUP_FILES=()cleanup() { rm -f "${CLEANUP_FILES[@]+"${CLEANUP_FILES[@]}"}"; }trap cleanup EXIT
PING_URL="${1:-}"REPO_DIR="${2:-.}"
if [ -z "$PING_URL" ]; then printf "Usage: %s <ping_url> [repo_dir]\n" "$0" printf "\n" printf " ping_url Your HuggingFace Space URL (e.g. https://your-space.hf.space)\n" printf " repo_dir Path to your repo (default: current directory)\n" exit 1fi
if ! REPO_DIR="$(cd "$REPO_DIR" 2>/dev/null && pwd)"; then printf "Error: directory '%s' not found\n" "${2:-.}" exit 1fiPING_URL="${PING_URL%/}"export PING_URLPASS=0
log() { printf "[%s] %b\n" "$(date -u +%H:%M:%S)" "$*"; }pass() { log "${GREEN}PASSED${NC} -- $1"; PASS=$((PASS + 1)); }fail() { log "${RED}FAILED${NC} -- $1"; }hint() { printf " ${YELLOW}Hint:${NC} %b\n" "$1"; }stop_at() { printf "\n" printf "${RED}${BOLD}Validation stopped at %s.${NC} Fix the above before continuing.\n" "$1" exit 1}
printf "\n"printf "${BOLD}========================================${NC}\n"printf "${BOLD} OpenEnv Submission Validator${NC}\n"printf "${BOLD}========================================${NC}\n"log "Repo: $REPO_DIR"log "Ping URL: $PING_URL"printf "\n"
log "${BOLD}Step 1/3: Pinging HF Space${NC} ($PING_URL/reset) ..."
CURL_OUTPUT=$(portable_mktemp "validate-curl")CLEANUP_FILES+=("$CURL_OUTPUT")HTTP_CODE=$(curl -s -o "$CURL_OUTPUT" -w "%{http_code}" -X POST \ -H "Content-Type: application/json" -d '{}' \ "$PING_URL/reset" --max-time 30 2>"$CURL_OUTPUT" || printf "000")
if [ "$HTTP_CODE" = "200" ]; then pass "HF Space is live and responds to /reset"elif [ "$HTTP_CODE" = "000" ]; then fail "HF Space not reachable (connection failed or timed out)" hint "Check your network connection and that the Space is running." hint "Try: curl -s -o /dev/null -w '%%{http_code}' -X POST $PING_URL/reset" stop_at "Step 1"else fail "HF Space /reset returned HTTP $HTTP_CODE (expected 200)" hint "Make sure your Space is running and the URL is correct." hint "Try opening $PING_URL in your browser first." stop_at "Step 1"fi
log "${BOLD}Step 2/3: Running docker build${NC} ..."
if ! command -v docker &>/dev/null; then fail "docker command not found" hint "Install Docker: https://docs.docker.com/get-docker/" stop_at "Step 2"fi
if [ -f "$REPO_DIR/Dockerfile" ]; then DOCKER_CONTEXT="$REPO_DIR"elif [ -f "$REPO_DIR/server/Dockerfile" ]; then DOCKER_CONTEXT="$REPO_DIR/server"else fail "No Dockerfile found in repo root or server/ directory" stop_at "Step 2"fi
log " Found Dockerfile in $DOCKER_CONTEXT"
BUILD_OK=falseBUILD_OUTPUT=$(run_with_timeout "$DOCKER_BUILD_TIMEOUT" docker build "$DOCKER_CONTEXT" 2>&1) && BUILD_OK=true
if [ "$BUILD_OK" = true ]; then pass "Docker build succeeded"else fail "Docker build failed (timeout=${DOCKER_BUILD_TIMEOUT}s)" printf "%s\n" "$BUILD_OUTPUT" | tail -20 stop_at "Step 2"fi
log "${BOLD}Step 3/3: Running openenv validate${NC} ..."
if ! command -v openenv &>/dev/null; then fail "openenv command not found" hint "Install it: pip install openenv-core" stop_at "Step 3"fi
VALIDATE_OK=falseVALIDATE_OUTPUT=$(cd "$REPO_DIR" && openenv validate 2>&1) && VALIDATE_OK=true
if [ "$VALIDATE_OK" = true ]; then pass "openenv validate passed" [ -n "$VALIDATE_OUTPUT" ] && log " $VALIDATE_OUTPUT"else fail "openenv validate failed" printf "%s\n" "$VALIDATE_OUTPUT" stop_at "Step 3"fi
printf "\n"printf "${BOLD}========================================${NC}\n"printf "${GREEN}${BOLD} All 3/3 checks passed!${NC}\n"printf "${GREEN}${BOLD} Your submission is ready to submit.${NC}\n"printf "${BOLD}========================================${NC}\n"printf "\n"
exit 0assets/reward_grid.jsonlAdded+3
assets/train.jsonlAdded+21
validate-submission.shDeleted-185