Download code/train_twin_hyper_sweep_full.sh from fhyfhy/Implicit-Reasoning-checkpoints: direct link, hf CLI and curl.
- Browser
- Download file 2.24 kB
-
https://huggingface.co/fhyfhy/Implicit-Reasoning-checkpoints/resolve/main/code/train_twin_hyper_sweep_full.sh
- Command line
-
hf download hf://fhyfhy/Implicit-Reasoning-checkpoints/code/train_twin_hyper_sweep_full.sh
-
curl -L -o train_twin_hyper_sweep_full.sh https://huggingface.co/fhyfhy/Implicit-Reasoning-checkpoints/resolve/main/code/train_twin_hyper_sweep_full.sh
2.24 kB
| # Loop-scheme sweep with loss-compute-method=full. | |
| # Launches 8 configs, one per GPU: | |
| # GPU 0: ponderlm | |
| # GPU 1: ponderlm_input | |
| # GPU 2: argmax | |
| # GPU 3: vanillaloop | |
| # GPU 4: discoloop alpha=1, beta=0 | |
| # GPU 5: discoloop alpha=0.5, beta=0.5 | |
| # GPU 6: discoloop_nonorm alpha=100, beta=0 | |
| # GPU 7: discoloop_nonorm alpha=50, beta=50 | |
| # | |
| # Usage: | |
| # ./train_twin_hyper_sweep_full.sh # GPUs 0-7 | |
| # ./train_twin_hyper_sweep_full.sh --gpus 0,1,2,3,4,5,6,7 | |
| # Extra args are forwarded to every run, e.g.: | |
| # ./train_twin_hyper_sweep_full.sh --epochs 1000 --log-residual-norm 1 | |
| set -euo pipefail | |
| cd "$(dirname "${BASH_SOURCE[0]}")" | |
| LOSS_METHOD="full" | |
| GPUS="0,1,2,3,4,5,6,7" | |
| EXTRA_ARGS=() | |
| while [[ $# -gt 0 ]]; do | |
| case "$1" in | |
| --gpus) GPUS="$2"; shift 2 ;; | |
| *) EXTRA_ARGS+=("$1"); shift 1 ;; | |
| esac | |
| done | |
| # scheme fixed_alpha fixed_beta | |
| CONFIGS=( | |
| "ponderlm 0.5 0.5" | |
| "ponderlm_input 0.5 0.5" | |
| "argmax 0.5 0.5" | |
| "vanillaloop 0.5 0.5" | |
| "discoloop 1 0" | |
| "discoloop 0.5 0.5" | |
| "discoloop_nonorm 100 0" | |
| "discoloop_nonorm 50 50" | |
| ) | |
| IFS=',' read -r -a GPU_LIST <<< "$GPUS" | |
| if [[ ${#GPU_LIST[@]} -lt ${#CONFIGS[@]} ]]; then | |
| echo "Need ${#CONFIGS[@]} GPUs, got ${#GPU_LIST[@]} ($GPUS)" >&2 | |
| exit 1 | |
| fi | |
| LOG_DIR="outputs/sweep_${LOSS_METHOD}.$(date +%Y%m%d_%H%M%S)" | |
| mkdir -p "$LOG_DIR" | |
| echo "Logs: $LOG_DIR" | |
| PIDS=() | |
| LABELS=() | |
| for i in "${!CONFIGS[@]}"; do | |
| read -r SCHEME ALPHA BETA <<< "${CONFIGS[$i]}" | |
| GPU="${GPU_LIST[$i]}" | |
| LABEL="gpu${GPU}.${SCHEME}.a${ALPHA}_b${BETA}" | |
| LOG="$LOG_DIR/${LABEL}.log" | |
| echo "[launch] GPU $GPU: scheme=$SCHEME alpha=$ALPHA beta=$BETA loss=$LOSS_METHOD -> $LOG" | |
| ./train_twin_hyper.sh \ | |
| --gpu "$GPU" \ | |
| --loop-scheme "$SCHEME" \ | |
| --gate-mode fixed \ | |
| --fixed-alpha "$ALPHA" \ | |
| --fixed-beta "$BETA" \ | |
| --loss-compute-method "$LOSS_METHOD" \ | |
| "${EXTRA_ARGS[@]+"${EXTRA_ARGS[@]}"}" \ | |
| > "$LOG" 2>&1 & | |
| PIDS+=($!) | |
| LABELS+=("$LABEL") | |
| done | |
| echo "All ${#PIDS[@]} runs launched; waiting..." | |
| FAIL=0 | |
| for i in "${!PIDS[@]}"; do | |
| if wait "${PIDS[$i]}"; then | |
| echo "[done] ${LABELS[$i]}" | |
| else | |
| echo "[FAILED] ${LABELS[$i]} (see $LOG_DIR/${LABELS[$i]}.log)" >&2 | |
| FAIL=1 | |
| fi | |
| done | |
| exit "$FAIL" | |