metamaker
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
- Create poetry project and install metamaker
❯ poetry new your_module
❯ cd your_module
❯ poetry add git+https://github.com/altescy/metamaker#main
- 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)
- 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
- Build docker image and push to ECR
metamaker build --deploy .
- Train your model with SageMaker and deploy endpoint
metamker sagemaker train --deploy
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
metamaker-0.1.0.tar.gz
(11.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
metamaker-0.1.0-py3-none-any.whl
(15.6 kB
view details)
File details
Details for the file metamaker-0.1.0.tar.gz.
File metadata
- Download URL: metamaker-0.1.0.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/1.1.11 CPython/3.8.2 Linux/5.11.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de30d99b8dde7143bb5767dde7da9a0e0687cb66cb87b03d801c1eaa92703029
|
|
| MD5 |
db53d08d1ecaa9b60b96b90a9e7bd321
|
|
| BLAKE2b-256 |
093933f49573394bab5f5a53cbbed8f3ddafb3b94e683a3c91fc84050dea239f
|
File details
Details for the file metamaker-0.1.0-py3-none-any.whl.
File metadata
- Download URL: metamaker-0.1.0-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
poetry/1.1.11 CPython/3.8.2 Linux/5.11.0-1020-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3a8e4c6fa9ecd4edf473373eba1131e9c9854a42009f7f9f8070bc39bafb61e
|
|
| MD5 |
219c8a53e398a867a02f62eb49a1461b
|
|
| BLAKE2b-256 |
200ee1e4cc1107675c766f121e9be3cfe64fc9bafd98c440938bd5e7590cf85b
|