https://github.com/logicalclocks/machine-learning-api
Hopsworks Machine Learning Api 🚀 Model management with a model registry and model serving
https://github.com/logicalclocks/machine-learning-api
model-registry model-serving
Last synced: 11 months ago
JSON representation
Hopsworks Machine Learning Api 🚀 Model management with a model registry and model serving
- Host: GitHub
- URL: https://github.com/logicalclocks/machine-learning-api
- Owner: logicalclocks
- License: apache-2.0
- Created: 2021-09-13T15:22:52.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-12T10:50:06.000Z (over 1 year ago)
- Last Synced: 2025-04-09T18:17:01.991Z (11 months ago)
- Topics: model-registry, model-serving
- Language: Python
- Homepage: https://docs.hopsworks.ai/machine-learning-api/latest/
- Size: 5.17 MB
- Stars: 8
- Watchers: 13
- Forks: 20
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Hopsworks Model Management
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](https://app.hopsworks.ai/). Create your project and a [new Api key](https://docs.hopsworks.ai/latest/user_guides/projects/api_key/create_api_key/). In a new python environment with Python 3.8 or higher, install the [client library](https://docs.hopsworks.ai/latest/user_guides/client_installation/) using pip:
```bash
# 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.
```python
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:
```python
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
```python
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
```python
model = mr.get_model("mnist", version=1)
model_path = model.download()
```
Delete a model
```python
model.delete()
```
Get best performing model
```python
best_model = mr.get_best_model('mnist', 'accuracy', 'max')
```
Deploy a model
```python
deployment = model.deploy()
```
Start a deployment
```python
deployment.start()
```
Make predictions with a deployed model
```python
data = { "instances": [ model.input_example ] }
predictions = deployment.predict(data)
```
# Tutorials
You can find more examples on how to use the library in our [tutorials](https://github.com/logicalclocks/hopsworks-tutorials).
## Documentation
Documentation is available at [Hopsworks Model Management Documentation](https://docs.hopsworks.ai/).
## Issues
For general questions about the usage of Hopsworks Machine Learning please open a topic on [Hopsworks Community](https://community.hopsworks.ai/).
Please report any issue using [Github issue tracking](https://github.com/logicalclocks/machine-learning-api/issues).
## Contributing
If you would like to contribute to this library, please see the [Contribution Guidelines](CONTRIBUTING.md).