Skip to main content

Local ML experimentation platform demo SDK and control plane

Project description

localml

CI

A local ML experimentation platform demo that runs entirely on an Apple Silicon workstation. It demonstrates the core architecture of a production ML platform at local scale: a Python SDK, framework adapters, experiment tracking, a model registry, artifact storage, evaluation jobs, and local model serving.

Status: early scaffold. Most components are stubs with coherent interfaces. See ROADMAP.md for what's planned and docs/design.md for the full software design document.

What's here

localml/
├── src/localml/          # Python SDK (`import localml as ml`)
│   ├── adapters/         # torch / jax / mlx / huggingface framework adapters
│   ├── client.py         # HTTPX client for the control plane
│   ├── config.py         # ~/.localml/config.toml handling
│   ├── exceptions.py     # typed SDK errors
│   ├── run.py            # run context manager
│   ├── types.py          # Run / ModelVersion / EvaluationJob / Deployment
│   └── cli.py            # Typer CLI
├── services/
│   ├── api/              # FastAPI control plane
│   ├── worker/           # Redis-backed evaluation worker
│   └── mlflow/           # MLflow tracking + registry image
├── docs/                 # Zensical documentation site and design document
├── docker-compose.yml    # Local stack: api, worker, postgres, redis, minio, mlflow, serving
└── tests/

Architecture (at a glance)

flowchart LR
    User[SDK / CLI / Notebook] --> API[FastAPI control plane]
    API --> MLflow[MLflow<br/>tracking + registry]
    API --> DB[(Postgres<br/>metadata)]
    API --> Store[(MinIO<br/>artifacts)]
    API --> Queue[Redis<br/>job queue]
    API --> Serving[Local inference<br/>Ollama / MLX]
    Queue --> Worker[Worker]
    Worker --> Store
    Worker --> DB

The control plane (Postgres) is the source of truth for platform metadata. MLflow holds experiment tracking state, MinIO holds artifacts, and Redis holds transient job state.

Quick start

1. Bring up the stack

cp .env.example .env
docker compose up -d

This starts Postgres, Redis, MinIO, MLflow, the FastAPI control plane, the worker, and a local serving runtime.

Service URL
Control plane http://localhost:8000
API docs http://localhost:8000/docs
MLflow UI http://localhost:5000
MinIO console http://localhost:9001

2. Install the SDK

uv sync           # or: pip install -e .

3. Run the example workflow

import localml as ml

ml.configure(api_url="http://localhost:8000", token="local-dev-token")

with ml.start_run(project="local-demo", config={"model": "tiny-llm"}) as run:
    ml.log_params({"batch_size": 4, "quantization": "4bit"})
    ml.log_metrics({"baseline_accuracy": 0.82})

    version = ml.huggingface.log_pretrained(
        name="tiny-assistant",
        model_dir="./models/tiny-assistant",
        metadata={"task": "chat", "runtime": "mlx"},
    )

    eval_job = ml.evaluate(
        model=version,
        dataset="datasets/eval.jsonl",
        metrics=["exact_match", "latency_p95"],
    )
    eval_job.wait()

    deployment = ml.deploy(model=version, target="local")
    print(deployment.predict({"prompt": "Explain model registries simply."}))

CLI

localml --help
localml projects list
localml runs get <run_id>

Development

Uses uv for Python and dependency management; uv.lock is canonical and CI runs with UV_FROZEN=true.

uv sync
pre-commit install

uv run pytest               # tests with coverage
uv run ruff check           # lint
uv run ruff format --check  # format check
uv run ty check src/        # type check
uv run zensical serve       # live-preview the docs

Docs are authored in docs/ and built with Zensical; docs.yml deploys them to GitHub Pages on every push to main.

Model lifecycle

created → candidate → staging → production → deprecated → archived
       ↘ failed (from candidate/staging)  ↘ archived (terminal)

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

localml-0.1.0.tar.gz (266.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

localml-0.1.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file localml-0.1.0.tar.gz.

File metadata

  • Download URL: localml-0.1.0.tar.gz
  • Upload date:
  • Size: 266.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for localml-0.1.0.tar.gz
Algorithm Hash digest
SHA256 985eea6f42bdedc88af654b662fbcd85a47232cd60a7151ddac0f19e15d78ede
MD5 1a2a67a2ea222a70e82c65e312f63af2
BLAKE2b-256 cccdab1095f7d01f1b1e3e052d9b7dc0d56b07f78da17fe00a199d81e72069cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for localml-0.1.0.tar.gz:

Publisher: release.yml on guenp/localml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localml-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: localml-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for localml-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66c07723a5a52c84faae6838381d076c075e7187a3b353e94101f6c1834a0a59
MD5 be34ba91a850581df317c89b7b4b2062
BLAKE2b-256 70acec764c039cb231925d145e2c881e9e1727251d5754653b691be69a4696c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for localml-0.1.0-py3-none-any.whl:

Publisher: release.yml on guenp/localml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page