TabularPredictor.compile_models#
- TabularPredictor.compile_models(models='best', with_ancestors=True, compiler_configs='auto')[source]#
Compile models for accelerated prediction. This can be helpful to reduce prediction latency and improve throughput.
Note that this is currently an experimental feature, the supported compilers can be [‘native’, ‘onnx’].
In order to compile with a specific compiler, that compiler must be installed in the Python environment.
- Parameters
models (list of str or str, default = 'best') – Model names of models to compile. If ‘best’ then the model with the highest validation score is compiled (this is the model used for prediction by default). If ‘all’ then all models are compiled. Valid models are listed in this predictor by calling predictor.get_model_names().
with_ancestors (bool, default = True) – If True, all ancestor models of the provided models will also be compiled.
compiler_configs (dict or str, default = "auto") –
- If “auto”, defaults to the following:
- compiler_configs = {
“RF”: {“compiler”: “onnx”}, “XT”: {“compiler”: “onnx”}, “NN_TORCH”: {“compiler”: “onnx”},
}
Otherwise, specify a compiler_configs dictionary manually. Keys can be exact model names or model types. Exact model names take priority over types if both are valid for a model. Types can be either the true type such as RandomForestModel or the shorthand “RF”. The dictionary key logic for types is identical to the logic in the hyperparameters argument of predictor.fit
- Example values within the configs:
- compilerstr, default = None
The compiler that is used for model compilation.
- batch_sizeint, default = None
The batch size that is optimized for model prediction. By default, the batch size is None. This means the compiler would try to leverage dynamic shape for prediction. Using batch_size=1 would be more suitable for online prediction, which expects a result from one data point. However, it can be slow for batch processing, because of the overhead of multiple kernel execution. Increasing batch size to a number that is larger than 1 would help increase the prediction throughput. This comes with an expense of utilizing larger memory for prediction.