Create configuration.py
Browse files- configuration.py +43 -0
configuration.py
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class Config(object):
|
2 |
+
def __init__(self):
|
3 |
+
|
4 |
+
# Learning Rates
|
5 |
+
self.lr_backbone = 1e-5
|
6 |
+
self.lr = 1e-4
|
7 |
+
|
8 |
+
# Epochs
|
9 |
+
self.epochs = 30
|
10 |
+
self.lr_drop = 20
|
11 |
+
self.start_epoch = 0
|
12 |
+
self.weight_decay = 1e-4
|
13 |
+
|
14 |
+
# Backbone
|
15 |
+
self.backbone = 'resnet152'
|
16 |
+
self.position_embedding = 'sine'
|
17 |
+
self.dilation = True
|
18 |
+
|
19 |
+
# Basic
|
20 |
+
self.device = 'cuda'
|
21 |
+
self.seed = 42
|
22 |
+
self.batch_size = 64
|
23 |
+
self.num_workers = 8
|
24 |
+
self.checkpoint = './checkpoint.pth'
|
25 |
+
self.clip_max_norm = 0.1
|
26 |
+
|
27 |
+
# Transformer
|
28 |
+
self.hidden_dim = 256
|
29 |
+
self.pad_token_id = 0
|
30 |
+
self.max_position_embeddings = 128
|
31 |
+
self.layer_norm_eps = 1e-12
|
32 |
+
self.dropout = 0.1
|
33 |
+
self.vocab_size = 30522
|
34 |
+
|
35 |
+
self.enc_layers = 6
|
36 |
+
self.dec_layers = 6
|
37 |
+
self.dim_feedforward = 2048
|
38 |
+
self.nheads = 8
|
39 |
+
self.pre_norm = True
|
40 |
+
|
41 |
+
# Dataset
|
42 |
+
self.dir = './coco_flickr'
|
43 |
+
self.limit = -1
|