-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_benchmark.sh
More file actions
executable file
·69 lines (57 loc) · 1.65 KB
/
Copy pathrun_benchmark.sh
File metadata and controls
executable file
·69 lines (57 loc) · 1.65 KB
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
68
69
#!/usr/bin/env bash
set -euo pipefail
# HuggingFace /tmp, /home
export HF_HOME="./hf_cache"
export HF_HUB_CACHE="./hf_cache/hub"
export TRANSFORMERS_CACHE="./hf_cache/hub"
mkdir -p "$HF_HUB_CACHE"
# GPU
export CUDA_VISIBLE_DEVICES="${CUDA_VISIBLE_DEVICES:-0}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
if [[ -f ../dflash_venv/bin/activate ]]; then
# shellcheck disable=SC1091
source ../dflash_venv/bin/activate
fi
OUTPUT_DIR="output"
SEED=0
mkdir -p logs "${OUTPUT_DIR}/_hidden_states"
# : dataset:max_samples
TASKS=(
"gsm8k:8"
"math500:8"
"aime24:8"
"aime25:8"
"humaneval:8"
"mbpp:8"
"livecodebench:8"
"swe-bench:8"
"mt-bench:8"
"alpaca:8"
)
BLOCK_SIZES=(4 8)
for task in "${TASKS[@]}"; do
IFS=':' read -r DATASET_NAME MAX_SAMPLES <<< "$task"
echo "========================================================"
echo "Running Benchmark: $DATASET_NAME with $MAX_SAMPLES samples"
echo "========================================================"
for BLOCK_SIZE in "${BLOCK_SIZES[@]}"; do
LOG_FILE="logs/${DATASET_NAME}_bs${BLOCK_SIZE}.log"
echo "[run] dataset=${DATASET_NAME} block_size=${BLOCK_SIZE} log=${LOG_FILE}"
torchrun \
--nproc_per_node=1 \
--master_port=29606 \
benchmark.py \
--dataset "$DATASET_NAME" \
--max-samples "$MAX_SAMPLES" \
--model-name-or-path Qwen/Qwen3-4B \
--draft-name-or-path z-lab/Qwen3-4B-DFlash-b16 \
--max-new-tokens 2048 \
--temperature 0.0 \
--seed "$SEED" \
--block-size "$BLOCK_SIZE" \
--dir "$OUTPUT_DIR" \
2>&1 | tee "$LOG_FILE"
done
done
echo "Done. Results saved under ${OUTPUT_DIR}/"