-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_citation_reoccur.sh
More file actions
70 lines (64 loc) · 2.62 KB
/
Copy pathtest_citation_reoccur.sh
File metadata and controls
70 lines (64 loc) · 2.62 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
70
#!/bin/bash
export CUDA_VISIBLE_DEVICES=0
export TORCH_DISTRIBUTED_DEBUG=DETAIL
wandb offline
# Sink re-emergence experiment (research question 4) — top-2 / K=5 design.
#
# After pruning the TOP-2 detected sink tokens per sample, run an extra forward
# pass on the shortened sequence and check whether new sink tokens emerge among
# the remaining 3 graph tokens. Outputs are rank-indexed (rank 3..K by baseline
# sink score among survivors), not absolute K-position, so per-sample
# comparisons remain valid.
#
# Gate: pruning_mode=top2 AND --sink_reoccur (train_glm.py:249-256).
#
# Prerequisite: the baseline sink-records JSONL with the new
# `layer_token_scores` field must exist at
# ./analysis/{test_dataset}/global_stats/{prefix}_seed42_sink_records.jsonl
# (we explicitly pass --sink_record_path below so the lookup does not fall
# back to the older unsuffixed file which lacks the field).
#
# Outputs written to ./analysis/{test_dataset}/global_stats/:
# {prefix}_prune_top2_seed42_sink_reoccur_records.jsonl
# {prefix}_prune_top2_seed42_sink_reoccur_summary.json
# {prefix}_prune_top2_seed42_sink_reoccur_summary.md
# {prefix}_prune_top2_seed42_sink_reoccur_promotion_by_rank.png
# {prefix}_prune_top2_seed42_sink_reoccur_count_joint.png
# {prefix}_prune_top2_seed42_sink_distribution_shift.png
# Top-2 prune + greedy decoding is deterministic, so a single run is sufficient.
# We use seed=42 to match the baseline sink-records file naming.
datasets=('arxiv:700' 'cora:700' 'pubmed:850')
dataset='arxiv'
num_token=5
prefix='TEA-GLM_citation_meanpool'
llm='./vicuna-7b-v1.5'
seed=42
for pair in "${datasets[@]}"
do
IFS=':' read -r test_dataset max_text_length <<< "$pair"
echo "Sink re-emergence (top-2): seed=$seed, max_text_length=$max_text_length, dataset=$test_dataset"
accelerate launch \
--config_file accelerate_config/config_single_gpu.yaml \
train_glm.py \
--freeze_llama \
--inference \
--best_epoch 49 \
--dataset $dataset \
--test_dataset $test_dataset \
--att_d_model 2048 \
--gnn_output 4096 \
--grad_steps 1 \
--batch_size 4 \
--num_token $num_token \
--clip_grad_norm 1.0 \
--backbone $llm \
--epoch 1 \
--weight_decay 0.1 \
--max_text_length $max_text_length \
--prefix $prefix \
--prune_sink_tokens \
--pruning_mode top2 \
--sink_record_path ./analysis/${test_dataset}/global_stats/${prefix}_seed42_sink_records.jsonl \
--seed $seed \
--sink_reoccur
done