onnxruntime: why it take 200 seconds to run onnxruntime.InferenceSession

Describe the bug here is my python code: ` import time import onnx import numpy as np import onnxruntime as ort

print(“load model …”) model = onnx.load_model(r’D:\code\c++\Project1\weights\qr_seg_df_200_0217.onnx’) print(“load model success!!!”)

print(“open InferenceSession …”) ort_session = ort.InferenceSession(r"D:\code\c++\Project1\weights\qr_seg_df_200_0217.onnx") print(“open InferenceSession success!!!”) while 1: start = time.time() outputs = ort_session.run(None, {‘input.1’: np.random.randn(1, 3, 512, 512).astype(np.float32)}) # inputs is same to orig

print(time.time() - start)

`

print log info D:\ProgramData\Anaconda3\envs\test_onnx\python.exe D:/code/python/pythonProject/main.py load model … load model success!!! open InferenceSession … open InferenceSession success!!! 201.26154327392578 0.04879260063171387 0.04580569267272949 0.038834333419799805 0.038835763931274414 0.03883504867553711 0.03982830047607422 0.03983306884765625.

System information

  • window10:
  • onnxruntime1.6.0:
  • Python version 3.7
  • Visual Studio version 2015
  • GCC/Compiler version (if compiling from source):
  • CUDA/cuDNN version: cuda10.2, cudnn8.0.3
  • GPU model and memory: gtx 3090

Screenshots 1645428779(1)

thank you!

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 15 (10 by maintainers)

Most upvoted comments

There’s also the case where CUDA JIT will generate architecture specific code for all of the CUDA files, if we haven’t prebuilt for that architecture. Typically this only happens once and is cached but we ran into cases where the cache was regenerated each time run. It was on the order of a couple of minutes when it happened.