Skip to main content

MLSTAC logo

MLSTAC

Machine learning model sharing, built on the STAC MLM extension and Safetensors.

PyPI version Python versions Tests License Documentation


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)

Source distribution for mlstac 0.4.9
File Size Uploaded
mlstac-0.4.9.tar.gz 14.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mlstac 0.4.9
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.4.9 This release

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.7

2 release files

0.3.5

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.23

1 release file

0.0.22

1 release file

0.0.21

1 release file

0.0.20

1 release file

0.0.19

1 release file

0.0.18

1 release file

0.0.17

1 release file

0.0.16

1 release file

0.0.15

1 release file

0.0.14

1 release file

0.0.13

1 release file

0.0.12

1 release file

0.0.11

1 release file

0.0.10

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

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