Deploy Machine Learning Solutions with Ease
Project description
ML Launchpad lets you easily make Machine Learning models available as REST API (or any kind of microservice). It also offers lightweight model life cycle management functionality.
It creates a separation between machine learning models and their environment. This way, you can run your model with different data sources. and on different environments, by just swapping out the configuration, no code changes required. ML Launchpad makes your model available as a business-facing RESTful API without extra coding.
Currently, some basic model life cycle management is supported. Training automatically persists a model in the model store together with its metrics, and automatically retrieves it for launching its API or re-training. Previous models are backed up.
The full documentation is available at https://mllaunchpad.readthedocs.io.
To learn more about the rationale and structure of ML Launchpad, see Description.
Getting started
$ pip install mllaunchpad
Download the example files from the ML Launchpad GitHub repo. Some of them might require the installations of some extra packages (e.g. scikit-learn), depending on what they demonstrate.
For more about installation, or if you don’t want to use pip and instead install from source (as a user), please see the section Installation.
If you want to work on ML Launchpad itself, see Contributing.
What’s in the box?
If you downloaded the source, you see several subfolders, where mllaunchpad is the actual ML Launchpad package and the rest are examples and development tools. You can safely ignore anything except the examples.
The examples contain a few example model implementations. Look here for inspiration on how to use this package. Every model here consists of at least three files:
<examplename>_model.py: the example’s actual model code
<examplename>_cfg.yml: the example’s configuration file
<examplename>.raml: example’s RESTful API specification. Used, among others, to parse and validate parameters.
There are also some extra files, like CSV files to use, or datasource. extensions.
The subfolder testserver contains an example for running a REST API in gunicorn behind nginx.
Try Out the Examples
In the following, it is assumed that mllaunchpad is installed and the examples are located in the current directory.
To train a very, very simple example model whose job it is to add two numbers, use the command:
$ mllaunchpad -c addition_cfg.yml t
(We give it a config file after the -c parameter, and t is short for the command train. There’s also a parameter -h to print help. For all details of the command line interface, see the Usage section.)
Some log information is printed (you can give it a log-config file to change this, see examples/logging_cfg.yml). At the end, it should say “Created and stored trained model”, followed by something about metrics.
This created a model_store if it didn’t exist yet (which for now is just a directory). For our examples, the model store is conveniently located in the same directory. It contains our persisted addition model and its metadata.
To re-test the previously trained model, use the command r:
$ mllaunchpad -c addition_cfg.yml r
To run a (debugging-only!) REST API for the model, use the command a:
$ mllaunchpad -c addition_cfg.yml a
To quickly try out out our fancy addition model API, open this link in a browser: http://127.0.0.1:5000/add/v0/sum?x1=3&x2=2 (curl "http://127.0.0.1:5000/add/v0/sum?x1=3&x2=2" on the command line)
What next?
Have a look at the addition example’s python code (and comments), its yml config, then look at the other examples. First, we suggest the tree example for intermediate complexity (although its prediction code does quite some complex stuff to be compatible with three different kinds of prediction usage, which is not really that realistic).
If you are wondering about the RAML file (which is a RESTful API specification standard that is used in some corporate environments, and a good idea in general), also look at the g (generate-raml) command line parameter, which does a lot of work (almost all of it, in fact) for getting you started with a first RAML.
To learn how to use ML Launchpad, see Usage.
For more details on how ML Launchpad actually works and why we created it, see In Depth.
Troubleshooting
In case the console command mllaunchpad <your_arguments> is not recognized, try:
$ python -m mllaunchpad <your_arguments>
If you get an error like No module named 'your_model', the file your_model.py is not in the python path. You can try to set the PYTHONPATH environment variable to the path(s) to your file(s), or, if you’re using mllaunchpad from your own python code, append the path(s) to sys.path.
If you get ModuleNotFoundError: No module named 'mllaunchpad' (in mllaunchpad/__main__.py), try to start flask the following way:
$ export FLASK_APP=mllaunchpad.wsgi:application
$ export LAUNCHPAD_CFG=addition_cfg.yml
$ flask run
(On Windows, use set instead of export)
This problem appears to be connected to Flask restarting in different ways on different installations. If you know what exactly this is about, please let us know.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file mllaunchpad-1.1.0.tar.gz
.
File metadata
- Download URL: mllaunchpad-1.1.0.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c896ab3e0669a3ada5ec7b73dcaaf8f4395c6e7745e63a0614720b9a6fe1b28 |
|
MD5 | 303f49687241df72bc3d9c569c8f6e88 |
|
BLAKE2b-256 | 0c24e710ff55e402fbc5240187a1f822f6d807bf3f312f7b2b754353357521e9 |
File details
Details for the file mllaunchpad-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: mllaunchpad-1.1.0-py3-none-any.whl
- Upload date:
- Size: 62.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fdc0d5e7931e6bea7a8f0561aa480c13e353f35a5f11485c895d8da779e3d5d |
|
MD5 | 540374e659ece55142bce444128984b6 |
|
BLAKE2b-256 | 52dcdf0e5c83ee959700aa346544cba6fd7bd25cad0d45748c54a20d54f3de56 |