Skip to content

Commit 2fe6454

Browse files
authored
paddlemix add deploy benchmark (#633) (#636)
1 parent 4e3d523 commit 2fe6454

File tree

4 files changed

+61
-0
lines changed

4 files changed

+61
-0
lines changed

deploy/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,17 @@ python export.py \
7474
--prompt "bus"
7575

7676
```
77+
78+
## 3. 推理 BenchMark
79+
80+
> Note:
81+
> 测试环境为Paddle 3.0,A100 80G单卡。
82+
83+
# A100性能数据
84+
|模型|Paddle Deploy |
85+
|-|-|
86+
|qwen-vl-7b|669.8 ms|
87+
|llava-1.5-7b|981.2 ms|
88+
|llava-1.6-7b|778.7 ms|
89+
|groundingDino/groundingdino-swint-ogc|100 ms|
90+
|Sam/SamVitH-1024|121 ms|

deploy/README_en.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,16 @@ Will be exported to the following directory, including `model_state.pdiparams`,
7474

7575
```
7676

77+
## 3. BenchMark
78+
79+
> Note:
80+
> Paddle 3.0,A100 80G。
81+
82+
83+
|Model|Paddle Deploy |
84+
|-|-|
85+
|qwen-vl-7b|669.8 ms|
86+
|llava-1.5-7b|981.2 ms|
87+
|llava-1.6-7b|778.7 ms|
88+
|groundingDino/groundingdino-swint-ogc|100 ms|
89+
|Sam/SamVitH-1024|121 ms|

deploy/groundingdino/predict.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,19 @@ def main(model_args, data_args):
229229
image_pil = Image.open(data_args.input_image).convert("RGB")
230230
else:
231231
image_pil = Image.open(requests.get(url, stream=True).raw).convert("RGB")
232+
233+
if model_args.benchmark:
234+
import time
235+
start = 0.0
236+
total = 0.0
237+
for i in range(20):
238+
if i>10:
239+
start = time.time()
240+
boxes_filt, pred_phrases = predictor.run(image_pil, data_args.prompt)
241+
if i > 10:
242+
total += time.time()-start
243+
244+
print("Time:",total/10)
232245

233246
boxes_filt, pred_phrases = predictor.run(image_pil, data_args.prompt)
234247

@@ -294,6 +307,10 @@ class ModelArguments:
294307
default="GPU",
295308
metadata={"help": "Choose the device you want to run, it can be: CPU/GPU/XPU, default is CPU."},
296309
)
310+
benchmark: bool = field(
311+
default=False,
312+
metadata={"help": "benchmark"}
313+
)
297314

298315

299316
if __name__ == "__main__":

deploy/sam/predict.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@ class ModelArguments:
295295
default=True,
296296
metadata={"help": "save visual image."},
297297
)
298+
benchmark: bool = field(
299+
default=False,
300+
metadata={"help": "benchmark"}
301+
)
298302

299303

300304
def main(model_args, data_args):
@@ -317,6 +321,19 @@ def main(model_args, data_args):
317321
auto_tune(model_args, [image_pil], tune_img_nums)
318322

319323
predictor = Predictor(model_args)
324+
325+
if model_args.benchmark:
326+
import time
327+
start = 0.0
328+
total = 0.0
329+
for i in range(20):
330+
if i>10:
331+
start = time.time()
332+
seg_masks = predictor.run(image_pil, {"points": data_args.points_prompt, "boxs": data_args.box_prompt})
333+
if i > 10:
334+
total += time.time()-start
335+
336+
print("Time:",total/10)
320337

321338
seg_masks = predictor.run(image_pil, {"points": data_args.points_prompt, "boxs": data_args.box_prompt})
322339

0 commit comments

Comments
 (0)