keepsloading commited on
Commit
e35ef17
·
verified ·
1 Parent(s): f382c88

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. recipe/scripts/eval_sweep.sh +41 -18
recipe/scripts/eval_sweep.sh CHANGED
@@ -20,16 +20,25 @@ for model in "$VANILLA_MODEL" "$L2A_MODEL"; do
20
  [[ -f "$model/config.json" ]] || { echo "Missing model: $model" >&2; exit 2; }
21
  done
22
 
23
- jobs=()
24
- for benchmark in "${BENCHMARKS[@]}"; do
25
- jobs+=("vanilla|$VANILLA_MODEL|0.5|$benchmark")
26
- done
27
- for threshold in "${THRESHOLDS[@]}"; do
28
- slug="${threshold/./}"
29
- for benchmark in "${BENCHMARKS[@]}"; do
30
- jobs+=("token_t${slug}|$L2A_MODEL|$threshold|$benchmark")
31
- done
32
- done
 
 
 
 
 
 
 
 
 
33
 
34
  launch() {
35
  local gpu="$1" method="$2" model="$3" threshold="$4" benchmark="$5"
@@ -39,21 +48,35 @@ launch() {
39
  LAST_PID="$!"
40
  }
41
 
42
- for i in "${!jobs[@]}"; do
43
- slot=$((i % ${#GPUS[@]}))
 
44
  if [[ -n "${SLOT_PIDS[$slot]:-}" ]]; then
45
  wait "${SLOT_PIDS[$slot]}"
46
  fi
47
- IFS='|' read -r method model threshold benchmark <<< "${jobs[$i]}"
48
- launch "${GPUS[$slot]}" "$method" "$model" "$threshold" "$benchmark"
49
  SLOT_PIDS[$slot]="$LAST_PID"
50
  done
 
 
 
51
 
52
- status=0
53
- for pid in "${SLOT_PIDS[@]}"; do
54
- wait "$pid" || status=1
 
 
 
 
 
 
 
 
 
 
 
 
55
  done
56
- [[ "$status" == 0 ]] || exit "$status"
57
 
58
  python "$SCRIPT_DIR/summarize_qwen1p7b_router_granularity_20260714.py" \
59
  --repo "$REPO" \
 
20
  [[ -f "$model/config.json" ]] || { echo "Missing model: $model" >&2; exit 2; }
21
  done
22
 
23
+ # Upload outputs to HF Hub after each config group to survive timeouts
24
+ upload_to_hub() {
25
+ echo "=== Incremental upload to HF Hub ==="
26
+ python -c "
27
+ from huggingface_hub import HfApi
28
+ import os
29
+ api = HfApi()
30
+ if os.path.exists('/workspace/outputs'):
31
+ api.upload_folder(
32
+ folder_path='/workspace/outputs',
33
+ repo_id='keepsloading/icml_repro_scratch',
34
+ repo_type='model',
35
+ path_in_repo='outputs'
36
+ )
37
+ print('Incremental upload complete.')
38
+ else:
39
+ print('No outputs dir yet.')
40
+ " || echo "Upload failed (non-fatal), continuing..."
41
+ }
42
 
43
  launch() {
44
  local gpu="$1" method="$2" model="$3" threshold="$4" benchmark="$5"
 
48
  LAST_PID="$!"
49
  }
50
 
51
+ # Run vanilla baseline
52
+ for benchmark in "${BENCHMARKS[@]}"; do
53
+ slot=0
54
  if [[ -n "${SLOT_PIDS[$slot]:-}" ]]; then
55
  wait "${SLOT_PIDS[$slot]}"
56
  fi
57
+ launch "${GPUS[$slot]}" "vanilla" "$VANILLA_MODEL" "0.5" "$benchmark"
 
58
  SLOT_PIDS[$slot]="$LAST_PID"
59
  done
60
+ for pid in "${SLOT_PIDS[@]:-}"; do wait "$pid" || true; done
61
+ SLOT_PIDS=()
62
+ upload_to_hub
63
 
64
+ # Run each L2A threshold group
65
+ for threshold in "${THRESHOLDS[@]}"; do
66
+ slug="${threshold/./}"
67
+ method="token_t${slug}"
68
+ for benchmark in "${BENCHMARKS[@]}"; do
69
+ slot=0
70
+ if [[ -n "${SLOT_PIDS[$slot]:-}" ]]; then
71
+ wait "${SLOT_PIDS[$slot]}"
72
+ fi
73
+ launch "${GPUS[$slot]}" "$method" "$L2A_MODEL" "$threshold" "$benchmark"
74
+ SLOT_PIDS[$slot]="$LAST_PID"
75
+ done
76
+ for pid in "${SLOT_PIDS[@]:-}"; do wait "$pid" || true; done
77
+ SLOT_PIDS=()
78
+ upload_to_hub
79
  done
 
80
 
81
  python "$SCRIPT_DIR/summarize_qwen1p7b_router_granularity_20260714.py" \
82
  --repo "$REPO" \