Download source/project/scripts/run_proxy_inference_7gpu.sh from lupele/StatePlay-Reward-2280: direct link, hf CLI and curl.
- Browser
- Download file 1.74 kB
-
https://huggingface.co/datasets/lupele/StatePlay-Reward-2280/resolve/main/source/project/scripts/run_proxy_inference_7gpu.sh
- Command line
-
hf download hf://datasets/lupele/StatePlay-Reward-2280/source/project/scripts/run_proxy_inference_7gpu.sh
-
curl -L -o run_proxy_inference_7gpu.sh https://huggingface.co/datasets/lupele/StatePlay-Reward-2280/resolve/main/source/project/scripts/run_proxy_inference_7gpu.sh
1.74 kB
| set -euo pipefail | |
| ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" | |
| CHECKPOINT="" | |
| RUN_NAME="" | |
| GPUS="${CUDA_VISIBLE_DEVICES:-0,1,2,3,4,5,6}" | |
| STAGGER="${STATEPLAY_RANK_LOAD_STAGGER_SECONDS:-8}" | |
| EXTRA_ARGS=() | |
| while [[ $# -gt 0 ]]; do | |
| case "$1" in | |
| --checkpoint) CHECKPOINT="$2"; shift 2 ;; | |
| --run-name) RUN_NAME="$2"; shift 2 ;; | |
| --gpus) GPUS="$2"; shift 2 ;; | |
| --stagger-seconds) STAGGER="$2"; shift 2 ;; | |
| --) shift; EXTRA_ARGS+=("$@"); break ;; | |
| *) EXTRA_ARGS+=("$1"); shift ;; | |
| esac | |
| done | |
| if [[ -z "$CHECKPOINT" || -z "$RUN_NAME" ]]; then | |
| echo "usage: $0 --checkpoint PATH --run-name NAME [--gpus 0,1,...] [-- extra generator args]" >&2 | |
| exit 2 | |
| fi | |
| IFS=',' read -r -a GPU_LIST <<< "$GPUS" | |
| NUM_SHARDS="${#GPU_LIST[@]}" | |
| LOG_DIR="$ROOT/evaluation/proxy100/logs/$RUN_NAME" | |
| mkdir -p "$LOG_DIR" | |
| pids=() | |
| cleanup() { | |
| for pid in "${pids[@]:-}"; do kill "$pid" 2>/dev/null || true; done | |
| } | |
| trap cleanup INT TERM | |
| for shard in "${!GPU_LIST[@]}"; do | |
| gpu="${GPU_LIST[$shard]}" | |
| ( | |
| sleep "$((shard * STAGGER))" | |
| export CUDA_VISIBLE_DEVICES="$gpu" | |
| python "$ROOT/scripts/generate_proxy_benchmark.py" \ | |
| --checkpoint "$CHECKPOINT" \ | |
| --run-name "$RUN_NAME" \ | |
| --shard-index "$shard" \ | |
| --num-shards "$NUM_SHARDS" \ | |
| --skip-existing \ | |
| "${EXTRA_ARGS[@]}" | |
| ) >"$LOG_DIR/shard_${shard}.log" 2>&1 & | |
| pids+=("$!") | |
| echo "started shard=$shard gpu=$gpu pid=${pids[-1]} log=$LOG_DIR/shard_${shard}.log" | |
| done | |
| failed=0 | |
| for pid in "${pids[@]}"; do | |
| if ! wait "$pid"; then failed=1; fi | |
| done | |
| trap - INT TERM | |
| if [[ "$failed" -ne 0 ]]; then | |
| echo "one or more inference shards failed; inspect $LOG_DIR" >&2 | |
| exit 1 | |
| fi | |
| echo "all $NUM_SHARDS shards completed for $RUN_NAME" | |