Tutorial 3A: Model management with Model Registry
This tutorial showcases the use of H2O eScorer Python client to manage models using the Model Registry. The Model Registry is used to upload, rename, delete, and view model details.
Install the Python client
-
You can download the H2O eScorer Python client wheel from the Python client tab in the H2O eScorer downloads page.
-
In your Python environment, run the following command to install the package and its dependencies:
pip install <python-client-wheel-name>
Authentication
H2O eScorer environment variables for authentication are set just once, and can be automatically used by the client for as many runs as you want.
For more information about authenticating the Python client, see Python client overview: Authentication
Model Management
All model management operations can be performed using the Python Client via the client.model
object. The model
object provides methods to list all models, get model details, upload a model, and delete a model.
To get the list of models that has been uploaded to the Model Registry, call the list()
method of the model
object.
models = await client.model.list()
The details of a specific model can be fetched by either using the models
array or by calling the get()
method of the model
object.
model = await client.model_registry.get('riskmodel.mojo')
model
The string representation of the model
object contains the model name, version, and ID. The features
attribute of the model
object provides the list of features and their data types used by the model.
model.features
To upload a model to the Model Registry, call the upload()
method of the model
object.
model = await client.model_registry.upload(
model_path="/path/to/riskmodel.mojo",
model_name="riskmodel.mojo",
validate=True,
replace=True,
)
The model_registry.rename
method renames a model in the model registry.
model = await client.model_registry.rename(
model_name="riskmodel.mojo",
new_model_name="riskmodel_v1.mojo",
)
The model_registry.delete
method deletes a model from the model registry.
await client.model_registry.delete("riskmodel.mojo")
- Submit and view feedback for this page
- Send feedback about H2O eScorer to cloud-feedback@h2o.ai