config.py 1.0 KB
Newer Older
C
caoying03 已提交
1 2
#coding=utf-8

C
caoying03 已提交
3
__all__ = ["ModelConfig", "TrainerConfig"]
C
caoying03 已提交
4 5 6


class ModelConfig(object):
W
wangmeng28 已提交
7
    vocab_size = 104810
C
caoying03 已提交
8
    embedding_dim = 300
C
caoying03 已提交
9 10 11 12 13 14 15
    embedding_droprate = 0.3

    lstm_depth = 3
    lstm_hidden_dim = 300
    lstm_hidden_droprate = 0.3

    passage_indep_embedding_dim = 300
C
caoying03 已提交
16
    passage_aligned_embedding_dim = 300
C
caoying03 已提交
17

C
caoying03 已提交
18 19 20 21
    beam_size = 32

    dict_path = "data/featurized/vocab.txt"
    pretrained_emb_path = "data/featurized/embeddings.npy"
C
caoying03 已提交
22 23 24 25


class TrainerConfig(object):
    learning_rate = 1e-3
C
caoying03 已提交
26 27 28
    l2_decay_rate = 5e-4
    gradient_clipping_threshold = 20

C
caoying03 已提交
29
    data_dir = "data/featurized"
C
caoying03 已提交
30 31
    save_dir = "models"

C
caoying03 已提交
32 33 34
    use_gpu = False
    trainer_count = 1
    train_batch_size = trainer_count * 8
C
caoying03 已提交
35 36

    epochs = 20
C
caoying03 已提交
37

38 39
    # This parameter is for debug printing.
    # If it set to 0, no information will be printed.
C
caoying03 已提交
40 41
    show_parameter_status_period = 0
    checkpoint_period = 100
42
    log_period = 5
C
caoying03 已提交
43

44 45
    # This parameter is used to resume training.
    # This path can be set to a previously trained model.
C
caoying03 已提交
46
    init_model_path = None