Skip to content

Commit

Permalink
Add ViT model for FlagPerf (#200)
Browse files Browse the repository at this point in the history
* Add ViT model

* update the script based on zhiyuan's model

* Update script based on PR review

* Update ViT performance in README.md
  • Loading branch information
gganduu authored Sep 25, 2023
1 parent 3d4c437 commit bf17dfb
Show file tree
Hide file tree
Showing 8 changed files with 289 additions and 282 deletions.
1 change: 1 addition & 0 deletions inference/benchmarks/vit_l_16/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,5 @@ find ./val -name "*JPEG" | wc -l
| ----------- | --------- | ---- | ---- | -------- | ----------- | ---------- | ------------- | ------------ | ----------- | ----------- |
| tensorrt | fp16 | 64 |1009.7 | 777.8 | 796.7 | 825.8 | 1329.2 | 26.2% | 79.0/79.3 | 35.0/40.0 |
| tensorrt | fp32 | 32 | 1275.9 | 482.4 | 491.1 | 555.5 | 590.5 | 23.3% | 79.3/79.3 | 35.0/40.0 |
| kunlunxin_xtcl | W32A16 | 32 | 2118.307 | / | / | 130.006 | 144.914 | 27.9% | 79.3/79.3 | / |

2 changes: 1 addition & 1 deletion inference/configs/host.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ PIP_SOURCE: "https://mirror.baidu.com/pypi/simple"
CLEAR_CACHES: True
ACCE_VISIBLE_DEVICE_ENV_NAME: "CUDA_VISIBLE_DEVICES"
CASES:
"resnet50:pytorch_1.13": "/raid/dataset/ImageNet/imagenet/val"
"resnet50:pytorch_1.13": "/raid/dataset/ImageNet/imagenet/val"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
compiler: xtcl
# skip validation(will also skip create_model, export onnx). Assert exist_onnx_path != null
no_validation: true
# set a real onnx_path to use exist, or set it to anything but null to avoid export onnx manually(like torch-tensorrt)
exist_onnx_path: /home/FlagPerf/inference/onnxs/vit_l_16_bs32_pytorch_fp16False.onnx
44 changes: 21 additions & 23 deletions inference/docker_images/kunlunxin/kunlunxin_analysis.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
def analysis_log(logpath):
logfile = open(logpath)

max_usage = 0.0 ## usage_mem
max_mem = 0.0
for line in logfile.readlines():
'''
xpu_smi temp power mem w_mem use_rate
'''
if "xpu_smi" in line:
line = line[:-1]
usage = line.split(" ")[4]
usage = float(usage)
max_usage = max(max_usage, usage)
max_mem = line.split(" ")[5]
max_mem = float(max_mem)

return round(max_usage / 1024.0,
2), round(max_mem / 1024.0, 2), eval("32e12"), eval("128e12")


if __name__ == "__main__":
max1, max2, max2,max4 = analysis_log("/home/zhoujiamin01/workspace/zjm_flag/FlagPerf/inference/result/run20230809192313/resnet50:pytorch_1.13/127.0.0.1_noderank0/kunlunxin_monitor.log")
def analysis_log(logpath):
logfile = open(logpath)

max_usage = 0.0 ## usage_mem
max_mem = 0.0
for line in logfile.readlines():
'''
xpu_smi temp power mem w_mem use_rate
'''
if "xpu_smi" in line:
line = line[:-1]
usage = line.split(" ")[4]
usage = float(usage)
max_usage = max(max_usage, usage)
max_mem = line.split(" ")[5]
max_mem = float(max_mem)

return round(max_usage / 1024.0,
2), round(max_mem / 1024.0, 2), eval("32e12"), eval("128e12")


Loading

0 comments on commit bf17dfb

Please sign in to comment.