Package: mlsteam-model-sdk
mlsteam-model-sdkSDK for accessing MLSteam modelsSetuppip3installmlsteam-model-sdkTo process encrypted model versions, install theThemis development packageaccording to the officialinstrunctions. Debian/Ubuntu users have a handy installation method:# for users that already have administrator privilegesmlsteam-model-cliinstall-themisdev# for those that need privilege liftingsudomlsteam-model-cliinstall-themisdevUsageInitilize SDKSDK needs to be initialized if you have not done so (replace the fields started with$):mlsteam-model-cliinit\--default_project_type=name\--default_project_val=$PROJECT_OWNER/$PROJECT_NAMEBy 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 setupapi_tokenwith this command instead, or by editing theapi_tokenfield incfg.ini:mlsteam-model-cliinit\--api_token=$YOUR_API_TOKEN\--default_project_type=name\--default_project_val=$PROJECT_OWNER/$PROJECT_NAMEDownload a model version with SDKfrommlsteam_model_sdk.sdk.modelimportModelsdk_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 withsudo, or enter your password in asudoprompt 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 SDKThere 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:frommlsteam_model_sdk.sdk.modelimportModelsdk_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 setoffline=Trueto 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 themodel_nameandversion_nameparameters.Import a model version with CLIThis 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 packagesmlsteam-model-climvimport-local-f$PACKAGE_FILE_PATH# for encrypted packagesmlsteam-model-climvimport-local-f$PACKAGE_FILE_PATH-k$ENCKEY_FILE_PATHBy default, the model and version names to register are read from the package manifest. You may customize these settings with the--model_nameand--version_nameoptions.If the operation is successful, you will find the imported pakage in local model registry:mlsteam-model-climvlist-localmuuid     model_name       vuuid        version_name     puuid     packaged   encrypted      download_time
 ================================================================================================================
 __local__   ...          local-........   ...            __local__   1          ...            .....