Skip to main content

Modelzone SDK – a slim model training and serving toolkit

Project description

Modelzone SDK

A slim Python SDK for defining, training, and serving machine-learning models.

Installation

pip install modelzone-sdk

For local training with Delta Lake data access:

pip install modelzone-sdk[training]

For AzureML experiment tracking:

pip install modelzone-sdk[azureml]

Quick start

Define a model by subclassing Model and implementing train and predict:

from modelzone.core import Model, PredictContext, TrainedModel
from modelzone.training import TrainingContext


class MyModel(Model):
    def train(self, ctx: TrainingContext) -> TrainedModel:
        ctx.print("Training started")

        # … your training logic …
        fitted = train_something(seed=ctx.seed)

        ctx.log_metric("accuracy", 0.95)
        return TrainedModel(model=fitted, features=["feature_a", "feature_b"])

    def predict(self, ctx: PredictContext):
        df = ctx.db.query("input_table", ctx.time_interval)
        return ctx.model.predict(df[ctx.features])

Local training

from modelzone.training import LocalBackend

backend = LocalBackend(root="./runs")
result = backend.run(MyModel(), seed=42, params={"lr": 0.01})
print(result.run_id)

AzureML training

from modelzone.azureml import AzureMLBackend

backend = AzureMLBackend(
    subscription_id="...",
    resource_group="...",
    workspace_name="...",
    experiment_name="my_experiment",
)
result = backend.run(MyModel(), seed=42)

Loading a trained model for prediction

from modelzone.predict import load_model

trained_model = load_model(".model")
print(trained_model.features)

CLI

modelzone train my_model_package            # Local training
modelzone train my_model_package --azureml   # AzureML training
modelzone register my_model_package <run_id>
modelzone fetch my_model_package --output-dir .model

Development

poetry install --with dev,test
pytest

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

modelzone_sdk-0.2.0.dev0.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

modelzone_sdk-0.2.0.dev0-py3-none-any.whl (24.6 kB view details)

Uploaded Python 3

File details

Details for the file modelzone_sdk-0.2.0.dev0.tar.gz.

File metadata

  • Download URL: modelzone_sdk-0.2.0.dev0.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.13.12 Linux/6.14.0-1017-azure

File hashes

Hashes for modelzone_sdk-0.2.0.dev0.tar.gz
Algorithm Hash digest
SHA256 da10eb45399ce6243c47013bb05925dc5d693f21b8e3957cfc465cf5d3d461c7
MD5 9faf0ee1d083aacea83d1c9e14c9eed8
BLAKE2b-256 648607a7cf50fa43cbaa6e3eb2bb61734ba1f9477efe224550bbe957e1d8bc05

See more details on using hashes here.

File details

Details for the file modelzone_sdk-0.2.0.dev0-py3-none-any.whl.

File metadata

  • Download URL: modelzone_sdk-0.2.0.dev0-py3-none-any.whl
  • Upload date:
  • Size: 24.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.13.12 Linux/6.14.0-1017-azure

File hashes

Hashes for modelzone_sdk-0.2.0.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 b325288aa514478633763933af92af1e7d57d0d5eca879dd148325fc38953b35
MD5 3bda1b2d054ad77b0609d093a6781e1a
BLAKE2b-256 9bbbbd1ea1e2cc0a835c8e63fde1e6cf0d5eb21cf4eb98677bc9844e67045aea

See more details on using hashes here.

Supported by

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