How It Works
You can upload your custom model via the MindsDB editor by clickingAdd
and Upload custom model
, like this:
-
The Python file stores an implementation of your model. It should contain the class with the implementation for the
train
andpredict
methods. Here is the sample format:
Example
Example
-
The optional requirements file, or
requirements.txt
, stores all dependencies along with their versions. Here is the sample format:
Example
Example
Configuration
The BYOM feature can be configured with the following environment variables:-
MINDSDB_BYOM_ENABLED
This environment variable defines whether the BYOM feature is enabled (MINDSDB_BYOM_ENABLED=true
) or disabled (MINDSDB_BYOM_ENABLED=false
). Note that when running MindsDB locally, it is enabled by default. -
MINDSDB_BYOM_DEFAULT_TYPE
This environment variable defines the modes of operation of the BYOM feature.-
MINDSDB_BYOM_DEFAULT_TYPE=venv
When using thevenv
mode, MindsDB creates a virtual environment and installs in it the packages listed in therequirements.txt
file. This virtual environment is dedicated for the custom model. Note that when running MindsDB locally, it is the default mode. -
MINDSDB_BYOM_DEFAULT_TYPE=inhouse
When using theinhouse
mode, there is no dedicated virtual environment for the custom model. It uses the environment of MindsDB, therefore, therequirements.txt
file is not used with this mode.
-
-
MINDSDB_BYOM_INHOUSE_ENABLED
This environment variable defines whether theinhouse
mode is enabled (MINDSDB_BYOM_INHOUSE_ENABLED=true
) or disabled (MINDSDB_BYOM_INHOUSE_ENABLED=false
). Note that when running MindsDB locally, it is enabled by default.
Example
We upload the custom model, as below:model.py
file that stores an implementation of the model and the requirements.txt
file that stores all the dependencies.
Once the model is uploaded, it becomes an ML engine within MindsDB. Now we use this custom_model_engine
to create a model as follows:
Check out the BYOM handler folder to see the implementation details.