Skip to main content

metamaker

Actions Status License

Simple command line tool to train and deploy your machine learning models with AWS SageMaker

Features

metamaker enables you to:

  • Build a docker image for training and inference with poetry and FastAPI
  • Train your own machine learning model with SageMaker
  • Deploy inference endpoint with SageMaker

Usage

  1. Create poetry project and install metamaker
❯ poetry new your_module
❯ cd your_module
❯ poetry add git+https://github.com/altescy/metamaker#main
  1. Define scripts for traning and inference in main.py
from pathlib import Path
from typing import Any, Dict

from metamaker import MetaMaker

from your_module import Model, Input, Output

app = MetaMaker[Model, Input, Output]()

@app.trainer
def train(
    dataset_path: Path,
    artifact_path: Path,
    hyperparameters: Dict[str, Any],
) -> None:
    model = Model(**hyperparameters)
    model.train(dataset_path / "train.csv")
    model.save(artifact_path / "model.tar.gz")

@app.loader
def load(artifact_path: Path) -> Model:
    return Model.load(artifact_path / "model.tar.gz")

@app.predictor
def predict(model: Model, data: Input) -> Output:
    return model.predict(data)
  1. Write metamaker configs in metamaker.yaml
handler: main:app
dataset_path: s3://your-bucket/path/to/dataset/
artifact_path: s3://your-bucket/path/to/artifacts/
hyperparameter_path: ./hparams.yaml

image:
  name: metamaker
  includes:
    - your_module/
    - main.py
  excludes:
    - __pycache__/
    - '*.py[cod]'

training:
  execution_role: arn:aws:iam::xxxxxxxxxxxx:role/SageMakerExecutionRole
  instance:
    type: ml.m5.large
    count: 1

inference:
  endpoint_name: your_endpoint
  instance:
    type: ml.t2.meduim
    count: 1
  1. Build docker image and push to ECR
metamaker build --deploy .
  1. Train your model with SageMaker and deploy endpoint
metamker sagemaker train --deploy

Metadata

Release files for metamaker 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metamaker 0.1.0
File Size Uploaded Provenance Actions
metamaker-0.1.0.tar.gz 11.4 kB Without provenance Details for metamaker-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for metamaker 0.1.0
File Interpreter ABI Platform Actions
metamaker-0.1.0-py3-none-any.whl Python 3 none any Details for metamaker-0.1.0-py3-none-any.whl

Total release size: 27.0 kB

Release files / metamaker-0.1.0.tar.gz

Download URL metamaker-0.1.0.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
de30d99b8dde7143bb5767dde7da9a0e0687cb66cb87b03d801c1eaa92703029
BLAKE2b-256 checksum
How to use checksums
093933f49573394bab5f5a53cbbed8f3ddafb3b94e683a3c91fc84050dea239f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.8.2 Linux/5.11.0-1020-azure

Release files / metamaker-0.1.0-py3-none-any.whl

Download URL metamaker-0.1.0-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3a8e4c6fa9ecd4edf473373eba1131e9c9854a42009f7f9f8070bc39bafb61e
BLAKE2b-256 checksum
How to use checksums
200ee1e4cc1107675c766f121e9be3cfe64fc9bafd98c440938bd5e7590cf85b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.8.2 Linux/5.11.0-1020-azure

Security for metamaker 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page