-
Notifications
You must be signed in to change notification settings - Fork 3
/
wikitext_bpe_load_centroids.sh
99 lines (89 loc) · 4.96 KB
/
wikitext_bpe_load_centroids.sh
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
# last_ffn_input
## eval - kmeans
python eval_lm.py data-bin/wikitext103-bpe \
--path checkpoints/wikitext103-bpe/checkpoint_best.pt \
--sample-break-mode complete --max-tokens 3072 \
--context-window 2560 --softmax-batch 1024 \
--gen-subset valid --bpe subword_nmt --remove-bpe \
--model-overrides "{'knn_keytype': 'last_ffn_input', 'use_last_ffn_input': True}" \
--load-centroids checkpoints/wikitext103-bpe/centroids.npy \
--load-centroid-distribution checkpoints/wikitext103-bpe/cluster_freq.npz
## eval - spherical kmeans
python eval_lm.py data-bin/wikitext103-bpe \
--path checkpoints/wikitext103-bpe/checkpoint_best.pt \
--sample-break-mode complete --max-tokens 3072 \
--context-window 2560 --softmax-batch 1024 \
--gen-subset valid --bpe subword_nmt --remove-bpe \
--model-overrides "{'knn_keytype': 'last_ffn_input', 'use_last_ffn_input': True}" \
--load-centroids checkpoints/wikitext103-bpe/spherical_centroids.npy \
--load-centroid-distribution checkpoints/wikitext103-bpe/spherical_cluster_freq.npz
## eval - normalized kmeans
python eval_lm.py data-bin/wikitext103-bpe \
--path checkpoints/wikitext103-bpe/checkpoint_best.pt \
--sample-break-mode complete --max-tokens 3072 \
--context-window 2560 --softmax-batch 1024 \
--gen-subset valid --bpe subword_nmt --remove-bpe \
--model-overrides "{'knn_keytype': 'last_ffn_input', 'use_last_ffn_input': True, 'norm_l2': True}" \
--load-centroids checkpoints/wikitext103-bpe/norm_centroids.npy \
--load-centroid-distribution checkpoints/wikitext103-bpe/norm_cluster_freq.npz
## eval - kmeans with idw coef
python eval_lm.py data-bin/wikitext103-bpe \
--path checkpoints/wikitext103-bpe/checkpoint_best.pt \
--sample-break-mode complete --max-tokens 3072 \
--context-window 2560 --softmax-batch 1024 \
--gen-subset valid --bpe subword_nmt --remove-bpe \
--model-overrides "{'knn_keytype': 'last_ffn_input', 'use_last_ffn_input': True}" \
--load-centroids checkpoints/wikitext103-bpe/centroids.npy \
--load-centroid-distribution checkpoints/wikitext103-bpe/cluster_freq_idw.npz
## eval - kmeans with softmax coef
python eval_lm.py data-bin/wikitext103-bpe \
--path checkpoints/wikitext103-bpe/checkpoint_best.pt \
--sample-break-mode complete --max-tokens 3072 \
--context-window 2560 --softmax-batch 1024 \
--gen-subset valid --bpe subword_nmt --remove-bpe \
--model-overrides "{'knn_keytype': 'last_ffn_input', 'use_last_ffn_input': True}" \
--load-centroids checkpoints/wikitext103-bpe/centroids.npy \
--load-centroid-distribution checkpoints/wikitext103-bpe/cluster_freq_softmax.npz
## eval - word centroid
python eval_lm.py data-bin/wikitext103-bpe \
--path checkpoints/wikitext103-bpe/checkpoint_best.pt \
--sample-break-mode complete --max-tokens 3072 \
--context-window 2560 --softmax-batch 1024 \
--gen-subset valid --bpe subword_nmt --remove-bpe \
--model-overrides "{'knn_keytype': 'last_ffn_input', 'use_last_ffn_input': True}" \
--load-centroids checkpoints/wikitext103-bpe/centroid_word.npy
# use_l2 kmeans
python eval_lm.py data-bin/wikitext103-bpe \
--path checkpoints/wikitext103-bpe/checkpoint_best.pt \
--sample-break-mode complete --max-tokens 3072 \
--context-window 2560 --softmax-batch 1024 \
--gen-subset valid --bpe subword_nmt --remove-bpe \
--model-overrides "{'knn_keytype': 'last_ffn_input', 'use_last_ffn_input': True, 'use_l2': True}" \
--load-centroids checkpoints/wikitext103-bpe/centroids.npy \
--load-centroid-distribution checkpoints/wikitext103-bpe/cluster_freq.npz
## use_l2 word centroid
python eval_lm.py data-bin/wikitext103-bpe \
--path checkpoints/wikitext103-bpe/checkpoint_best.pt \
--sample-break-mode complete --max-tokens 3072 \
--context-window 2560 --softmax-batch 1024 \
--gen-subset valid --bpe subword_nmt --remove-bpe \
--model-overrides "{'knn_keytype': 'last_ffn_input', 'use_last_ffn_input': True, 'use_l2': True}" \
--load-centroids checkpoints/wikitext103-bpe/centroid_word.npy
# last_linear_input
## eval - kmeans
python eval_lm.py data-bin/wikitext103-bpe \
--path checkpoints/wikitext103-bpe/checkpoint_best.pt \
--sample-break-mode complete --max-tokens 3072 \
--context-window 2560 --softmax-batch 1024 \
--gen-subset valid --bpe subword_nmt --remove-bpe \
--model-overrides "{'use_last_ffn_input': False}" \
--load-centroids checkpoints/wikitext103-bpe/last_linear_inp/centroids.npy \
--load-centroid-distribution checkpoints/wikitext103-bpe/last_linear_inp/cluster_freq.npz
## eval - word centroid
python eval_lm.py data-bin/wikitext103-bpe \
--path checkpoints/wikitext103-bpe/checkpoint_best.pt \
--sample-break-mode complete --max-tokens 3072 \
--context-window 2560 --softmax-batch 1024 \
--gen-subset valid --bpe subword_nmt --remove-bpe \
--model-overrides "{'use_last_ffn_input': False}" \
--load-centroids checkpoints/wikitext103-bpe/last_linear_inp/centroid_word.npy