Skip to main content

2. Create Model Inference

ONNX is used in the core of Modelify. All framework models are converted to ONNX format. Modelify provides Model Infrence class to do that. There are 3 required parameters;

  • model: your model object
  • framework: the framework name (check out here)
  • inputs: inputs structure ( check out here)

Modelify has its own input structure and you need to create the inputs with this structure. Basically, it is expected column-based inputs as a sequence if your model input is a data frame. However, Modelify has a helper function that can generate an model schema from pandas dataframe. To get more information, check out the input structures here.

from modelify import ModelInference
from modelify.helpers import create_schema

model_input = create_schema(X_train)
inference = ModelInference(model=model, framework="LIGHTGBM", inputs=model_input)