google-research
77 строк · 2.2 Кб
1# coding=utf-8
2# Copyright 2024 The Google Research Authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16"""Default Hyperparameter configuration."""
17
18import ml_collections
19
20
21def get_config():
22"""Gets the default hyperparameter configuration."""
23
24config = ml_collections.ConfigDict()
25# Exp info
26config.dataset_path = "/path/to/coco"
27config.dataset = "COCO"
28config.vocab_size = 316
29config.experiment = "bert_layout"
30config.model_class = "bert_layout"
31config.image_size = 256
32
33# Training info
34config.layout_dim = 2
35config.seed = 0
36config.log_every_steps = 100
37config.eval_num_steps = 1000
38config.max_length = 128
39config.batch_size = 64
40config.train_shuffle = True
41config.eval_pad_last_batch = False
42config.eval_batch_size = 64
43config.num_train_steps = 100_000
44config.checkpoint_every_steps = 5000
45config.eval_every_steps = 1000
46config.num_eval_steps = 100
47
48# Model info
49config.num_dim = 2
50config.dtype = "float32"
51config.autoregressive = False
52config.shuffle_buffer_size = 10
53config.use_vae = True
54config.share_embeddings = True
55config.num_layers = 4
56config.qkv_dim = 512
57config.emb_dim = 512
58config.mlp_dim = 2048
59config.num_heads = 8
60config.dropout_rate = 0.1
61config.attention_dropout_rate = 0.1
62config.restore_checkpoints = True
63config.label_smoothing = 0.
64config.sampling_method = "top-p"
65config.use_vertical_info = False
66
67# Optimizer info
68config.optimizer = ml_collections.ConfigDict()
69config.optimizer.type = "adam"
70config.optimizer.warmup_steps = 4000
71config.optimizer.lr = 5e-4
72config.optimizer.beta1 = 0.9
73config.optimizer.beta2 = 0.98
74config.optimizer.weight_decay = 0.01
75config.beta_rate = 1 / 20_000
76
77return config
78