You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

config.py 1.8 kB

5 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. """
  16. network config setting, will be used in train.py and eval.py
  17. """
  18. class DataConfig:
  19. """
  20. Define parameters of dataset.
  21. """
  22. data_vocab_size = 184965
  23. train_num_of_parts = 21
  24. test_num_of_parts = 3
  25. batch_size = 1000
  26. data_field_size = 39
  27. # dataset format, 1: mindrecord, 2: tfrecord, 3: h5
  28. data_format = 2
  29. class ModelConfig:
  30. """
  31. Define parameters of model.
  32. """
  33. batch_size = DataConfig.batch_size
  34. data_field_size = DataConfig.data_field_size
  35. data_vocab_size = DataConfig.data_vocab_size
  36. data_emb_dim = 80
  37. deep_layer_args = [[400, 400, 512], "relu"]
  38. init_args = [-0.01, 0.01]
  39. weight_bias_init = ['normal', 'normal']
  40. keep_prob = 0.9
  41. class TrainConfig:
  42. """
  43. Define parameters of training.
  44. """
  45. batch_size = DataConfig.batch_size
  46. l2_coef = 1e-6
  47. learning_rate = 1e-5
  48. epsilon = 1e-8
  49. loss_scale = 1024.0
  50. train_epochs = 15
  51. save_checkpoint = True
  52. ckpt_file_name_prefix = "deepfm"
  53. save_checkpoint_steps = 1
  54. keep_checkpoint_max = 15
  55. eval_callback = True
  56. loss_callback = True