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.

README.md 5.5 kB

5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. # DeepFM Description
  2. This is an example of training DeepFM with Criteo dataset in MindSpore.
  3. [Paper](https://arxiv.org/pdf/1703.04247.pdf) Huifeng Guo, Ruiming Tang, Yunming Ye, Zhenguo Li, Xiuqiang He
  4. # Model architecture
  5. The overall network architecture of DeepFM is show below:
  6. [Link](https://arxiv.org/pdf/1703.04247.pdf)
  7. # Requirements
  8. - Install [MindSpore](https://www.mindspore.cn/install/en).
  9. - Download the criteo dataset for pre-training. Extract and clean text in the dataset with [WikiExtractor](https://github.com/attardi/wikiextractor). Convert the dataset to TFRecord format and move the files to a specified path.
  10. - For more information, please check the resources below:
  11. - [MindSpore tutorials](https://www.mindspore.cn/tutorial/zh-CN/master/index.html)
  12. - [MindSpore API](https://www.mindspore.cn/api/zh-CN/master/index.html)
  13. # Script description
  14. ## Script and sample code
  15. ```python
  16. ├── deepfm
  17. ├── README.md
  18. ├── scripts
  19. │ ├──run_train.sh
  20. │ ├──run_eval.sh
  21. ├── src
  22. │ ├──config.py
  23. │ ├──dataset.py
  24. │ ├──callback.py
  25. │ ├──deepfm.py
  26. ├── train.py
  27. ├── eval.py
  28. ```
  29. ## Training process
  30. ### Usage
  31. - sh run_train.sh [DEVICE_NUM] [DATASET_PATH] [MINDSPORE_HCCL_CONFIG_PAHT]
  32. - python train.py --dataset_path [DATASET_PATH]
  33. ### Launch
  34. ```
  35. # distribute training example
  36. sh scripts/run_distribute_train.sh 8 /opt/dataset/criteo /opt/mindspore_hccl_file.json
  37. # standalone training example
  38. sh scripts/run_standalone_train.sh 0 /opt/dataset/criteo
  39. or
  40. python train.py --dataset_path /opt/dataset/criteo > output.log 2>&1 &
  41. ```
  42. ### Result
  43. Training result will be stored in the example path.
  44. Checkpoints will be stored at `./checkpoint` by default,
  45. and training log will be redirected to `./output.log` by default,
  46. and loss log will be redirected to `./loss.log` by default,
  47. and eval log will be redirected to `./auc.log` by default.
  48. ## Eval process
  49. ### Usage
  50. - sh run_eval.sh [DEVICE_ID] [DATASET_PATH] [CHECKPOINT_PATH]
  51. ### Launch
  52. ```
  53. # infer example
  54. sh scripts/run_eval.sh 0 ~/criteo/eval/ ~/train/deepfm-15_41257.ckpt
  55. ```
  56. > checkpoint can be produced in training process.
  57. ### Result
  58. Inference result will be stored in the example path, you can find result like the followings in `auc.log`.
  59. ```
  60. 2020-05-27 20:51:35 AUC: 0.80577889065281, eval time: 35.55999s.
  61. ```
  62. # Model description
  63. ## Performance
  64. ### Training Performance
  65. | Parameters | DeepFM |
  66. | -------------------------- | ------------------------------------------------------|
  67. | Model Version | |
  68. | Resource | Ascend 910, cpu:2.60GHz 96cores, memory:1.5T |
  69. | uploaded Date | 05/27/2020 |
  70. | MindSpore Version | 0.2.0 |
  71. | Dataset | Criteo |
  72. | Training Parameters | src/config.py |
  73. | Optimizer | Adam |
  74. | Loss Function | SoftmaxCrossEntropyWithLogits |
  75. | outputs | |
  76. | Loss | 0.4234 |
  77. | Accuracy | AUC[0.8055] |
  78. | Total time | 91 min |
  79. | Params (M) | |
  80. | Checkpoint for Fine tuning | |
  81. | Model for inference | |
  82. #### Inference Performance
  83. | Parameters | | |
  84. | -------------------------- | ----------------------------- | ------------------------- |
  85. | Model Version | | |
  86. | Resource | Ascend 910 | Ascend 310 |
  87. | uploaded Date | 05/27/2020 | 05/27/2020 |
  88. | MindSpore Version | 0.2.0 | 0.2.0 |
  89. | Dataset | Criteo | |
  90. | batch_size | 1000 | |
  91. | outputs | | |
  92. | Accuracy | AUC[0.8055] | |
  93. | Speed | | |
  94. | Total time | 35.559s | |
  95. | Model for inference | | |
  96. # ModelZoo Homepage
  97. [Link](https://gitee.com/mindspore/mindspore/tree/master/mindspore/model_zoo)