MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / as_trt_engine

Method as_trt_engine

demo/HuggingFace/NNDF/models.py:225–250  ·  view source on GitHub ↗

Converts current model into an TRT engine. Uses provided converter to convert object or default_convert is used instead if available. Args: output_fpath (str): File location of the generated ONNX file. converter (ModelFileConverter): Class to convert

(
        self,
        output_fpath: str,
        converter: ModelFileConverter = None,
        force_overwrite: bool = False,
        profiles: List[Profile] = [],
        preview_features: List[PreviewFeature] = []
    )

Source from the content-addressed store, hash-verified

223 )
224
225 def as_trt_engine(
226 self,
227 output_fpath: str,
228 converter: ModelFileConverter = None,
229 force_overwrite: bool = False,
230 profiles: List[Profile] = [],
231 preview_features: List[PreviewFeature] = []
232 ):
233 """
234 Converts current model into an TRT engine.
235 Uses provided converter to convert object or default_convert is used instead if available.
236
237 Args:
238 output_fpath (str): File location of the generated ONNX file.
239 converter (ModelFileConverter): Class to convert current model instance into another.
240 force_overwrite (bool): If the file already exists, tell whether or not to overwrite.
241 Since torch models folders, can potentially erase entire folders.
242 profiles (List[polygraphy.backend.trt.Profile]): The optimization profiles used to build the engine.
243 preview_features (List[tensorrt.PreviewFeature]): The preview features to enable when building the engine.
244
245 Returns:
246 TRTEngineFile: Newly generated ONNXModelFile
247 """
248 raise NotImplementedError(
249 "Current model does not support exporting to trt engine."
250 )
251
252 @abstractmethod
253 def cleanup(self) -> None:

Callers 3

_setup_enginesMethod · 0.45
_setup_enginesMethod · 0.45
_setup_enginesMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected