promotion commited on
Commit
ffd86c1
·
verified ·
1 Parent(s): 7da570f

Upload code/run_polyedit_multiobjective_local.sh with huggingface_hub

Browse files
code/run_polyedit_multiobjective_local.sh ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ repo=/home/sjkim/POLYEDIT
5
+ run_root=$repo/project/experiments/local_runs/multiobjective_20260721
6
+ ckpt_root=/tmp/polyedit_multiobjective_ckpts_20260721
7
+ hf_root=/tmp/polyedit_multiobjective_hf_20260721
8
+ wandb_root=/tmp/polyedit_multiobjective_wandb_20260721
9
+ polybert=$hf_root/polybert
10
+ python_bin=/home/sjkim/anaconda3/envs/main/bin/python
11
+ revision=7bf9ed32ac54dea5bc163cf90100728b49341750
12
+
13
+ cleanup() {
14
+ rm -rf "$hf_root" "$wandb_root"
15
+ }
16
+ trap cleanup EXIT
17
+
18
+ if [[ -z ${WANDB_API_KEY:-} ]]; then
19
+ read -rsp "W&B API key: " WANDB_API_KEY
20
+ export WANDB_API_KEY
21
+ echo
22
+ fi
23
+ mkdir -p "$run_root/results" "$run_root/logs" "$ckpt_root" "$hf_root" "$wandb_root"
24
+ export PYTHONPATH=$repo
25
+ export HF_HOME=$hf_root/cache
26
+ export HF_HUB_CACHE=$hf_root/cache/hub
27
+ export WANDB_DIR=$wandb_root
28
+ export TOKENIZERS_PARALLELISM=false
29
+
30
+ /home/sjkim/anaconda3/envs/main/bin/hf download HAYDERphd/polyBERT \
31
+ --revision "$revision" --local-dir "$polybert"
32
+
33
+ worker() {
34
+ gpu=$1
35
+ shift
36
+ for seed in "$@"; do
37
+ result=$run_root/results/seed_${seed}.json
38
+ [[ -s $result ]] && continue
39
+ CUDA_VISIBLE_DEVICES=$gpu "$python_bin" scripts/train_polyedit_multiobjective.py \
40
+ --seed "$seed" --polybert_path "$polybert" --out "$result" \
41
+ --ckpt "$ckpt_root/seed_${seed}" --wandb 2>&1 | tee "$run_root/logs/seed_${seed}.log"
42
+ done
43
+ }
44
+
45
+ cd "$repo"
46
+ worker 0 1004 1006 1008 &
47
+ worker0=$!
48
+ worker 1 1005 1007 &
49
+ worker1=$!
50
+ wait "$worker0" "$worker1"
51
+
52
+ "$python_bin" scripts/summarize_polyedit_multiobjective.py \
53
+ --input "$run_root/results" --output "$run_root/summary.json" \
54
+ --markdown "$run_root/summary.md"