-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathargs_of_text_classifier.py
executable file
·65 lines (54 loc) · 3.01 KB
/
args_of_text_classifier.py
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
#!/usr/bin/env python
from __future__ import print_function
import argparse
import json
def get_basic_arg_parser():
parser = argparse.ArgumentParser()
parser.add_argument('--batchsize', '-b', type=int, default=64,
help='Number of images in each mini-batch')
parser.add_argument('--epoch', '-e', type=int, default=100,
help='Number of sweeps over the dataset to train')
parser.add_argument('--gpu', '-g', type=int, default=-1,
help='GPU ID (negative value indicates CPU)')
parser.add_argument('--out', '-o', default='result',
help='Directory to output the result')
parser.add_argument('--unit', '-u', type=int, default=300,
help='Number of units')
parser.add_argument('--layer', '-l', type=int, default=1,
help='Number of layers of RNN or MLP following CNN')
parser.add_argument('--dropout', '-d', type=float, default=0.4,
help='Dropout rate')
parser.add_argument('--learning-rate', '-lr', type=float, default=1e-4,
help='Learning rate')
parser.add_argument('--dataset', '-data', default='imdb.binary',
choices=['dbpedia', 'imdb.binary', 'imdb.fine',
'TREC', 'stsa.binary', 'stsa.fine',
'custrev', 'mpqa', 'rt-polarity', 'subj'],
help='Name of dataset.')
parser.add_argument('--model', '-model', default='cnn',
choices=['cnn', 'rnn', 'bow'],
help='Name of encoder model type.')
parser.add_argument('--bilm', '-bilm')
parser.add_argument('--bilm-unit', '-bilm-u', type=int, default=1024)
parser.add_argument('--bilm-layer', '-bilm-l', type=int, default=1)
parser.add_argument('--bilm-dropout', '-bilm-d', type=float, default=0.)
parser.add_argument('--bilm-ratio', '-bilm-r', type=float, default=0.25)
parser.add_argument('--bilm-temp', '-bilm-t', type=float, default=1.)
parser.add_argument('--bilm-mode', '-bilm-m', default='sampling',
choices=['weighted_sum', 'sampling'])
parser.add_argument('--bilm-gumbel', action='store_true')
parser.add_argument('--bilm-wordwise', action='store_true', default=True)
parser.add_argument('--bilm-add-original', type=float, default=0.)
parser.add_argument('--bilm-residual', type=float, default=0.,
help='if not 0, (original + context) * THIS')
parser.add_argument('--resume-vocab')
parser.add_argument('--validation', action='store_true')
parser.add_argument('--seed', type=int, default=2018)
parser.add_argument('--save-model', action='store_true')
parser.add_argument('--stop-epoch', type=int, default=10)
parser.add_argument('--no-label', action='store_true')
return parser
if __name__ == '__main__':
parser = get_basic_arg_parser()
args = parser.parse_args()
print(json.dumps(args.__dict__, indent=2))