Unverified Commit 3cbc560d authored by Alexander Markov's avatar Alexander Markov Committed by GitHub
Browse files

added compiled model support for inference (#25124)



* added compiled model support for inference

* linter

* Fix tests

* linter

* linter

* remove inference mode from pipelines

* Linter

---------
Co-authored-by: default avataramarkov <alexander@inworld.ai>
parent afa96fff
......@@ -27,8 +27,6 @@ from contextlib import contextmanager
from os.path import abspath, exists
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
from packaging import version
from ..dynamic_module_utils import custom_object_save
from ..feature_extraction_utils import PreTrainedFeatureExtractor
from ..image_processing_utils import BaseImageProcessor
......@@ -1015,12 +1013,7 @@ class Pipeline(_ScikitCompat):
raise NotImplementedError("postprocess not implemented")
def get_inference_context(self):
inference_context = (
torch.inference_mode
if version.parse(version.parse(torch.__version__).base_version) >= version.parse("1.9.0")
else torch.no_grad
)
return inference_context
return torch.no_grad
def forward(self, model_inputs, **forward_params):
with self.device_placement():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment