소스 검색

Manually delete the predictor to trigger its destructor, ensuring that the shape_range_info file would be saved

gaotingquan 8 달 전
부모
커밋
0742a15ef8
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      paddlex/inference/models/common/static_infer.py

+ 3 - 0
paddlex/inference/models/common/static_infer.py

@@ -122,6 +122,9 @@ def _collect_trt_shape_range_info(
     # a garbage collector. Is there a more explicit and deterministic way to
     # handle this?
 
+    # HACK: Manually delete the predictor to trigger its destructor, ensuring that the shape_range_info file would be saved.
+    del predictor
+
 
 # pir trt
 def _convert_trt(