hyrax.verbs.engine#
Attributes#
Classes#
This verb drives inference with an ONNX model in production. |
Module Contents#
- class Engine(config)[source]#
Bases:
hyrax.verbs.verb_registry.VerbThis verb drives inference with an ONNX model in production.
Overall initialization for all verbs that saves the config
- run(model_directory: str = None)[source]#
Run inference with an ONNX model.
This method performs the following steps: - Read in the user config - Prepare all the datasets requested - Implement a simple strategy for reading in batches of data samples - Process the samples with any custom collate functions as well as a default collate function - Pass the collated batch to the appropriate to_tensor function - Send that output to the ONNX-ified model - Persist the results of inference
- Parameters:
model_directory (str, optional) – Directory containing the ONNX model. If not provided, uses the config file or finds the most recent ONNX export directory.
- create_ort_inputs(prepared_batch)[source]#
Create the inputs array for the ONNX model using the expected inputs from the loaded ONNX model and the type and shape of the prepared batch.