File size: 1,701 Bytes
319eb16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
set -euo pipefail

# Rerender LIBERO datasets across suites using uv + rerender_libero.py
# Usage:
#   ./libero/rerender_all.sh
#
# Optional env vars:
#   UV_BIN=uv                # override uv binary
#   SUITES="a b c"           # override suites list (space-separated)
#   DEBUG_MODE=1             # pass --debug_mode to the python script

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(pwd)"

UV_BIN=${UV_BIN:-uv}
PY_SCRIPT="${PROJECT_ROOT}/dataset_upload/data_scripts/libero/rerender_libero.py"
REQS_FILE="${PROJECT_ROOT}/deps/libero/LIBERO/requirements.txt"
DATASETS_DIR="${PROJECT_ROOT}/deps/libero/LIBERO/libero/datasets"

# Default suites to process if not overridden
DEFAULT_SUITES=(
  "libero_spatial"
  "libero_object"
  "libero_goal"
  # "libero_10"
  "libero_90"
)

if [[ -n "${SUITES:-}" ]]; then
  # shellcheck disable=SC2206
  SUITES_ARR=( ${SUITES} )
else
  SUITES_ARR=( "${DEFAULT_SUITES[@]}" )
fi

DEBUG_FLAG=""
if [[ "${DEBUG_MODE:-0}" == "1" ]]; then
  DEBUG_FLAG="--debug_mode"
fi

echo "Project root: ${PROJECT_ROOT}"
echo "Datasets dir: ${DATASETS_DIR}"
echo "Suites: ${SUITES_ARR[*]}"

for SUITE in "${SUITES_ARR[@]}"; do
  RAW_DIR="${DATASETS_DIR}/${SUITE}"
  TARGET_DIR="${DATASETS_DIR}/${SUITE}_256"

  if [[ ! -d "${RAW_DIR}" ]]; then
    echo "[skip] ${SUITE}: raw data dir not found: ${RAW_DIR}" >&2
    continue
  fi

  echo "[run] ${SUITE}${TARGET_DIR}"
  "${UV_BIN}" run --with-requirements "${REQS_FILE}" \
    "${PY_SCRIPT}" \
    --libero_task_suite "${SUITE}" \
    --libero_raw_data_dir "${RAW_DIR}" \
    --libero_target_dir "${TARGET_DIR}" \
    ${DEBUG_FLAG}
done

echo "All requested suites processed."