Search code examples
onnx

export an unfitted model to ONNX


I am building an API for training models, and figured I wanted to use ONNX to send the models back and forth.

I am testing with a sklearn XGboost model, and it seems that it is a requirement to fit the model before I can export it to onnx.

I want to define a custom or standard sklearn model, convert to onnx for transport, reopen and train, save in ONNX

Is this feasable at all? My end goal is to have an API that can accept any sklearn, tensorflow or similar model in an untrained state and then train on the server.


Solution

  • Onnx is used to deliver model results, including pre and post-processing or other manipulations, "in production".

    The assumption is the model is already trained and you only need to "predict" (or whatever similar action) on new data.

    Sound like what you need is a Python (or other) code that will receive your API calls, translate them into the appropriate models, train the models, and then, if you want to be independent from an MLOps point of view, transform the result into Onnx.