diff --git a/CHANGELOG.md b/CHANGELOG.md index a3fb7ab6..3c2d4caf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 1.5.3 + +### Enhancement +- Disable ONNX Runtime memory pattern and CPU memory arena on YoloX and Detectron2 sessions to reduce idle memory after inference + ## 1.5.2 ### Fix diff --git a/unstructured_inference/__version__.py b/unstructured_inference/__version__.py index 928be505..e375e78d 100644 --- a/unstructured_inference/__version__.py +++ b/unstructured_inference/__version__.py @@ -1 +1 @@ -__version__ = "1.5.2" # pragma: no cover +__version__ = "1.5.3" # pragma: no cover diff --git a/unstructured_inference/models/detectron2onnx.py b/unstructured_inference/models/detectron2onnx.py index 79cd0a1a..650846a3 100644 --- a/unstructured_inference/models/detectron2onnx.py +++ b/unstructured_inference/models/detectron2onnx.py @@ -115,8 +115,13 @@ def initialize( ] providers = [provider for provider in ordered_providers if provider in available_providers] + sess_options = onnxruntime.SessionOptions() + sess_options.enable_mem_pattern = False + sess_options.enable_cpu_mem_arena = False + self.model = onnxruntime.InferenceSession( model_path, + sess_options=sess_options, providers=providers, ) self.model_path = model_path diff --git a/unstructured_inference/models/yolox.py b/unstructured_inference/models/yolox.py index 932242ec..3b2cee19 100644 --- a/unstructured_inference/models/yolox.py +++ b/unstructured_inference/models/yolox.py @@ -80,8 +80,13 @@ def initialize(self, model_path: str, label_map: dict): ] providers = [provider for provider in ordered_providers if provider in available_providers] + sess_options = onnxruntime.SessionOptions() + sess_options.enable_mem_pattern = False + sess_options.enable_cpu_mem_arena = False + self.model = onnxruntime.InferenceSession( model_path, + sess_options=sess_options, providers=providers, )