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
trainandpredictmethods. 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_ENABLEDThis 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_TYPEThis environment variable defines the modes of operation of the BYOM feature.-
MINDSDB_BYOM_DEFAULT_TYPE=venv
When using thevenvmode, MindsDB creates a virtual environment and installs in it the packages listed in therequirements.txtfile. 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 theinhousemode, there is no dedicated virtual environment for the custom model. It uses the environment of MindsDB, therefore, therequirements.txtfile is not used with this mode.
-
-
MINDSDB_BYOM_INHOUSE_ENABLEDThis environment variable defines whether theinhousemode 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.