forked from djz233/ClusterNS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_prompt.sh
53 lines (48 loc) · 1.6 KB
/
run_prompt.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
#!/bin/bash
NUM_GPU=2
export OMP_NUM_THREADS=4
export CUDA_VISIBLE_DEVICES=0,1
# template for bert, originate from PromptBERT
TEMPLATE="*cls*_This_sentence_of_\"*sent_0*\"_means*mask*.*sep+*"
TEMPLATE2="*cls*_This_sentence_:_\"*sent_0*\"_means*mask*.*sep+*"
# template for roberta, originate from PromptBERT
TEMPLATE="*cls*_This_sentence_:_'_*sent_0*_'_means*mask*.*sep+*"
TEMPLATE2="*cls*_The_sentence_:_'_*sent_0*_'_means*mask*.*sep+*"
python -m torch.distributed.launch --nproc_per_node $NUM_GPU train_prompt.py \
--model_name_or_path bert-base-uncased \
--train_file data/wiki1m_for_simcse.txt \
--output_dir result/ClusterNS-prmt-bert-base \
--num_train_epochs 1 \
--per_device_train_batch_size 256 \
--gradient_accumulation_steps 1 \
--save_steps 125 \
--save_total_limit 1 \
--learning_rate 5e-5 \
--max_seq_length 32 \
--evaluation_strategy steps \
--metric_for_best_model stsb_spearman \
--load_best_model_at_end \
--eval_steps 125 \
--mlp_only_train \
--overwrite_output_dir \
--do_train \
--kmeans 128 \
--kmean_cosine 0.4 \
--enable_hardneg \
--mask_embedding_sentence \
--mask_embedding_sentence_delta \
--mask_embedding_sentence_template $TEMPLATE\
--mask_embedding_sentence_different_template $TEMPLATE2\
--fp16 \
--bml_weight 1e-5 \
--bml_alpha 0.1 \
--bml_beta 0.3 \
--early_stop 3 \
"$@"
python evaluation_prompt.py \
--model_name_or_path result/ClusterNS-prmt-bert-base \
--pooler avg \
--task_set sts \
--mask_embedding_sentence \
--mask_embedding_sentence_template $TEMPLATE \
--mode test