Skip to content
Snippets Groups Projects
Commit c7d17fdd authored by i-robot's avatar i-robot Committed by Gitee
Browse files

!103 modify_Readme

Merge pull request !103 from 欧士博/dev
parents 1d640298 54d73e23
No related branches found
No related tags found
No related merge requests found
Showing
with 141 additions and 28 deletions
# Contents # Contents
[查看中文](./README_CN.md) [查看中文](./README_CN.md)
...@@ -588,7 +588,15 @@ epoch: 0.0, current epoch percent: 0.002, step: 200, outputs are (Tensor(shape=[ ...@@ -588,7 +588,15 @@ epoch: 0.0, current epoch percent: 0.002, step: 200, outputs are (Tensor(shape=[
#### evaluation on cola dataset when running on Ascend #### evaluation on cola dataset when running on Ascend
Before running the command below, please check the load pretrain checkpoint path has been set. Please set the checkpoint path to be the absolute full path, e.g:"/username/pretrain/checkpoint_100_300.ckpt". Before running the command below, please check the load pretrain checkpoint path has been set. Please set the checkpoint path to be the absolute full path, e.g:
--load_pretrain_checkpoint_path="/data/scripts/checkpoint_bert-20000_1.ckpt" \
--train_data_file_path="/data/tnews/train.tf_record" \
--eval_data_file_path="/data/tnews/dev.tf_record" \
--schema_file_path="/data/tnews/dataset.json"
```bash ```bash
bash scripts/run_classifier.sh bash scripts/run_classifier.sh
...@@ -604,6 +612,18 @@ acc_num XXX, total_num XXX, accuracy 0.588986 ...@@ -604,6 +612,18 @@ acc_num XXX, total_num XXX, accuracy 0.588986
#### evaluation on cluener dataset when running on Ascend #### evaluation on cluener dataset when running on Ascend
Before running the command below, please check the load pretrain checkpoint path has been set. Please set the checkpoint path to be the absolute full path, e.g:
--label_file_path="/data/cluener/label_file" \
--load_pretrain_checkpoint_path="/data/scripts/checkpoint_bert-20000_1.ckpt" \
--train_data_file_path="/data/cluener/train.tf_record" \
--eval_data_file_path="/data/cluener/dev.tf_record" \
--schema_file_path="/data/cluener/dataset.json"
```bash ```bash
bash scripts/run_ner.sh bash scripts/run_ner.sh
``` ```
...@@ -642,6 +662,16 @@ F1 0.931243 ...@@ -642,6 +662,16 @@ F1 0.931243
#### evaluation on squad v1.1 dataset when running on Ascend #### evaluation on squad v1.1 dataset when running on Ascend
Before running the command below, please check the load pretrain checkpoint path has been set. Please set the checkpoint path to be the absolute full path, e.g:
--vocab_file_path="/data/squad/vocab_bert_large_en.txt" \
--load_pretrain_checkpoint_path="/data/scripts/bert_converted.ckpt" \
--train_data_file_path="/data/squad/train.tf_record" \
--eval_json_path="/data/squad/dev-v1.1.json" \
```bash ```bash
bash scripts/squad.sh bash scripts/squad.sh
``` ```
......
# 目录
# 目录
[View English](./README.md) [View English](./README.md)
...@@ -86,13 +85,17 @@ BERT的主干结构为Transformer。对于BERT_base,Transformer包含12个编 ...@@ -86,13 +85,17 @@ BERT的主干结构为Transformer。对于BERT_base,Transformer包含12个编
- 在Ascend上运行 - 在Ascend上运行
```bash ```bash
# 单机运行预训练示例 # 单机运行预训练示例
bash scripts/run_standalone_pretrain_ascend.sh 0 1 /path/cn-wiki-128 bash scripts/run_standalone_pretrain_ascend.sh 0 1 /path/cn-wiki-128
# 分布式运行预训练示例 # 分布式运行预训练示例
bash scripts/run_distributed_pretrain_ascend.sh /path/cn-wiki-128 /path/hccl.json bash scripts/run_distributed_pretrain_ascend.sh /path/cn-wiki-128 /path/hccl.json
# 运行微调和评估示例 # 运行微调和评估示例
- 如需运行微调任务,请先准备预训练生成的权重文件(ckpt)。 - 如需运行微调任务,请先准备预训练生成的权重文件(ckpt)。
- 在`finetune_eval_config.py`中设置BERT网络配置和优化器超参。 - 在`finetune_eval_config.py`中设置BERT网络配置和优化器超参。
...@@ -115,13 +118,17 @@ bash scripts/run_distributed_pretrain_ascend.sh /path/cn-wiki-128 /path/hccl.jso ...@@ -115,13 +118,17 @@ bash scripts/run_distributed_pretrain_ascend.sh /path/cn-wiki-128 /path/hccl.jso
- 在GPU上运行 - 在GPU上运行
```bash ```bash
# 单机运行预训练示例 # 单机运行预训练示例
bash run_standalone_pretrain_for_gpu.sh 0 1 /path/cn-wiki-128 bash run_standalone_pretrain_for_gpu.sh 0 1 /path/cn-wiki-128
# 分布式运行预训练示例 # 分布式运行预训练示例
bash scripts/run_distributed_pretrain_for_gpu.sh 8 40 /path/cn-wiki-128 bash scripts/run_distributed_pretrain_for_gpu.sh 8 40 /path/cn-wiki-128
# 运行微调和评估示例 # 运行微调和评估示例
- 如需运行微调任务,请先准备预训练生成的权重文件(ckpt)。 - 如需运行微调任务,请先准备预训练生成的权重文件(ckpt)。
- 在`finetune_eval_config.py`中设置BERT网络配置和优化器超参。 - 在`finetune_eval_config.py`中设置BERT网络配置和优化器超参。
...@@ -503,7 +510,9 @@ bash scripts/run_standalone_pretrain_ascend.sh 0 1 /path/cn-wiki-128 ...@@ -503,7 +510,9 @@ bash scripts/run_standalone_pretrain_ascend.sh 0 1 /path/cn-wiki-128
以上命令后台运行,您可以在pretraining_log.txt中查看训练日志。训练结束后,您可以在默认脚本路径下脚本文件夹中找到检查点文件,得到如下损失值: 以上命令后台运行,您可以在pretraining_log.txt中查看训练日志。训练结束后,您可以在默认脚本路径下脚本文件夹中找到检查点文件,得到如下损失值:
```text ```text
# grep "epoch" pretraining_log.txt # grep "epoch" pretraining_log.txt
epoch: 0.0, current epoch percent: 0.000, step: 1, outputs are (Tensor(shape=[1], dtype=Float32, [ 1.0856101e+01]), Tensor(shape=[], dtype=Bool, False), Tensor(shape=[], dtype=Float32, 65536)) epoch: 0.0, current epoch percent: 0.000, step: 1, outputs are (Tensor(shape=[1], dtype=Float32, [ 1.0856101e+01]), Tensor(shape=[], dtype=Bool, False), Tensor(shape=[], dtype=Float32, 65536))
epoch: 0.0, current epoch percent: 0.000, step: 2, outputs are (Tensor(shape=[1], dtype=Float32, [ 1.0821701e+01]), Tensor(shape=[], dtype=Bool, False), Tensor(shape=[], dtype=Float32, 65536)) epoch: 0.0, current epoch percent: 0.000, step: 2, outputs are (Tensor(shape=[1], dtype=Float32, [ 1.0821701e+01]), Tensor(shape=[], dtype=Bool, False), Tensor(shape=[], dtype=Float32, 65536))
... ...
...@@ -533,7 +542,9 @@ bash scripts/run_distributed_pretrain_ascend.sh /path/cn-wiki-128 /path/hccl.jso ...@@ -533,7 +542,9 @@ bash scripts/run_distributed_pretrain_ascend.sh /path/cn-wiki-128 /path/hccl.jso
以上命令后台运行,您可以在pretraining_log.txt中查看训练日志。训练结束后,您可以在默认LOG*文件夹下找到检查点文件,得到如下损失值: 以上命令后台运行,您可以在pretraining_log.txt中查看训练日志。训练结束后,您可以在默认LOG*文件夹下找到检查点文件,得到如下损失值:
```text ```text
# grep "epoch" LOG*/pretraining_log.txt # grep "epoch" LOG*/pretraining_log.txt
epoch: 0.0, current epoch percent: 0.001, step: 100, outputs are (Tensor(shape=[1], dtype=Float32, [ 1.08209e+01]), Tensor(shape=[], dtype=Bool, False), Tensor(shape=[], dtype=Float32, 65536)) epoch: 0.0, current epoch percent: 0.001, step: 100, outputs are (Tensor(shape=[1], dtype=Float32, [ 1.08209e+01]), Tensor(shape=[], dtype=Bool, False), Tensor(shape=[], dtype=Float32, 65536))
epoch: 0.0, current epoch percent: 0.002, step: 200, outputs are (Tensor(shape=[1], dtype=Float32, [ 1.07566e+01]), Tensor(shape=[], dtype=Bool, False), Tensor(shape=[], dtype=Float32, 65536)) epoch: 0.0, current epoch percent: 0.002, step: 200, outputs are (Tensor(shape=[1], dtype=Float32, [ 1.07566e+01]), Tensor(shape=[], dtype=Bool, False), Tensor(shape=[], dtype=Float32, 65536))
... ...
...@@ -550,7 +561,15 @@ epoch: 0.0, current epoch percent: 0.002, step: 200, outputs are (Tensor(shape=[ ...@@ -550,7 +561,15 @@ epoch: 0.0, current epoch percent: 0.002, step: 200, outputs are (Tensor(shape=[
#### Ascend处理器上运行后评估cola数据集 #### Ascend处理器上运行后评估cola数据集
运行以下命令前,确保已设置加载与训练检查点路径。请将检查点路径设置为绝对全路径,例如,/username/pretrain/checkpoint_100_300.ckpt。 运行以下命令前,确保已设置加载与训练检查点路径。请将检查点路径设置为绝对全路径,例如,
--load_pretrain_checkpoint_path="/data/scripts/checkpoint_bert-20000_1.ckpt" \
--train_data_file_path="/data/tnews/train.tf_record" \
--eval_data_file_path="/data/tnews/dev.tf_record" \
--schema_file_path="/data/tnews/dataset.json"
```bash ```bash
bash scripts/run_classifier.sh bash scripts/run_classifier.sh
...@@ -566,6 +585,18 @@ acc_num XXX, total_num XXX, accuracy 0.588986 ...@@ -566,6 +585,18 @@ acc_num XXX, total_num XXX, accuracy 0.588986
#### Ascend处理器上运行后评估cluener数据集 #### Ascend处理器上运行后评估cluener数据集
运行以下命令前,确保已设置加载与训练检查点路径。请将检查点路径设置为绝对全路径,例如,
--label_file_path="/data/finetune/cluener/label_file" \
--load_pretrain_checkpoint_path="/data/scripts/checkpoint_bert-20000_1.ckpt" \
--train_data_file_path="/data/cluener/train.tf_record" \
--eval_data_file_path="/data/cluener/dev.tf_record" \
--schema_file_path="/data/cluener/dataset.json"
```bash ```bash
bash scripts/run_ner.sh bash scripts/run_ner.sh
``` ```
...@@ -603,6 +634,16 @@ F1 0.931243 ...@@ -603,6 +634,16 @@ F1 0.931243
#### Ascend处理器上运行后评估squad v1.1数据集 #### Ascend处理器上运行后评估squad v1.1数据集
运行以下命令前,确保已设置加载与训练检查点路径。请将检查点路径设置为绝对全路径,例如,
--vocab_file_path="/data/squad/vocab_bert_large_en.txt" \
--load_pretrain_checkpoint_path="/data/scripts/bert_converted.ckpt" \
--train_data_file_path="/data/squad/train.tf_record" \
--eval_json_path="/data/squad/dev-v1.1.json" \
```bash ```bash
bash scripts/squad.sh bash scripts/squad.sh
``` ```
...@@ -627,6 +668,7 @@ python export.py --config_path [../../*.yaml] --export_ckpt_file [CKPT_PATH] --e ...@@ -627,6 +668,7 @@ python export.py --config_path [../../*.yaml] --export_ckpt_file [CKPT_PATH] --e
- 在ModelArts上导出 - 在ModelArts上导出
```python ```python
# (1) 上传你的代码到 s3 桶上 # (1) 上传你的代码到 s3 桶上
# (2) 在ModelArts上创建训练任务 # (2) 在ModelArts上创建训练任务
# (3) 选择代码目录 /{path}/bert # (3) 选择代码目录 /{path}/bert
...@@ -650,6 +692,7 @@ python export.py --config_path [../../*.yaml] --export_ckpt_file [CKPT_PATH] --e ...@@ -650,6 +692,7 @@ python export.py --config_path [../../*.yaml] --export_ckpt_file [CKPT_PATH] --e
# (9) 在网页上的’资源池选择‘项目下, 选择单卡规格的资源 # (9) 在网页上的’资源池选择‘项目下, 选择单卡规格的资源
# (10) 创建训练作业 # (10) 创建训练作业
# 你将在{Output file path}下看到 'bert_ner.mindir'文件 # 你将在{Output file path}下看到 'bert_ner.mindir'文件
``` ```
参数`export_ckpt_file` 是必需的,`file_format` 必须在 ["AIR", "MINDIR"]中进行选择。 参数`export_ckpt_file` 是必需的,`file_format` 必须在 ["AIR", "MINDIR"]中进行选择。
...@@ -661,7 +704,9 @@ python export.py --config_path [../../*.yaml] --export_ckpt_file [CKPT_PATH] --e ...@@ -661,7 +704,9 @@ python export.py --config_path [../../*.yaml] --export_ckpt_file [CKPT_PATH] --e
在执行推理之前,需要通过export.py导出mindir文件。输入数据文件为bin格式。 在执行推理之前,需要通过export.py导出mindir文件。输入数据文件为bin格式。
```shell ```shell
# Ascend310 推理 # Ascend310 推理
bash run_infer_310.sh [MINDIR_PATH] [LABEL_PATH] [DATA_FILE_PATH] [DATASET_FORMAT] [SCHEMA_PATH] [USE_CRF] [NEED_PREPROCESS] [DEVICE_ID] bash run_infer_310.sh [MINDIR_PATH] [LABEL_PATH] [DATA_FILE_PATH] [DATASET_FORMAT] [SCHEMA_PATH] [USE_CRF] [NEED_PREPROCESS] [DEVICE_ID]
``` ```
......
# 目录
# 目录
- [目录](#目录) - [目录](#目录)
- [概述](#概述) - [概述](#概述)
...@@ -151,9 +150,13 @@ bash script/download_data.sh ...@@ -151,9 +150,13 @@ bash script/download_data.sh
```bash ```bash
bash scripts/convert_dataset.sh bash scripts/convert_dataset.sh
# `convert_dataset.sh` depend on ERNIE vocabulary, # `convert_dataset.sh` depend on ERNIE vocabulary,
# you should download ERNIE model first by: # you should download ERNIE model first by:
# sh script/download_model.sh # sh script/download_model.sh
``` ```
#### Ascend处理器或GPU上运行 #### Ascend处理器或GPU上运行
...@@ -167,16 +170,22 @@ bash script/download_model.sh ...@@ -167,16 +170,22 @@ bash script/download_model.sh
预训练模型ERNIE下载后,将其转换为MindSpore可加载权重 预训练模型ERNIE下载后,将其转换为MindSpore可加载权重
```shell ```shell
#--input_dir ./pretrain_models/ernie #--input_dir ./pretrain_models/ernie
bash script/paddle_to_midnspore.sh bash script/paddle_to_midnspore.sh
# only support x86 platform since Paddle don't support ARM # only support x86 platform since Paddle don't support ARM
``` ```
将ERNIE迁移至Mindspore后,执行训练脚本: 将ERNIE迁移至Mindspore后,执行训练脚本:
```bash ```bash
bash scripts/run_classifier_finetune_{platform}.sh bash scripts/run_classifier_finetune_{platform}.sh
# platform: gpu or ascend # platform: gpu or ascend
``` ```
模型保存在 ```./save_models``` 模型保存在 ```./save_models```
...@@ -187,11 +196,19 @@ bash scripts/run_classifier_finetune_{platform}.sh ...@@ -187,11 +196,19 @@ bash scripts/run_classifier_finetune_{platform}.sh
#### Ascend处理器或GPU上运行后评估 #### Ascend处理器或GPU上运行后评估
根据训练结果,可选择最优的step进行评估,修改```scripts/run_classifier_eval.sh``` 脚本中```load_finetune_checkpoint_path``` 参数,然后执行 根据训练结果,可选择最优的step进行评估,修改```scripts/run_classifier_eval.sh``` 脚本中参数,例如,
--load_pretrain_checkpoint_path="/data/pretrain_models/ernie.ckpt" \
--train_data_file_path="/emotect_dataset/data/train.mindrecord" \
--eval_data_file_path="/emotect_dataset/data/dev.mindrecord" \
```shell ```shell
bash scripts/run_classifier_eval_{platform}.sh bash scripts/run_classifier_eval_{platform}.sh
# platform: gpu or ascend # platform: gpu or ascend
``` ```
## 310推理 ## 310推理
...@@ -200,7 +217,9 @@ bash scripts/run_classifier_eval_{platform}.sh ...@@ -200,7 +217,9 @@ bash scripts/run_classifier_eval_{platform}.sh
```shell ```shell
bash scripts/export.sh bash scripts/export.sh
# export finetune ckpt to mindir # export finetune ckpt to mindir
``` ```
参数`ckpt_file``file_format`已在`export.sh`中设置。 参数`ckpt_file``file_format`已在`export.sh`中设置。
...@@ -210,7 +229,9 @@ bash scripts/export.sh ...@@ -210,7 +229,9 @@ bash scripts/export.sh
以下展示了使用minir模型执行推理的示例。 以下展示了使用minir模型执行推理的示例。
```shell ```shell
# Ascend310推理 # Ascend310推理
bash scripts/run_infer_310.sh [MINDIR_PATH] [DATA_FILE_PATH] [NEED_PREPROCESS] [DEVICE_ID] bash scripts/run_infer_310.sh [MINDIR_PATH] [DATA_FILE_PATH] [NEED_PREPROCESS] [DEVICE_ID]
``` ```
......
![](https://www.mindspore.cn/static/img/logo_black.6a5c850d.png) ![](https://www.mindspore.cn/static/img/logo_black.6a5c850d.png)
<!-- TOC --> <!-- TOC -->
...@@ -278,6 +278,8 @@ Parameters for both training and evaluation can be set in config.py. All the dat ...@@ -278,6 +278,8 @@ Parameters for both training and evaluation can be set in config.py. All the dat
cd ./scripts cd ./scripts
bash run_standalone_train_{platform}.sh [DATASET_PATH] bash run_standalone_train_{platform}.sh [DATASET_PATH]
# platform: ascend or gpu # platform: ascend or gpu
#example:
bash run_standalone_train_ascend.sh /Muti30k/mindrecord/multi30k_train_mindrecord_32_0
``` ```
- Running scripts for distributed training of GRU. Task training on multiple device and run the following command in bash to be executed in `scripts/`: - Running scripts for distributed training of GRU. Task training on multiple device and run the following command in bash to be executed in `scripts/`:
...@@ -297,6 +299,8 @@ Parameters for both training and evaluation can be set in config.py. All the dat ...@@ -297,6 +299,8 @@ Parameters for both training and evaluation can be set in config.py. All the dat
cd ./scripts cd ./scripts
bash run_eval_{platform}.sh [CKPT_FILE] [DATASET_PATH] bash run_eval_{platform}.sh [CKPT_FILE] [DATASET_PATH]
# platform: ascend or gpu # platform: ascend or gpu
#example:
bash run_eval_ascend.sh /data/ckpt_0/0-20_1807.ckpt /data/mindrecord/multi30k_test_mindrecord_32
``` ```
- After evalulation, we will get eval/target.txt and eval/output.txt.Then we can use scripts/parse_output.sh to get the translation. - After evalulation, we will get eval/target.txt and eval/output.txt.Then we can use scripts/parse_output.sh to get the translation.
......
nltk
numpy
\ No newline at end of file
# Contents # Contents
- [Contents](#contents) - [Contents](#contents)
- [PanGu-Alpha Description](#pangu-alpha-description) - [PanGu-Alpha Description](#pangu-alpha-description)
...@@ -137,6 +137,8 @@ Currently the scripts provide three default configures : `2.6B` `13B` and `200B` ...@@ -137,6 +137,8 @@ Currently the scripts provide three default configures : `2.6B` `13B` and `200B`
# run distributed training example # run distributed training example
bash scripts/run_distribute_train.sh DATASET RANK_TABLE RANK_SIZE TYPE MODE STAGE_NUM MICRO_SIZE PER_BATCH RANK_START bash scripts/run_distribute_train.sh DATASET RANK_TABLE RANK_SIZE TYPE MODE STAGE_NUM MICRO_SIZE PER_BATCH RANK_START
#example:
bash scripts/run_distribute_train.sh /data/pangu_30_step_ba64/ /root/hccl_8p.json 8 fp32 2.6B 1 1 8 0 8
``` ```
......
...@@ -494,6 +494,8 @@ The best acc is 0.891176 ...@@ -494,6 +494,8 @@ The best acc is 0.891176
```shell ```shell
python export.py --ckpt_file [CKPT_PATH] --file_name [FILE_NAME] --file_format [FILE_FORMAT] python export.py --ckpt_file [CKPT_PATH] --file_name [FILE_NAME] --file_format [FILE_FORMAT]
#example:
python export.py --ckpt_file ./2021-09-03_time_16_00_12/tiny_bert_936_100.ckpt --file_name SST-2 --file_format MINDIR --config_path ./td_config/td_config_sst2.yaml
``` ```
The ckpt_file parameter is required, The ckpt_file parameter is required,
......
...@@ -493,6 +493,8 @@ The best acc is 0.891176 ...@@ -493,6 +493,8 @@ The best acc is 0.891176
```shell ```shell
python export.py --ckpt_file [CKPT_PATH] --file_name [FILE_NAME] --file_format [FILE_FORMAT] python export.py --ckpt_file [CKPT_PATH] --file_name [FILE_NAME] --file_format [FILE_FORMAT]
#example:
python export.py --ckpt_file ./2021-09-03_time_16_00_12/tiny_bert_936_100.ckpt --file_name SST-2 --file_format MINDIR --config_path ./td_config/td_config_sst2.yaml
``` ```
- 在ModelArts上导出 - 在ModelArts上导出
......
...@@ -61,7 +61,7 @@ After dataset preparation, you can start training and evaluation as follows: ...@@ -61,7 +61,7 @@ After dataset preparation, you can start training and evaluation as follows:
```bash ```bash
# run training example # run training example
bash scripts/run_standalone_train_ascend.sh 0 52 /path/ende-l128-mindrecord bash scripts/run_standalone_train_ascend.sh Ascend 0 52 /path/ende-l128-mindrecord
# run distributed training example # run distributed training example
bash scripts/run_distribute_train_ascend.sh 8 52 /path/ende-l128-mindrecord rank_table.json ./default_config.yaml bash scripts/run_distribute_train_ascend.sh 8 52 /path/ende-l128-mindrecord rank_table.json ./default_config.yaml
......
...@@ -63,7 +63,7 @@ Transformer具体包括六个编码模块和六个解码模块。每个编码模 ...@@ -63,7 +63,7 @@ Transformer具体包括六个编码模块和六个解码模块。每个编码模
```bash ```bash
# 运行训练示例 # 运行训练示例
bash scripts/run_standalone_train_ascend.sh 0 52 /path/ende-l128-mindrecord bash scripts/run_standalone_train_ascend.sh Ascend 0 52 /path/ende-l128-mindrecord
# 运行分布式训练示例 # 运行分布式训练示例
bash scripts/run_distribute_train_ascend.sh 8 52 /path/ende-l128-mindrecord rank_table.json ./default_config.yaml bash scripts/run_distribute_train_ascend.sh 8 52 /path/ende-l128-mindrecord rank_table.json ./default_config.yaml
......
numpy
easydict
pyyaml
# 目录 # 目录
<!-- TOC --> <!-- TOC -->
...@@ -78,14 +78,14 @@ GPU单卡训练命令如下: ...@@ -78,14 +78,14 @@ GPU单卡训练命令如下:
#单卡训练示例 #单卡训练示例
python train.py --device_target="GPU" > output.train.log 2>&1 & python train.py --device_target="GPU" > output.train.log 2>&1 &
#或 #或
sh scripts/run_train_gpu.sh bash scripts/run_train_gpu.sh
``` ```
GPU 8卡训练命令如下: GPU 8卡训练命令如下:
```bash ```bash
#8卡训练示例 #8卡训练示例
sh scripts/run_train_multi_gpu.sh bash scripts/run_train_multi_gpu.sh
``` ```
5. 开始验证。 5. 开始验证。
...@@ -95,7 +95,7 @@ sh scripts/run_train_multi_gpu.sh ...@@ -95,7 +95,7 @@ sh scripts/run_train_multi_gpu.sh
```bash ```bash
python eval.py --ckpt_path=CHECKPOINT_PATH python eval.py --ckpt_path=CHECKPOINT_PATH
#或 #或
sh scripts/run_eval.sh CHECKPOINT_PATH bash scripts/run_eval.sh CHECKPOINT_PATH
``` ```
# 脚本说明 # 脚本说明
...@@ -164,7 +164,7 @@ sh scripts/run_eval.sh CHECKPOINT_PATH ...@@ -164,7 +164,7 @@ sh scripts/run_eval.sh CHECKPOINT_PATH
- GPU处理器环境运行 - GPU处理器环境运行
```bash ```bash
sh scripts/run_train_multi_gpu.sh bash scripts/run_train_multi_gpu.sh
``` ```
上述shell脚本将在后台运行分布训练。您可以通过output.multi_gpu.train.log文件查看结果。 上述shell脚本将在后台运行分布训练。您可以通过output.multi_gpu.train.log文件查看结果。
...@@ -186,7 +186,7 @@ sh scripts/run_eval.sh CHECKPOINT_PATH ...@@ -186,7 +186,7 @@ sh scripts/run_eval.sh CHECKPOINT_PATH
或者, 或者,
```bash ```bash
sh scripts/run_eval.sh [CHECKPOINT_PATH] bash scripts/run_eval.sh [CHECKPOINT_PATH]
``` ```
上述python命令将在后台运行,您可以通过output.eval.log文件查看结果。 上述python命令将在后台运行,您可以通过output.eval.log文件查看结果。
......
numpy
scikit-learn
\ No newline at end of file
...@@ -92,7 +92,7 @@ python train_and_eval.py --data_path=./data/mindrecord --dataset_type=mindrecord ...@@ -92,7 +92,7 @@ python train_and_eval.py --data_path=./data/mindrecord --dataset_type=mindrecord
To evaluate the model, command as follows: To evaluate the model, command as follows:
```bash ```bash
python eval.py --data_path=./data/mindrecord --dataset_type=mindrecord python eval.py --data_path=./data/mindrecord --dataset_type=mindrecord --ckpt_path=./ckpt/widedeep_train-15_2582.ckpt
``` ```
- Running on ModelArts (If you want to run in modelarts, please check the official documentation of [modelarts](https://support.huaweicloud.com/modelarts/), and you can start training as follows) - Running on ModelArts (If you want to run in modelarts, please check the official documentation of [modelarts](https://support.huaweicloud.com/modelarts/), and you can start training as follows)
......
# 目录 # 目录
- [目录](#目录) - [目录](#目录)
- [Wide&Deep概述](#widedeep概述) - [Wide&Deep概述](#widedeep概述)
...@@ -89,13 +89,13 @@ python src/preprocess_data.py --data_path=./data/ --dense_dim=13 --slot_dim=26 ...@@ -89,13 +89,13 @@ python src/preprocess_data.py --data_path=./data/ --dense_dim=13 --slot_dim=26
数据集准备就绪后,即可在Ascend上单机训练和评估模型。 数据集准备就绪后,即可在Ascend上单机训练和评估模型。
```bash ```bash
python train_and_eval.py --data_path=./data/mindrecord --data_type=mindrecord python train_and_eval.py --data_path=./data/mindrecord --dataset_type=mindrecord
``` ```
按如下操作评估模型: 按如下操作评估模型:
```bash ```bash
python eval.py --data_path=./data/mindrecord --data_type=mindrecord python eval.py --data_path=./data/mindrecord --dataset_type=mindrecord --ckpt_path=./ckpt/widedeep_train-15_2582.ckpt
``` ```
- 在ModelArts上运行(如果想在modelarts中运行,请查看【modelarts】官方文档(https://support.huaweicloud.com/modelarts/),如下开始训练即可) - 在ModelArts上运行(如果想在modelarts中运行,请查看【modelarts】官方文档(https://support.huaweicloud.com/modelarts/),如下开始训练即可)
......
...@@ -66,7 +66,7 @@ python train_and_eval.py --data_path=./data/mindrecord --data_type=mindrecord ...@@ -66,7 +66,7 @@ python train_and_eval.py --data_path=./data/mindrecord --data_type=mindrecord
To evaluate the model, command as follows: To evaluate the model, command as follows:
```bash ```bash
python eval.py --data_path=./data/mindrecord --data_type=mindrecord python eval.py --data_path=./data/mindrecord --data_type=mindrecord --ckpt_path=widedeep_train-8_455.ckpt
``` ```
## [Script Description](#contents) ## [Script Description](#contents)
......
...@@ -67,7 +67,7 @@ python train_and_eval.py --data_path=./data/mindrecord --data_type=mindrecord ...@@ -67,7 +67,7 @@ python train_and_eval.py --data_path=./data/mindrecord --data_type=mindrecord
运行如下命令评估模型: 运行如下命令评估模型:
```bash ```bash
python eval.py --data_path=./data/mindrecord --data_type=mindrecord python eval.py --data_path=./data/mindrecord --data_type=mindrecord --ckpt_path=widedeep_train-8_455.ckpt
``` ```
## 脚本说明 ## 脚本说明
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment