Training and deploying models with BaseModelService
BaseModelService is a Python class that is distributed as a part of the Python client for the Onesait Platform. The code for this client is maintained by the Platform0s community on Github, and can be installed via pip:
pip install onesaitplatform-client-services
The use of BaseModelService allows you to:
- Train and retrain models to generate different versions of these.
- Register the different versions of each model with the parameters with which they were trained, and the metrics with which they were evaluated.
- Record and save the artefacts generated for each version of each model.
- Retrieve the models that were previously trained and saved for its use in inference.
All this is done by taking advantage of the tools that the Platform provides for:
- The ontologies, to trace the different versions of the models and save training datasets.
- The File Repository, to store model artefacts and training datasets.
BaseModelService abstracts the management of all this functionality from the model developers, allowing them to make use of it in a simple way. As its name suggests, BaseModelService is a parent class from which the model developer will create a child class that inherits from it.
The child class will contain the specific code to train a particular model, save it to a local path, then load the saved version also from a local path and use it in inference. The model developers can use any kind of Python library (scikit-learn, Tensorflow, PyTorch, etc.). They can also use the model saving and loading mechanisms of their choice.
The rest of the interaction tasks with the Platform have already been defined in the BaseModelService parent class: downloading the dataset from a file in the File Repository, or from an ontology; saving the trained models in the File Repository, downloading these models from the File Repository, checking the different versions of the same model and selecting the preferred version.
As examples of the use of BaseModelService, we recommend these two tutorials:
- Entrenamiento y despliegue de modelos con BaseModelService (in Spanish):
- Creation of a BaseModelService child class: SentimentAnalysisModelService.
YouTube | Release 3.0.0 Feature – Wrapper for model creation (in Spanish)