forked from lonePatient/albert_pytorch
-
Notifications
You must be signed in to change notification settings - Fork 5
/
train.sh
executable file
·83 lines (69 loc) · 1.6 KB
/
train.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
#/************************************************************************************
#***
#*** Copyright 2019 Dell(18588220928@163.com), All Rights Reserved.
#***
#*** File Author: Dell, 2019-10-18 13:36:25
#***
#************************************************************************************/
#
#! /bin/sh
usage()
{
echo "Usage: $0 [options] commands"
echo "Options:"
echo " --base Convert base model"
echo " --large Convert large model"
echo " --xlarge Convert xlarge model"
exit 1
}
base_model()
{
mkdir -p outputs/checkpoints/albert_base
OUTPUT_DIR=pretrain/pytorch/albert_base_zh
python run_classifier.py \
--arch albert_base \
--albert_config_path ${OUTPUT_DIR}/albert_config_base.json \
--bert_dir ${OUTPUT_DIR} \
--train_batch_size 24 \
--num_train_epochs 1 \
--do_train
}
large_model()
{
mkdir -p outputs/checkpoints/albert_large
OUTPUT_DIR=pretrain/pytorch/albert_large_zh
python run_classifier.py \
--arch albert_large \
--albert_config_path ${OUTPUT_DIR}/albert_config_large.json \
--bert_dir ${OUTPUT_DIR} \
--train_batch_size 24 \
--num_train_epochs 10 \
--do_train
}
xlarge_model()
{
mkdir -p outputs/checkpoints/albert_xlarge
OUTPUT_DIR=pretrain/pytorch/albert_xlarge_zh
python run_classifier.py \
--arch albert_xlarge \
--albert_config_path ${OUTPUT_DIR}/albert_config_xlarge.json \
--bert_dir ${OUTPUT_DIR} \
--train_batch_size 24 \
--num_train_epochs 10 \
--do_train
}
[ "$*" = "" ] && usage
case $1 in
--base)
base_model
;;
--large)
large_model
;;
--xlarge)
xlarge_model
;;
*)
usage
;;
esac