update bert readme

This commit is contained in:
chenhaozhe 2021-08-12 11:09:01 +08:00
parent 976434d1a2
commit 99f0592926
3 changed files with 12 additions and 8 deletions

View File

@ -654,8 +654,10 @@ The result will be as follows:
- Export on local
We only support export with fine-tuned downstream task model and yaml config file, because the pretrained model is useless in inferences task.
```shell
python export.py --config_path [../../*.yaml] --ckpt_file [CKPT_PATH] --file_name [FILE_NAME] --file_format [FILE_FORMAT]
python export.py --config_path [../../*.yaml] --export_ckpt_file [CKPT_PATH] --export_file_name [FILE_NAME] --file_format [FILE_FORMAT]
```
- Export 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 as follows)
@ -686,8 +688,7 @@ python export.py --config_path [../../*.yaml] --ckpt_file [CKPT_PATH] --file_nam
# You will see bert_ner.mindir under {Output file path}.
```
The ckpt_file parameter is required,
`EXPORT_FORMAT` should be in ["AIR", "MINDIR"]
The `export_ckpt_file` parameter is required, and `file_format` should be in ["AIR", "MINDIR"]
### [Inference Process](#contents)
@ -799,4 +800,3 @@ Refer to the [ModelZoo FAQ](https://gitee.com/mindspore/mindspore/tree/master/mo
- **Q: Why the training process failed with error for the shape can not match?**
**A**: This is usually caused by the config `seq_length` of model can't match the dataset. You could check and modified the `seq_length` in yaml config according to the dataset you used.
The parameter of model won't change with `seq_length`, the shapes of parameter only depends on model config `max_position_embeddings`.

View File

@ -613,10 +613,12 @@ bash scripts/squad.sh
## 导出mindir模型
由于预训练模型通常没有应用场景需要经过下游任务的finetune之后才能使用所以当前仅支持使用下游任务模型和yaml配置文件进行export操作。
- 在本地导出
```shell
python export.py --config_path [../../*.yaml] --ckpt_file [CKPT_PATH] --file_name [FILE_NAME] --file_format [FILE_FORMAT]
python export.py --config_path [../../*.yaml] --export_ckpt_file [CKPT_PATH] --export_file_name [FILE_NAME] --file_format [FILE_FORMAT]
```
- 在ModelArts上导出
@ -647,7 +649,7 @@ python export.py --config_path [../../*.yaml] --ckpt_file [CKPT_PATH] --file_nam
# 你将在{Output file path}下看到 'bert_ner.mindir'文件
```
参数`ckpt_file` 是必需的,`EXPORT_FORMAT` 必须在 ["AIR", "MINDIR"]中进行选择。
参数`export_ckpt_file` 是必需的,`file_format` 必须在 ["AIR", "MINDIR"]中进行选择。
## 推理过程

View File

@ -23,7 +23,9 @@ exit 1
fi
get_real_path(){
if [ "${1:0:1}" == "/" ]; then
if [ -z "$1" ]; then
echo ""
elif [ "${1:0:1}" == "/" ]; then
echo "$1"
else
echo "$(realpath -m $PWD/$1)"