MLSteam Model SDK
Project description
mlsteam-model-sdk
SDK for accessing MLSteam models
Setup
pip3 install mlsteam-model-sdk
To process encrypted model versions, install the Themis development package according to the official instrunctions. Debian/Ubuntu users have a handy installation method:
# for users that already have administrator privileges
mlsteam-model-cli install-themisdev
# for those that need privilege lifting
sudo mlsteam-model-cli install-themisdev
Usage
Initilize SDK
SDK needs to be initialized if you have not done so (replace the fields started with $):
mlsteam-model-cli init \
--default_project_type=name \
--default_project_val=$PROJECT_OWNER/$PROJECT_NAME
By default, the settings will be at
$HOME/.mlsteam-model-sdk/cfg.ini
.
If the program is running out of an MLSteam system, you may also need to setup api_token
with this command instead, or by editing the api_token field in cfg.ini
:
mlsteam-model-cli init \
--api_token=$YOUR_API_TOKEN \
--default_project_type=name \
--default_project_val=$PROJECT_OWNER/$PROJECT_NAME
Download a model version with SDK
from mlsteam_model_sdk.sdk.model import Model
sdk_model = Model()
sdk_model.download_model_version(model_name='model_name',
version_name='version_name')
You will need administrator privileges to handle encrypted model versions. For this case, either run the Python program with
sudo
, or enter your password in asudo
prompt during program execution.
By default, the model version will be downloaded at
$HOME/.mlsteam-model-sdk/models/download/
.
This loads a model version and makes prediction:
mv = sdk_model.load_model_version(model_name='model_name',
version_name='version_name')
outputs = mv.predict(inputs)
Import a model version with SDK
There is an alternative way (2-stage model deployment) to import a model version without connecting to an MLSteam system. Rather than downloading from MLSteam directory, it involves (1) getting the related file(s) from MLSteam and then (2) importing the model version from the file(s). This alternative way adds complexity of managing the model file(s) but is suitable for the situation where there is no network connection to the MLSteam system.
This example assumes the following files are locally available:
- model version package (required)
- package encryption key (required only for encrypted packages)
You will need administrator privileges to import an encrypted model version, as mentioned in the previous example.
To import a package:
from mlsteam_model_sdk.sdk.model import Model
sdk_model = Model(offline=True)
sdk_model.import_model_version(mv_package_file='path/to/mv/package/file',
enckey_file='path/to/enckey/file')
# for non-encrypted package
# sdk_model.import_model_version(mv_package_file='path/to/mv/package/file')
- We set
offline=True
to have SDK operate in offline mode (without connecting to MLSteam).- By default, the model and version names to register are read from the package manifest. You may customize these settings with the
model_name
andversion_name
parameters.
Import a model version with CLI
This example assumes the following files are locally available:
- model version package (required)
- package encryption key (required only for encrypted packages)
You will need administrator privileges to import an encrypted model version, as mentioned in the previous example.
To import a package:
# for non-encrypted packages
mlsteam-model-cli mv import-local -f $PACKAGE_FILE_PATH
# for encrypted packages
mlsteam-model-cli mv import-local -f $PACKAGE_FILE_PATH -k $ENCKEY_FILE_PATH
By default, the model and version names to register are read from the package manifest. You may customize these settings with the
--model_name
and--version_name
options.
If the operation is successful, you will find the imported pakage in local model registry:
mlsteam-model-cli mv list-local
muuid model_name vuuid version_name puuid packaged encrypted download_time ================================================================================================================ __local__ ... local-........ ... __local__ 1 ... .....
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 Distributions
Built Distributions
File details
Details for the file mlsteam_model_sdk-0.6.0-cp312-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mlsteam_model_sdk-0.6.0-cp312-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 189.7 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd2ac98806a94581ebbf711d9f4a46a872acf8e8bc31d04083bcef483a7568fb |
|
MD5 | 58228ef38f7972873195aa0d2e852ec5 |
|
BLAKE2b-256 | 95e293c2b0242c6522bd5283923ad293ca11b20715af3981a46aff02b9055ae5 |
File details
Details for the file mlsteam_model_sdk-0.6.0-cp311-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mlsteam_model_sdk-0.6.0-cp311-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 169.4 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b07e2ae575a1af60de4b6a8b0f8ba5ebfc72e8783715069ffbece0198f1ffc37 |
|
MD5 | f84a50e2908d58a449168b6861c0abcd |
|
BLAKE2b-256 | 555843c2dc10263ab9e0c0bfb6674a35e4df4b25f22930a8968847f0729e5824 |
File details
Details for the file mlsteam_model_sdk-0.6.0-cp310-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mlsteam_model_sdk-0.6.0-cp310-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 151.8 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1078b44e736ed5e73d93dca096220cf5bbb5c60e5bc55ee2645c599d295f5d9 |
|
MD5 | 49ee4cd9cecda2f553c27873bbfc00ef |
|
BLAKE2b-256 | 6330c4fda6c83d7fe7564f96a6641e76d0d4d4e916be3372f323f667a29306fc |
File details
Details for the file mlsteam_model_sdk-0.6.0-cp39-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mlsteam_model_sdk-0.6.0-cp39-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 151.5 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8438418a0178a980b57d1d4986c4264ac81d68350d108fdd0627100c316d11a |
|
MD5 | d5ef1fa58f9a468ccbc29cff9b6b5928 |
|
BLAKE2b-256 | 9d03df3449b1297e86493e4d92ca808861f451fb1e055251fd9590cae6280978 |
File details
Details for the file mlsteam_model_sdk-0.6.0-cp38-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mlsteam_model_sdk-0.6.0-cp38-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 157.6 kB
- Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fed502ade31f79da6be284958673999671b2c298bd150b0e40490dd5c7827c66 |
|
MD5 | 7353d885a08f6c12cd0527d847c092d5 |
|
BLAKE2b-256 | b5043d01d332a6b34bf7b39d33d056013ca91c5f7f1cea43cb185576f5b71bb9 |
File details
Details for the file mlsteam_model_sdk-0.6.0-cp37-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mlsteam_model_sdk-0.6.0-cp37-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 144.9 kB
- Tags: CPython 3.7, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 162cc9d1db200e65168927cfa16891b51ccebb422a4c01f1659244fc9e25163d |
|
MD5 | e9c9ca74ff41400b452e51e50f0cd261 |
|
BLAKE2b-256 | 69b3f90a752d3c161cf8fd75e50e724cf17d1a0b418f7ddc6a6f7f2a6daa873a |
File details
Details for the file mlsteam_model_sdk-0.6.0-cp36-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mlsteam_model_sdk-0.6.0-cp36-none-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 135.2 kB
- Tags: CPython 3.6, manylinux: glibc 2.17+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b99b6566d1ac19333b70d56545e1ed5bf6c14e1699b00ffe12bcc7b3ceb285da |
|
MD5 | 8ae33deeabdd3540d15005be9b756ee0 |
|
BLAKE2b-256 | b76374e311ea62d7d34d45abfb1fe89d70d42444e01ec163fdee558b6fc0f3f5 |