google-research
76 строк · 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 = "transformer"
30config.model_class = "transformer"
31config.image_size = 256
32
33# Training info
34config.seed = 0
35config.log_every_steps = 100
36config.eval_num_steps = 1000
37config.max_length = 128
38config.batch_size = 64
39config.train_shuffle = True
40config.eval_pad_last_batch = False
41config.eval_batch_size = 64
42config.num_train_steps = 100_000
43config.checkpoint_every_steps = 5000
44config.eval_every_steps = 1000
45config.num_eval_steps = 100
46
47# Model info
48config.layout_dim = 2
49config.autoregressive = True
50config.dtype = "float32"
51config.shuffle_buffer_size = 10
52config.use_vae = False
53config.share_embeddings = True
54config.num_layers = 4
55config.qkv_dim = 512
56config.emb_dim = 512
57config.mlp_dim = 2048
58config.num_heads = 8
59config.dropout_rate = 0.3
60config.attention_dropout_rate = 0.1
61config.restore_checkpoints = True
62config.label_smoothing = 0.
63config.sampling_method = "top-p"
64config.use_vertical_info = False
65
66# Optimizer info
67config.optimizer = ml_collections.ConfigDict()
68config.optimizer.type = "adam"
69config.optimizer.warmup_steps = 4000
70config.optimizer.lr = 1e-3
71config.optimizer.beta1 = 0.9
72config.optimizer.beta2 = 0.98
73config.optimizer.weight_decay = 0.01
74config.beta_rate = 1 / 20_000
75
76return config
77