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

Method load_model

demo/HuggingFace/NNDF/models.py:282–297  ·  view source on GitHub ↗

Loads the model from disk if isn't already loaded. Does not attempt to load if given model is already loaded and instead returns original instance. Use as_torch_model() instead to always guarantee a new instance and location on disk. Args: None

(self)

Source from the content-addressed store, hash-verified

280 self.model = None
281
282 def load_model(self) -> Module:
283 """
284 Loads the model from disk if isn't already loaded.
285 Does not attempt to load if given model is already loaded and instead returns original instance.
286 Use as_torch_model() instead to always guarantee a new instance and location on disk.
287
288 Args:
289 None
290
291 Returns:
292 torch.Model: Loaded torch model.
293 """
294 if self.is_loaded:
295 return self.model
296
297 return load(self.fpath)
298
299 def as_onnx_model(
300 self,

Callers 1

as_onnx_modelMethod · 0.95

Calls 1

loadFunction · 0.85

Tested by

no test coverage detected