updated run files
Browse files- run_multi_sup_example.sh +36 -0
- run_sup_example.sh +4 -22
- run_unsup_example.sh +1 -1
run_multi_sup_example.sh
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# In this example, we show how to train SimCSE using multiple GPU cards and PyTorch's distributed data parallel on supervised NLI dataset.
|
4 |
+
# Set how many GPUs to use
|
5 |
+
|
6 |
+
NUM_GPU=4
|
7 |
+
|
8 |
+
# Randomly set a port number
|
9 |
+
# If you encounter "address already used" error, just run again or manually set an available port id.
|
10 |
+
PORT_ID=$(expr $RANDOM + 1000)
|
11 |
+
|
12 |
+
# Allow multiple threads
|
13 |
+
export OMP_NUM_THREADS=8
|
14 |
+
|
15 |
+
# Use distributed data parallel
|
16 |
+
# If you only want to use one card, uncomment the following line and comment the line with "torch.distributed.launch"
|
17 |
+
# python train.py \
|
18 |
+
python -m torch.distributed.launch --nproc_per_node $NUM_GPU --master_port $PORT_ID train.py \
|
19 |
+
--model_name_or_path bert-base-uncased \
|
20 |
+
--train_file data/nli_for_simcse.csv \
|
21 |
+
--output_dir result/my-sup-simcse-bert-base-uncased \
|
22 |
+
--num_train_epochs 3 \
|
23 |
+
--per_device_train_batch_size 128 \
|
24 |
+
--learning_rate 5e-5 \
|
25 |
+
--max_seq_length 32 \
|
26 |
+
--evaluation_strategy steps \
|
27 |
+
--metric_for_best_model stsb_spearman \
|
28 |
+
--load_best_model_at_end \
|
29 |
+
--eval_steps 125 \
|
30 |
+
--pooler_type cls \
|
31 |
+
--overwrite_output_dir \
|
32 |
+
--temp 0.05 \
|
33 |
+
--do_train \
|
34 |
+
--do_eval \
|
35 |
+
--fp16 \
|
36 |
+
"$@"
|
run_sup_example.sh
CHANGED
@@ -1,24 +1,7 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
NUM_GPU=4
|
7 |
-
|
8 |
-
# Randomly set a port number
|
9 |
-
# If you encounter "address already used" error, just run again or manually set an available port id.
|
10 |
-
PORT_ID=$(expr $RANDOM + 1000)
|
11 |
-
|
12 |
-
# Allow multiple threads
|
13 |
-
export OMP_NUM_THREADS=8
|
14 |
-
|
15 |
-
# Use distributed data parallel
|
16 |
-
# If you only want to use one card, uncomment the following line and comment the line with "torch.distributed.launch"
|
17 |
-
# python train.py \
|
18 |
-
python -m torch.distributed.launch --nproc_per_node $NUM_GPU --master_port $PORT_ID train.py \
|
19 |
-
--model_name_or_path bert-base-uncased \
|
20 |
-
--train_file data/nli_for_simcse.csv \
|
21 |
-
--output_dir result/my-sup-simcse-bert-base-uncased \
|
22 |
--num_train_epochs 3 \
|
23 |
--per_device_train_batch_size 128 \
|
24 |
--learning_rate 5e-5 \
|
@@ -32,5 +15,4 @@ python -m torch.distributed.launch --nproc_per_node $NUM_GPU --master_port $PORT
|
|
32 |
--temp 0.05 \
|
33 |
--do_train \
|
34 |
--do_eval \
|
35 |
-
--fp16 \
|
36 |
"$@"
|
|
|
1 |
+
python ../../SimCSE/train.py \
|
2 |
+
--model_name_or_path NbAiLab/nb-bert-base \
|
3 |
+
--train_file data/mnli_no_for_simcse.csv \
|
4 |
+
--output_dir result/sup-simcse-nb-bert-base \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
--num_train_epochs 3 \
|
6 |
--per_device_train_batch_size 128 \
|
7 |
--learning_rate 5e-5 \
|
|
|
15 |
--temp 0.05 \
|
16 |
--do_train \
|
17 |
--do_eval \
|
|
|
18 |
"$@"
|
run_unsup_example.sh
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
|
7 |
python3 ../../SimCSE/train.py \
|
8 |
--model_name_or_path NbAiLab/nb-bert-base \
|
9 |
-
--train_file data/
|
10 |
--output_dir result/unsup-simcse-nb-bert-bert-base \
|
11 |
--num_train_epochs 1 \
|
12 |
--per_device_train_batch_size 64 \
|
|
|
6 |
|
7 |
python3 ../../SimCSE/train.py \
|
8 |
--model_name_or_path NbAiLab/nb-bert-base \
|
9 |
+
--train_file data/nor_news_1998_2019_sentences_1M.txt \
|
10 |
--output_dir result/unsup-simcse-nb-bert-bert-base \
|
11 |
--num_train_epochs 1 \
|
12 |
--per_device_train_batch_size 64 \
|