• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2020 Huawei Technologies Co., Ltd
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14# ============================================================================
15"""
16network config setting, will be used in train.py and eval.py
17"""
18
19
20class DataConfig:
21    """
22    Define parameters of dataset.
23    """
24    data_vocab_size = 184965
25    train_num_of_parts = 21
26    test_num_of_parts = 3
27    batch_size = 16000
28    data_field_size = 39
29    # dataset format, 1: mindrecord, 2: tfrecord, 3: h5
30    data_format = 1
31
32
33class ModelConfig:
34    """
35    Define parameters of model.
36    """
37    batch_size = DataConfig.batch_size
38    data_field_size = DataConfig.data_field_size
39    data_vocab_size = DataConfig.data_vocab_size
40    data_emb_dim = 80
41    deep_layer_args = [[1024, 512, 256, 128], "relu"]
42    init_args = [-0.01, 0.01]
43    weight_bias_init = ['normal', 'normal']
44    keep_prob = 0.9
45
46
47class TrainConfig:
48    """
49    Define parameters of training.
50    """
51    batch_size = DataConfig.batch_size
52    l2_coef = 8e-5
53    learning_rate = 5e-4
54    epsilon = 5e-8
55    loss_scale = 1024.0
56    train_epochs = 3
57    save_checkpoint = True
58    ckpt_file_name_prefix = "deepfm"
59    save_checkpoint_steps = 1
60    keep_checkpoint_max = 15
61    eval_callback = True
62    loss_callback = True
63