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 2.1 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 main.py
  17. """
  18. from easydict import EasyDict as edict
  19. import mindspore.common.dtype as mstype
  20. from mindspore.model_zoo.Bert_NEZHA import BertConfig
  21. bert_cfg = edict({
  22. 'epoch_size': 10,
  23. 'num_warmup_steps': 0,
  24. 'start_learning_rate': 1e-4,
  25. 'end_learning_rate': 1,
  26. 'decay_steps': 1000,
  27. 'power': 10.0,
  28. 'save_checkpoint_steps': 2000,
  29. 'keep_checkpoint_max': 10,
  30. 'checkpoint_prefix': "checkpoint_bert",
  31. 'DATA_DIR' = "/your/path/examples.tfrecord"
  32. 'SCHEMA_DIR' = "/your/path/datasetSchema.json"
  33. 'bert_config': BertConfig(
  34. batch_size=16,
  35. seq_length=128,
  36. vocab_size=21136,
  37. hidden_size=1024,
  38. num_hidden_layers=24,
  39. num_attention_heads=16,
  40. intermediate_size=4096,
  41. hidden_act="gelu",
  42. hidden_dropout_prob=0.0,
  43. attention_probs_dropout_prob=0.0,
  44. max_position_embeddings=512,
  45. type_vocab_size=2,
  46. initializer_range=0.02,
  47. use_relative_positions=True,
  48. input_mask_from_dataset=True,
  49. token_type_ids_from_dataset=True,
  50. dtype=mstype.float32,
  51. compute_type=mstype.float16,
  52. )
  53. })