未验证 提交 6b94bbfe 编写于 作者: B Bin Lu 提交者: GitHub

update auto_log install command (#5482)

* update auto_log install command

* add benchmark output statement

* update benchmark=True and add benchmark declaration

* add train_type prefix of inference log

* update test_train_inference_python.md

* rm prefix of inference log

* add O2 declaration(not support now)

* reset norm train script and tipc doc
上级 adc3a3bd
......@@ -29,4 +29,4 @@ inference:deploy/inference_python/infer.py
--batch-size:1
--model-dir:./output/mobilenet_v3_small_infer/
--img-path:./images/demo.jpg
--benchmark:False
\ No newline at end of file
--benchmark:True
\ No newline at end of file
......@@ -42,16 +42,11 @@ tar -xf test_images/lite_data.tar
- 安装依赖
```
pip3 install -r requirements.txt
pip install -r requirements.txt
```
- 安装AutoLog(规范化日志输出工具)
```
git clone https://github.com/LDOUBLEV/AutoLog
cd AutoLog
pip install -r requirements.txt
python setup.py bdist_wheel
pip3 install ./dist/auto_log-1.0.0-py3-none-any.whl
cd ../
pip install https://paddleocr.bj.bcebos.com/libs/auto_log-1.2.0-py3-none-any.whl
```
### 2.3 功能测试
......@@ -76,9 +71,45 @@ bash test_tipc/test_train_inference_python.sh test_tipc/configs/mobilenet_v3_sma
输出结果如下,表示命令运行成功。
```bash
Run successfully with command - python3.7 train.py --amp_level=O1 --output-dir=./log/mobilenet_v3_small/lite_train_lite_infer/norm_train_gpus_0 --epochs=5 --batch-size=4!
Run successfully with command - python3.7 train.py --amp_level=O1 --output-dir=./log/mobilenet_v3_small/lite_train_lite_infer/amp_train_gpus_0 --epochs=5 --batch-size=4!
......
Run successfully with command - python3.7 deploy/inference_python/infer.py --use-gpu=False --model-dir=./log/mobilenet_v3_small/lite_train_lite_infer/norm_train_gpus_0,1 --batch-size=1 --benchmark=False > ./log/mobilenet_v3_small/lite_train_lite_infer/python_infer_cpu_batchsize_1.log 2>&1 !
Run successfully with command - python3.7 deploy/inference_python/infer.py --use-gpu=False --model-dir=./log/mobilenet_v3_small/lite_train_lite_infer/amp_train_gpus_0,1 --batch-size=1 --benchmark=True > ./log/mobilenet_v3_small/lite_train_lite_infer/python_infer_cpu_batchsize_1.log 2>&1 !
```
在开启benchmark选项时,可以得到测试的详细数据,包含运行环境信息(系统版本、CUDA版本、CUDNN版本、驱动版本),Paddle版本信息,参数设置信息(运行设备、线程数、是否开启内存优化等),模型信息(模型名称、精度),数据信息(batchsize、是否为动态shape等),性能信息(CPU/GPU的占用、运行耗时、预处理耗时、推理耗时、后处理耗时),内容如下所示:
```
[2022/03/03 04:21:20] root INFO: ---------------------- Env info ----------------------
[2022/03/03 04:21:20] root INFO: OS_version: Ubuntu 16.04
[2022/03/03 04:21:20] root INFO: CUDA_version: 10.2.89
[2022/03/03 04:21:20] root INFO: CUDNN_version: 7.6.5
[2022/03/03 04:21:20] root INFO: drivier_version: 440.64.00
[2022/03/03 04:21:20] root INFO: ---------------------- Paddle info ----------------------
[2022/03/03 04:21:20] root INFO: paddle_version: 2.2.2
[2022/03/03 04:21:20] root INFO: paddle_commit: b031c389938bfa15e15bb20494c76f86289d77b0
[2022/03/03 04:21:20] root INFO: log_api_version: 1.0
[2022/03/03 04:21:20] root INFO: ----------------------- Conf info -----------------------
[2022/03/03 04:21:20] root INFO: runtime_device: cpu
[2022/03/03 04:21:20] root INFO: ir_optim: True
[2022/03/03 04:21:20] root INFO: enable_memory_optim: True
[2022/03/03 04:21:20] root INFO: enable_tensorrt: False
[2022/03/03 04:21:20] root INFO: enable_mkldnn: False
[2022/03/03 04:21:20] root INFO: cpu_math_library_num_threads: 1
[2022/03/03 04:21:20] root INFO: ----------------------- Model info ----------------------
[2022/03/03 04:21:20] root INFO: model_name: classification
[2022/03/03 04:21:20] root INFO: precision: fp32
[2022/03/03 04:21:20] root INFO: ----------------------- Data info -----------------------
[2022/03/03 04:21:20] root INFO: batch_size: 1
[2022/03/03 04:21:20] root INFO: input_shape: dynamic
[2022/03/03 04:21:20] root INFO: data_num: 1
[2022/03/03 04:21:20] root INFO: ----------------------- Perf info -----------------------
[2022/03/03 04:21:20] root INFO: cpu_rss(MB): 228.7539, gpu_rss(MB): None, gpu_util: None%
[2022/03/03 04:21:20] root INFO: total time spent(s): 0.2199
[2022/03/03 04:21:20] root INFO: preprocess_time(ms): 18.5826, inference_time(ms): 201.2458, postprocess_time(ms): 0.0784
```
该信息可以在运行log中查看,以`mobilenet_v3_small`为例,log位置在`./log/mobilenet_v3_small/lite_train_lite_infer/python_infer_gpu_batchsize_1.log`
如果运行失败,也会在终端中输出运行失败的日志信息以及对应的运行命令。可以基于该命令,分析运行失败的原因。
`注意`: 混合精度参数配置文件中,默认使用O1模式;O2模式由于部分PR尚未合入,预计PaddlePaddle>=2.2.3版本才会予以接入TIPC测试。
......@@ -155,7 +155,7 @@ else
fi
for trainer in ${trainer_list[*]}; do
run_train=${trainer_py}
run_export=${norm_export}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册