Skip to main content

HSML Python SDK to interact with Hopsworks Model Registry

Project description

Hopsworks Model Management

Hopsworks Community Hopsworks Model Management Documentation python PyPiStatus Scala/Java Artifacts Downloads Ruff License

HSML is the library to interact with the Hopsworks Model Registry and Model Serving. The library makes it easy to export, manage and deploy models.

However, to connect from an external Python environment additional connection information, such as host and port, is required.

Getting Started On Hopsworks

Get started easily by registering an account on Hopsworks Serverless. Create your project and a new Api key. In a new python environment with Python 3.8 or higher, install the client library using pip:

# Get all Hopsworks SDKs: Feature Store, Model Serving and Platform SDK
pip install hopsworks
# or just the Model Registry and Model Serving SDK
pip install hsml

You can start a notebook and instantiate a connection and get the project feature store handler.

import hopsworks

project = hopsworks.login() # you will be prompted for your api key

mr = project.get_model_registry()
# or
ms = project.get_model_serving()

or using hsml directly:

import hsml

connection = hsml.connection(
    host="c.app.hopsworks.ai", #
    project="your-project",
    api_key_value="your-api-key",
)

mr = connection.get_model_registry()
# or
ms = connection.get_model_serving()

Create a new model

model = mr.tensorflow.create_model(name="mnist",
                                   version=1,
                                   metrics={"accuracy": 0.94},
                                   description="mnist model description")
model.save("/tmp/model_directory") # or /tmp/model_file

Download a model

model = mr.get_model("mnist", version=1)

model_path = model.download()

Delete a model

model.delete()

Get best performing model

best_model = mr.get_best_model('mnist', 'accuracy', 'max')

Deploy a model

deployment = model.deploy()

Start a deployment

deployment.start()

Make predictions with a deployed model

data = { "instances": [ model.input_example ] }

predictions = deployment.predict(data)

Tutorials

You can find more examples on how to use the library in our tutorials.

Documentation

Documentation is available at Hopsworks Model Management Documentation.

Issues

For general questions about the usage of Hopsworks Machine Learning please open a topic on Hopsworks Community. Please report any issue using Github issue tracking.

Contributing

If you would like to contribute to this library, please see the Contribution Guidelines.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hsml-3.9.0rc0.tar.gz (107.7 kB view details)

Uploaded Source

Built Distribution

hsml-3.9.0rc0-py3-none-any.whl (139.2 kB view details)

Uploaded Python 3

File details

Details for the file hsml-3.9.0rc0.tar.gz.

File metadata

  • Download URL: hsml-3.9.0rc0.tar.gz
  • Upload date:
  • Size: 107.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for hsml-3.9.0rc0.tar.gz
Algorithm Hash digest
SHA256 daa1a1c50e52d302202c972603f7a22a013ee79584f9955a9bb9c53eb1280253
MD5 f4befa303ab0f0cf3fd5ad43b13717c9
BLAKE2b-256 c4c0e78a0ae7b3c010748fa025cfd927fcd6c6e777a5e5927b4106842ba5c697

See more details on using hashes here.

File details

Details for the file hsml-3.9.0rc0-py3-none-any.whl.

File metadata

  • Download URL: hsml-3.9.0rc0-py3-none-any.whl
  • Upload date:
  • Size: 139.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.12

File hashes

Hashes for hsml-3.9.0rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 3223b342d32a80bae4bcecc34f7275c17463e6cd51b7f25e52193d0f8e14f4d5
MD5 526505e834353088398aea07746cfe77
BLAKE2b-256 296b8f9594a231b5e80a095a48615db9fbd16f9b1465cf9d36df55b632eed40a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page