-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.py
62 lines (49 loc) · 1.64 KB
/
config.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
"""
Contains all the knobs for the whole project
"""
import torch
class Config:
def __init__(self):
"""Expirement configuration"""
self.mode = "dev"
# Device params
self.use_cuda = torch.cuda.is_available()
self.device = ('cuda' if self.use_cuda else 'cpu')
self.device = 'cpu'
self.use_cuda = False
# Global dimension params
self.embedding_dim = 100 # 200 did not help
self.hidden_size = self.embedding_dim
self.context_len = 200
self.question_len = 100
# Training params
self.num_epochs = 200
self.learning_rate = 0.1
self.batch_size = 5
self.l2_norm = 0.0 # l2 is not helping at all.
self.max_grad_norm = 50
# Encoder params
self.num_encoder_layers = 2
self.encoder_bidirectional = False
# Fusion BiLSTM params
self.num_fusion_bilstm_layers = 2
self.fusion_dropout_rate = 0.0 # Other values will cause oscillation
# Decoder params
self.max_dec_steps = 4
self.num_decoder_layers = 1
self.decoder_bidirectional = False
# HMN params
self.max_pool_size = 16
# Directories
self.data_dir = "data/"
self.vectors_cache = "data/vectors_cache"
self.experiments_root_dir = "experiments/"
# Logs
self.print_every = 10
self.save_every = 100
self.evaluate_every = 1
# Vectors
self.glove_base_url = "http://nlp.stanford.edu/data/"
self.glove_filename = "glove.6B.zip"
# Restore or run a fresh training
self.restore = False