File size: 4,353 Bytes
63502da c64ecdb 63502da afa7092 63502da c64ecdb 63502da c64ecdb 63502da c64ecdb 63502da c64ecdb 63502da | 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | #!/bin/bash
# HumanEval half: Claim 4 (main table) + Claim 6 (temperature robustness).
#
# DEVIATION (forced, documented): the paper's / Dream's published HumanEval recipe
# is temperature=0.1, top_p=0.9. Under that setting Dream's OWN diffusion_generate
# emits <|endoftext|> at all 768 positions (score 0), because temperature<1 scales
# the logits up, top_p<1 then keeps only the argmax, and Dream's confidence metric
# (negative entropy) collapses to exactly 0 at 242/256 positions -> all ties.
# Claim 4 therefore keeps the paper's top_p=0.9 and changes ONLY temperature
# 0.1 -> 0, the minimal deviation that restores the signal (1 zero / 256 distinct)
# -- applied identically to BOTH arms so the comparison stays fair.
# Claim 6 sweeps temperature at the paper's OWN top_p=0.9, which is the faithful
# test of Fig. 3b and also exposes the collapse at temperature 0.1 and 0.4.
set -uo pipefail
pip install -q "transformers==4.46.2" "huggingface_hub<1.0" "datasets<4" "accelerate" 2>&1 | tail -1
python -c "
from huggingface_hub import snapshot_download
snapshot_download('ashishk1331/ccd-repro-code', repo_type='dataset', local_dir='/work')"
cd /work && mkdir -p outputs
nvidia-smi --query-gpu=name,memory.total --format=csv
# Fail fast if this GPU has no compiled kernels for our torch build (e.g. torch
# 2.5.1 on Blackwell/sm_120). Without this, every config dies one-by-one and the
# job burns wall-clock reporting the same CUDA error N times.
python - <<'EOF' || exit 1
import torch, sys
if not torch.cuda.is_available():
print("ABORT: no CUDA"); sys.exit(1)
name = torch.cuda.get_device_name(0)
cap = torch.cuda.get_device_capability(0)
try:
(torch.zeros(8, 8, device="cuda", dtype=torch.bfloat16) @
torch.zeros(8, 8, device="cuda", dtype=torch.bfloat16)).cpu()
except Exception as e:
print(f"ABORT: {name} sm_{cap[0]}{cap[1]} unusable with torch {torch.__version__}: {e}")
sys.exit(1)
print(f"GPU OK: {name} sm_{cap[0]}{cap[1]} torch {torch.__version__}")
EOF
N_HE=${N_HE:-32}
N_TEMP=${N_TEMP:-16}
python - <<'EOF'
from huggingface_hub import HfApi, snapshot_download
import glob, shutil
api = HfApi(); api.create_repo('ashishk1331/ccd-repro-results', repo_type='dataset', exist_ok=True)
try:
snapshot_download('ashishk1331/ccd-repro-results', repo_type='dataset', local_dir='/work/_prev')
n = 0
for f in glob.glob('/work/_prev/outputs/*.json'):
shutil.copy(f, '/work/outputs/'); n += 1
print(f'resumed {n} finished configs')
except Exception as e:
print('no previous results:', e)
EOF
push () {
python - <<'EOF' 2>&1 | tail -1 || true
from huggingface_hub import HfApi
HfApi().upload_folder(folder_path="outputs", path_in_repo="outputs",
repo_id="ashishk1331/ccd-repro-results", repo_type="dataset")
print("pushed")
EOF
}
run () {
out="outputs/$1"; shift
if [ -f "$out" ]; then echo "SKIP $out"; return; fi
echo "=========== RUN $out : $* ==========="
python scripts/run_eval.py "$@" --out "$out" || echo "!!!!! FAILED: $out"
push
}
########## Claim 4 — HumanEval, full 768 steps, temp 0 (signal intact)
# paper: baseline 52.66 | CCD 57.31 (+4.65) | CCD-DS 56.71 (+4.05) @ 253.2 steps (3.04x)
for m in baseline ccd ccd_ds; do
run "c4_he_${m}.json" --task humaneval --method $m --limit $N_HE --temperature 0.0 --top-p 0.9
done
# "repaired" CCD-DS at the V the reported 3.04x actually needs (V >= 12.2 at d=3)
run "c4_he_ccd_ds_V12.json" --task humaneval --method ccd_ds --limit $N_HE \
--temperature 0.0 --top-p 0.9 --buffer-V 12
########## Claim 6 — temperature robustness (reduced to 256 steps to stay in budget)
for t in 0.0 0.1 0.4 0.7 1.0; do
run "c6_he_baseline_t${t}.json" --task humaneval --method baseline --limit $N_TEMP \
--temperature $t --top-p 0.9 --steps 256
run "c6_he_ccd_ds_t${t}.json" --task humaneval --method ccd_ds --limit $N_TEMP \
--temperature $t --top-p 0.9 --steps 256
done
echo "=================== HUMANEVAL DONE ==================="
python - <<'EOF'
import json, glob
for f in sorted(glob.glob("outputs/c4_*.json")) + sorted(glob.glob("outputs/c6_*.json")):
r = json.load(open(f))
print(f"{f.split('/')[-1]:30s} score={r['score']:6.2f} steps={r['mean_steps']:7.2f} "
f"speedup={r['speedup_vs_uniform']:5.2f}x T={r['config']['temperature']} n={r['n_examples']}")
EOF
push
|