|
4 years ago | |
---|---|---|
.. | ||
script | 4 years ago | |
src | 4 years ago | |
README.md | 4 years ago | |
eval.py | 4 years ago | |
export.py | 4 years ago | |
train.py | 4 years ago |
README.md
Contents
- NAML Description
- Dataset
- Environment Requirements
- Script Description
- Model Description
- Description of Random Situation
- ModelZoo Homepage
NAML Description
NAML is a multi-view news recommendation approach. The core of NAML is a news encoder and a user encoder. The newsencoder is composed of a title encoder, a abstract encoder, a category encoder and a subcategory encoder. In the user encoder, we learn representations of users from their browsed news. Besides, we apply additive attention to learn more informative news and user representations by selecting important words and news.
Paper Chuhan Wu, Fangzhao Wu, Mingxiao An, Jianqiang Huang, Yongfeng Huang and Xing Xie: Neural News Recommendation with Attentive Multi-View Learning, IJCAI 2019
Dataset
Dataset used: MIND
MIND contains about 160k English news articles and more than 15 million impression logs generated by 1 million users.
You can download the dataset and put the directory in structure as follows:
└─MINDlarge
├─MINDlarge_train
├─MINDlarge_dev
└─MINDlarge_utils
Environment Requirements
- Hardware(Ascend/GPU)
- Prepare hardware environment with Ascend, GPU processor. If you want to try Ascend, please send the application form to ascend@huawei.com. Once approved, you can get the resources.
- Framework
- For more information, please check the resources below:
Script description
Script and sample code
├── naml
├── README.md # descriptions about NAML
├── scripts
│ ├──run_train.sh # shell script for training
│ ├──run_eval.sh # shell script for evaluation
├── src
│ ├──option.py # parse args
│ ├──callback.py # callback file
│ ├──dataset.py # creating dataset
│ ├──naml.py # NAML architecture
│ ├──config.py # config file
│ ├──utils.py # utils to load ckpt_file for fine tune or incremental learn
├── train.py # training script
├── eval.py # evaluation script
├── export.py # export mindir script
Training process
Usage
You can start training using python or shell scripts. The usage of shell scripts as follows:
bash run_train.sh [PLATFORM] [DEVICE_ID] [DATASET] [DATASET_PATH]
bash run_eval.sh [PLATFORM] [DEVICE_ID] [DATASET] [DATASET_PATH] [CHECKPOINT_PATH]
PLATFORM
should be Ascend.DEVICE_ID
is the device id you want to run the network.DATASET
MIND dataset, support large, small and demo.DATASET_PATH
is the dataset path, the structure as Dataset.CHECKPOINT_PATH
is a pre-trained checkpoint path.
Model Export
python export.py --platform [PLATFORM] --checkpoint_path [CHECKPOINT_PATH] --file_format [EXPORT_FORMAT] --batch_size [BATCH_SIZE]
EXPORT_FORMAT
should be in ["AIR", "ONNX", "MINDIR"]
Model Description
Performance
Evaluation Performance
Parameters | Ascend |
---|---|
Model Version | NAML |
Resource | Ascend 910 ;CPU 2.60GHz,56cores;Memory,314G |
uploaded Date | 02/23/2021 (month/day/year) |
MindSpore Version | 1.2.0 |
Dataset | MINDlarge |
Training Parameters | epoch=1, steps=52869, batch_size=64, lr=0.001 |
Optimizer | Adam |
Loss Function | Softmax Cross Entropy |
outputs | probability |
Speed | 1pc: 62 ms/step |
Total time | 1pc: 54 mins |
Inference Performance
Parameters | Ascend |
---|---|
Model Version | NAML |
Resource | Ascend 910 |
Uploaded Date | 02/23/2021 (month/day/year) |
MindSpore Version | 1.2.0 |
Dataset | MINDlarge |
batch_size | 64 |
outputs | probability |
Accuracy | AUC: 0.66 |
Description of Random Situation
In train.py, we set the seed which is used by numpy.random, mindspore.common.Initializer, mindspore.ops.composite.random_ops and mindspore.nn.probability.distribution.
ModelZoo Homepage
Please check the official homepage.