Commit fe436c6d authored by root's avatar root
Browse files

add model_3

parent 347dae81
...@@ -9,3 +9,7 @@ __pycache__ ...@@ -9,3 +9,7 @@ __pycache__
*.pyc *.pyc
*.npy *.npy
*.csv *.csv
*.onnx
*.mxr
*.trt
*.pb
\ No newline at end of file
## 文件结构
```
---models
---model_1
--- dataset
--- logs
--- mxr
--- trt
--- onnx
---model_2
--- dataset
--- logs
---model_3
--- dataset
--- logs
```
## DCU 环境配置
```
1. 拉去docker 镜像
docker pull image.sourcefind.cn:5000/dcu/admin/base/tensorflow:2.13.1-py3.10-dtk24.04.3-ubuntu20.04
2. 创建容器
# CONTAINER_NAME 容器的名字
docker run -id \
--shm-size 200g \
--network=host \
--name=$CONTAINER_NAME \
--privileged \
--device=/dev/kfd \
--device=/dev/dri \
--device=/dev/mkfd \
--ipc=host \
--group-add video \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
-v /opt/hyhal/:/opt/hyhal/ \
image.sourcefind.cn:5000/dcu/admin/base/tensorflow:2.13.1-py3.10-dtk24.04.3-ubuntu20.04 /bin/bash
3. 启动进入镜像
docker exec -it $CONTAINER_NAME /bin/bash
4. 安装 migraphx
下载 https://download.sourcefind.cn:65024/directlink/4/migraphx/DAS1.3/migraphx-4.5.0+das.opt1.dtk24043-cp310-cp310-manylinux_2_28_x86_64.run
bash migraphx-4.5.0+das.opt1.dtk24043-cp310-cp310-manylinux_2_28_x86_64.run 可以正常安装
```
## L20 环境配置
```
TF 测试镜像 docker pull nvcr.io/nvidia/tensorflow:23.10-tf2-py3
trtexec 测试镜像 docker pull nvcr.io/nvidia/tensorrt:24.09-py3
```
## 测试数据生成
- python ./utils/generate_data.py
相关参数指定见 generate_data.py 文件
## model_1 模型转换
- python ./utils/convert_pb_onnx.py
- python ./utils/convert_onnx_dynamic_to_static.py
## TF 推理
- python ./src/tf_session_infer.py
测试数据输出到对应模型的logs文件目录下
## model_1 转 mxr 和 trt 模型
- python ./src/onnx2mxr.py
- bash ./src/onnx2trt.sh
## model_1 migraphx-driver 推理
- bash ./src/migraphx-driver.sh
## model_1 trtexec 推理
- bash ./src/trtexec.sh
\ No newline at end of file
#!/bin/bash
CONTAINER_NAME="bytemlperf-TF"
image_name="image.sourcefind.cn:5000/dcu/admin/base/tensorflow:2.13.1-py3.10-dtk24.04.3-ubuntu20.04"
# 检查容器是否存在
if docker container ls -a --format '{{.Names}}' | grep -q "^$CONTAINER_NAME$"; then
con_state=`docker inspect $CONTAINER_NAME | grep -i Status | awk '{printf "%s", $2}'`
con_state=${con_state:1:-2}
echo CONTAINER state:====== $con_state ======
# if docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME" > ./null 2>&1; then
if [[ $con_state == "exited" ]]; then
docker start $CONTAINER_NAME
fi
docker exec -it $CONTAINER_NAME /bin/bash
else
docker run -id \
--shm-size 200g \
--network=host \
--name=$CONTAINER_NAME \
--privileged \
--device=/dev/kfd \
--device=/dev/dri \
--device=/dev/mkfd \
--ipc=host \
--group-add video \
--cap-add=SYS_PTRACE \
--security-opt seccomp=unconfined \
-v /opt/hyhal/:/opt/hyhal/ \
-v /datav/sunzhq/:/datav/sunzhq/ \
-v /home/workspace/:/home/workspace/ \
$image_name /bin/bash
docker exec -it $CONTAINER_NAME /bin/bash
pip config set global.index-url https://pypi.doubanio.com/simple
fi
\ No newline at end of file
2024-12-13 11:06:41,463 - INFO - *******batch_size: 1 *******QPS: 35.06600693176453
2024-12-13 11:07:14,337 - INFO - *******batch_size: 2 *******QPS: 70.24940995568168
2024-12-13 11:07:47,378 - INFO - *******batch_size: 4 *******QPS: 140.09885255114204
2024-12-13 11:08:20,723 - INFO - *******batch_size: 8 *******QPS: 279.6745328485237
2024-12-13 11:08:54,667 - INFO - *******batch_size: 16 *******QPS: 554.4031303992693
2024-12-13 11:09:30,433 - INFO - *******batch_size: 32 *******QPS: 1077.4658563095725
2024-12-13 11:10:10,854 - INFO - *******batch_size: 64 *******QPS: 1969.1841524765305
2024-12-13 11:10:56,437 - INFO - *******batch_size: 128 *******QPS: 3740.1818182147513
2024-12-13 11:11:51,457 - INFO - *******batch_size: 256 *******QPS: 6942.585605124668
2024-12-13 11:13:07,836 - INFO - *******batch_size: 512 *******QPS: 11550.409709195043
2024-12-13 11:15:10,609 - INFO - *******batch_size: 1024 *******QPS: 16354.299500589199
2024-12-13 11:18:41,208 - INFO - *******batch_size: 2048 *******QPS: 21661.6392544352
2024-12-13 11:22:50,520 - INFO - *******batch_size: 1 *******QPS: 29.761442571217025
2024-12-13 11:23:29,682 - INFO - *******batch_size: 2 *******QPS: 58.477945847937356
2024-12-13 11:24:08,840 - INFO - *******batch_size: 4 *******QPS: 117.32605878708837
2024-12-13 11:24:47,957 - INFO - *******batch_size: 8 *******QPS: 236.27178873988527
2024-12-13 11:25:27,489 - INFO - *******batch_size: 16 *******QPS: 471.83037779903117
2024-12-13 11:26:08,306 - INFO - *******batch_size: 32 *******QPS: 933.6656215236288
2024-12-13 11:26:52,095 - INFO - *******batch_size: 64 *******QPS: 1797.9257102390595
2024-12-13 11:27:42,791 - INFO - *******batch_size: 128 *******QPS: 3286.5166876860458
2024-12-13 11:28:41,913 - INFO - *******batch_size: 256 *******QPS: 6281.62742465864
2024-12-13 11:30:02,767 - INFO - *******batch_size: 512 *******QPS: 10505.042240986428
2024-12-13 11:32:09,570 - INFO - *******batch_size: 1024 *******QPS: 15360.022119172478
2024-12-13 11:35:43,382 - INFO - *******batch_size: 2048 *******QPS: 20950.014676950617
2024-12-13 11:37:06,725 - INFO - *******batch_size: 1 *******QPS: 32.524046780674546
2024-12-13 11:37:12,373 - INFO - *******batch_size: 2 *******QPS: 64.97622474753246
2024-12-13 11:37:18,081 - INFO - *******batch_size: 4 *******QPS: 129.3292778767608
2024-12-13 11:37:24,032 - INFO - *******batch_size: 8 *******QPS: 263.6599831075599
2024-12-13 11:37:30,344 - INFO - *******batch_size: 16 *******QPS: 516.6422198608145
2024-12-13 11:37:37,570 - INFO - *******batch_size: 32 *******QPS: 1007.7148174351279
2024-12-13 11:37:46,628 - INFO - *******batch_size: 64 *******QPS: 1935.5863399399686
2024-12-13 11:37:59,230 - INFO - *******batch_size: 128 *******QPS: 3491.3746343255125
2024-12-13 11:38:18,635 - INFO - *******batch_size: 256 *******QPS: 6717.253936903814
2024-12-13 11:38:51,869 - INFO - *******batch_size: 512 *******QPS: 11045.15844458297
2024-12-13 11:39:54,011 - INFO - *******batch_size: 1024 *******QPS: 15985.287379320396
2024-12-13 11:41:53,970 - INFO - *******batch_size: 2048 *******QPS: 21212.32703888748
2024-12-13 11:49:26,930 - INFO - *******batch_size: 1 *******QPS: 32.68053361557793
2024-12-13 11:49:32,271 - INFO - *******batch_size: 2 *******QPS: 69.82705239238128
2024-12-13 11:49:37,640 - INFO - *******batch_size: 4 *******QPS: 138.96209399438362
2024-12-13 11:49:43,328 - INFO - *******batch_size: 8 *******QPS: 275.0984505107506
2024-12-13 11:49:49,302 - INFO - *******batch_size: 16 *******QPS: 552.1317450932996
2024-12-13 11:49:56,228 - INFO - *******batch_size: 32 *******QPS: 1073.717343244574
2024-12-13 11:50:04,991 - INFO - *******batch_size: 64 *******QPS: 2054.1433731251914
2024-12-13 11:50:17,329 - INFO - *******batch_size: 128 *******QPS: 3721.613960586465
2024-12-13 11:50:36,465 - INFO - *******batch_size: 256 *******QPS: 7015.091914900456
2024-12-13 11:51:09,496 - INFO - *******batch_size: 512 *******QPS: 11456.927615407085
2024-12-13 11:52:11,469 - INFO - *******batch_size: 1024 *******QPS: 16361.12884648973
2024-12-13 11:54:11,548 - INFO - *******batch_size: 2048 *******QPS: 21471.40856962186
2024-12-13 11:56:16,487 - INFO - *******batch_size: 1 *******QPS: 28.448957120137806
2024-12-13 11:56:22,631 - INFO - *******batch_size: 2 *******QPS: 57.570425495453755
2024-12-13 11:56:28,761 - INFO - *******batch_size: 4 *******QPS: 116.83688591262103
2024-12-13 11:56:35,177 - INFO - *******batch_size: 8 *******QPS: 233.79212083177754
2024-12-13 11:56:41,912 - INFO - *******batch_size: 16 *******QPS: 463.97575531809497
2024-12-13 11:56:49,645 - INFO - *******batch_size: 32 *******QPS: 896.9596216319421
2024-12-13 11:56:59,165 - INFO - *******batch_size: 64 *******QPS: 1742.9214595545645
2024-12-13 11:57:12,276 - INFO - *******batch_size: 128 *******QPS: 3206.6887183008753
2024-12-13 11:57:32,150 - INFO - *******batch_size: 256 *******QPS: 6083.028168359787
2024-12-13 11:58:05,851 - INFO - *******batch_size: 512 *******QPS: 10230.784667855463
2024-12-13 11:59:49,988 - INFO - *******batch_size: 1 *******QPS: 28.40362348166074
2024-12-13 11:59:56,166 - INFO - *******batch_size: 2 *******QPS: 56.33367803983217
2024-12-13 12:00:02,368 - INFO - *******batch_size: 4 *******QPS: 113.73820821071229
2024-12-13 12:00:08,856 - INFO - *******batch_size: 8 *******QPS: 227.82224119094488
2024-12-13 12:00:15,649 - INFO - *******batch_size: 16 *******QPS: 453.33966889228617
2024-12-13 12:00:23,410 - INFO - *******batch_size: 32 *******QPS: 886.6946513345569
2024-12-13 12:00:33,005 - INFO - *******batch_size: 64 *******QPS: 1703.8528456582405
2024-12-13 12:00:46,148 - INFO - *******batch_size: 128 *******QPS: 3146.456724293685
2024-12-13 12:01:06,127 - INFO - *******batch_size: 256 *******QPS: 5944.70956682267
2024-12-13 12:01:39,811 - INFO - *******batch_size: 512 *******QPS: 10165.708935193645
2024-12-13 12:02:42,438 - INFO - *******batch_size: 1024 *******QPS: 15048.798583418999
2024-12-13 12:04:42,486 - INFO - *******batch_size: 2048 *******QPS: 20422.936782659686
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment