forked from baoguangsheng/fast-detect-gpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
supervised.sh
56 lines (49 loc) · 2.41 KB
/
supervised.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
#!/usr/bin/env bash
# Copyright (c) Guangsheng Bao.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# setup the environment
echo `date`, Setup the environment ...
set -e # exit if error
# prepare folders
exp_path=exp_supervised
data_path=$exp_path/data
res_path=$exp_path/results
mkdir -p $exp_path $data_path $res_path
# preparing dataset
for P in "english:mgpt" "german:mgpt" "pubmed:pubmedgpt" "xsum:gpt2-xl"; do
IFS=':' read -r -a P <<< $P && D=${P[0]} && M=${P[1]}
echo `date`, Preparing dataset ${D}-${M} ...
python scripts/data_builder.py --dataset $D --n_samples 200 --base_model_name $M --output_file $data_path/${D}_${M}
done
# evaluate baselines
for P in "english:mgpt" "german:mgpt" "pubmed:pubmedgpt" "xsum:gpt2-xl"; do
IFS=':' read -r -a P <<< $P && D=${P[0]} && M=${P[1]}
echo `date`, Evaluating baseline methods on ${D}_${M} ...
python scripts/baselines.py --scoring_model_name $M --dataset $D \
--dataset_file $data_path/${D}_${M} --output_file $res_path/${D}_${M}
done
# evaluate supervised detectors
for P in "english:mgpt" "german:mgpt" "pubmed:pubmedgpt" "xsum:gpt2-xl"; do
IFS=':' read -r -a P <<< $P && D=${P[0]} && M=${P[1]}
for SM in roberta-base-openai-detector roberta-large-openai-detector; do
echo `date`, Evaluating ${SM} on ${D}_${M} ...
python scripts/supervised.py --model_name $SM --dataset $D \
--dataset_file $data_path/${D}_${M} --output_file $res_path/${D}_${M}
done
done
# evaluate DetectGPT
for P in "english:mgpt:mt5-xl" "german:mgpt:mt5-xl" "pubmed:pubmedgpt:t5-11b" "xsum:gpt2-xl:t5-11b"; do
IFS=':' read -r -a P <<< $P && D=${P[0]} && M1=${P[1]} && M2=${P[2]}
echo `date`, Evaluating DetectGPT on ${D}_${M1}_${M2} ...
python scripts/detect_gpt.py --scoring_model_name $M1 --mask_filling_model_name $M2 --n_perturbations 100 --dataset $D \
--dataset_file $data_path/${D}_${M1} --output_file $res_path/${D}_${M1}_${M2}
done
# evaluate Fast-DetectGPT
for P in "english:mgpt" "german:mgpt" "pubmed:pubmedgpt" "xsum:gpt2-xl"; do
IFS=':' read -r -a P <<< $P && D=${P[0]} && M=${P[1]}
echo `date`, Evaluating Fast-DetectGPT on ${D}-${M} ...
python scripts/fast_detect_gpt.py --reference_model_name $M --scoring_model_name $M \
--dataset $D --dataset_file $data_path/${D}_${M} --output_file $res_path/${D}_${M}
done