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.
Metadata
Release files for mlstac 0.4.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mlstac-0.4.9.tar.gz | 14.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mlstac-0.4.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.7 kB
Release files / mlstac-0.4.9.tar.gz
| Download URL | mlstac-0.4.9.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f1fc327e703c63429d03846ed4cdd365708aec89aecfa0c24085e745b40e593
|
|
BLAKE2b-256 checksum How to use checksums |
e97a6a27ea57039ed38187579b0c0ad676a4d8aae823eafb5e1381d5af9f152d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.12.13 Windows/11
|
Release files / mlstac-0.4.9-py3-none-any.whl
| Download URL | mlstac-0.4.9-py3-none-any.whl |
|---|---|
| Size | 15.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5758d4e1de03734aba540d5200ede73facf4286b838198b06dfe5495a4e4463d
|
|
BLAKE2b-256 checksum How to use checksums |
78d82246bb7178f78d9d4e23d1b6134fa999a16c314bd0b9ffc1a2331d8f84d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.12.13 Windows/11
|