A machine learning model-sharing specification based on STAC MLM and Safetensors.
Project description
MLSTAC
Machine learning model sharing, built on the STAC MLM extension and Safetensors.
Overview
MLSTAC gives you a single, consistent way to publish and consume machine learning models. Each model is described by a STAC Item using the MLM extension, and its weights travel as Safetensors. From that metadata you can load a model from many backends (HTTP, local disk, S3, Google Cloud Storage), download it, inspect it, and turn it into a usable PyTorch model.
Status: experimental. The API may change between minor versions.
Installation
pip install mlstac
Quickstart
import mlstac
# Load only the metadata first (no weights are downloaded yet)
model = mlstac.load("https://example.com/my-model/mlm.json")
# Inspect what you have
print(model.get_model_summary())
model.print_schema()
# Download every file into a local folder; you get back a loader
# pointing at the local copy
local = model.download("./my-model")
# Build a usable model from the local files
net = local.compiled_model()
Loading from different sources
mlstac.load is the main entry point. It accepts a URL, a local path, or a list of
.pt2 files for an ad-hoc ensemble.
# Remote metadata
mlstac.load("https://example.com/model/mlm.json")
# A local directory that contains an mlm.json
mlstac.load("./my-model")
# An ensemble built directly from .pt2 files
ensemble = mlstac.load(["model_a.pt2", "model_b.pt2"])
ensemble.is_ensemble # True
Downloading
You can download from the loader instance, or call the module-level function directly.
# From an existing loader (reuses the source it was created from)
local = model.download("./my-model")
# Or as a one-shot call
local = mlstac.download("https://example.com/model/mlm.json", "./my-model")
Supported backends
| Scheme | Example |
|---|---|
http / https / ftp |
https://example.com/model/mlm.json |
local |
./my-model or /abs/path/mlm.json |
s3 |
s3://bucket/key/mlm.json (needs boto3) |
gs |
gs://bucket/key/mlm.json (needs google-cloud-storage) |
Documentation
Full docs live at tacofoundation.github.io/mlstac.
Development
# install with dev dependencies
poetry install --with dev
# run the test suite
poetry run pytest tests/ -v
License
See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
File details
Details for the file mlstac-0.4.8.tar.gz.
File metadata
- Download URL: mlstac-0.4.8.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.1 CPython/3.12.13 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c5cc85fdf3a448388b1bee5c76ef58858da37c6f7fdd434625b5de61e4f7d9cb
|
|
| MD5 |
6a70e0ee74a0552932314b7c63c48408
|
|
| BLAKE2b-256 |
bb2887650cae9cd71419602e8542fac84ef91f450953405db0ec6363ab17ccfc
|
File details
Details for the file mlstac-0.4.8-py3-none-any.whl.
File metadata
- Download URL: mlstac-0.4.8-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.4.1 CPython/3.12.13 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7813920136645b724ad99d3cd6e31bb3d15b3685b701aa8c081cd40681ed6e0
|
|
| MD5 |
3ab0c9752d3f8891294c11be8cc310d1
|
|
| BLAKE2b-256 |
6da9cb9e7d1fb5b95a86e19bdc616b3966ea30bc84cce1a768ae6a97eb680a4f
|