Skip to main content

Lightweight ML pipeline library: configs, data modules, training engine, artifacts, and optional integrations.

Project description

SaltAI

SaltAI is a lightweight local-first ML pipeline library for reproducible experiments. It helps organize training runs, metrics, manifests, events, artifacts and checkpoints without forcing users to deploy a heavy MLOps platform.

About the library

SaltAI is designed to standardize the most common parts of ML and DL experiments.
The library gives you a simple run lifecycle, where each experiment has its own configuration, output directory, manifest, event log and optional checkpoints.

The main workflow looks like this:

config -> Runner -> Trainer -> metrics -> manifest -> events -> checkpoints -> resume

The project is focused on a library-first approach. You can use the core package locally, while cloud and external MLOps integrations can be added later as optional extensions.

Core features

  • Runner

    Runs the experiment body, creates the run directory, validates config, writes manifest.json, records events and collects returned metrics.

  • Trainer

    Provides a minimal framework-agnostic training and evaluation loop. It works with user-defined model adapters, data modules and metrics.

  • Run manifest

    Every run produces a manifest.json file with the run status, config hash, metrics, artifacts, checkpoints and resume information.

  • Events

    Structured events can be written to events.jsonl. This includes run, stage, epoch, step, metric and checkpoint events.

  • Artifacts

    Local artifacts can be stored through the artifact store. For example, SaltAI can store the event log as a run artifact.

  • Checkpoints

    SaltAI supports checkpoint saving through:

    • latest
    • best
  • Resume

    A run can be resumed from a saved checkpoint:

    runner.run(cfg, body=body, resume_from="latest")
    

Installation

1. Installation for local development

To install the library locally, clone the repository and install the package in editable mode:

git clone https://github.com/D1ffic00lt/salt-ai.git
cd salt-ai
git checkout dev
python -m pip install -e .

2. Requirements

SaltAI currently supports Python versions:

>=3.10,<3.13

The core library has no heavy ML framework dependency. You can connect your own model, data module and metrics through small protocol-like interfaces.

Quickstart

The minimal run can be written like this:

from saltai import Runner


class Model(object):
    def __init__(self):
        self.w = 1.0

    def state_dict(self):
        return {"w": self.w}

    def load_state_dict(self, state):
        self.w = float(state["w"])


cfg = {
    "run": {"id": "quickstart"},
    "seed": 42,
    "paths": {"root": "runs"},
}

runner = Runner(
    record_events=True,
    store_artifacts=True,
    enable_checkpoints=True,
)


def body(ctx):
    model = Model()
    model.w = 2.0

    ctx.io.save_latest(model, step=1)

    return {
        "loss": 0.1,
        "accuracy": 1.0,
    }


result = runner.run(cfg, body=body)

print(result.status)
print(result.metrics.values)
print(result.manifest_path)

After running this script, SaltAI creates a directory like this:

runs/
└── quickstart
    ├── manifest.json
    ├── events.jsonl
    ├── artifacts
    └── checkpoints

Resume from checkpoint

SaltAI can restore checkpoint payload before running the experiment body.

from saltai import Runner


class Model(object):
    def __init__(self):
        self.w = 0.0

    def state_dict(self):
        return {"w": self.w}

    def load_state_dict(self, state):
        self.w = float(state["w"])


cfg = {
    "run": {"id": "quickstart"},
    "seed": 42,
    "paths": {"root": "runs"},
}

runner = Runner(
    record_events=True,
    store_artifacts=True,
    enable_checkpoints=True,
)


def body(ctx):
    assert ctx.io.resume_ref is not None
    assert ctx.io.resume_payload is not None

    model = Model()
    model.load_state_dict(ctx.io.resume_payload["state"])

    return {
        "loaded": True,
        "w": model.w,
    }


result = runner.run(
    cfg,
    body=body,
    resume_from="latest",
)

print(result.metrics.values)

Full local example

The repository contains a complete local example with a tiny model, data module, metrics, training, evaluation, checkpoints, manifest and events.

python examples/full_local_run.py

The example demonstrates:

  • Runner.run
  • Trainer.fit
  • Trainer.evaluate
  • metric collection
  • ctx.io.save_latest
  • ctx.io.save_best
  • manifest.json
  • events.jsonl
  • checkpoint files

Public API

The main objects are available from the top-level package:

from saltai import (
    Runner,
    Trainer,
    RunContext,
    RunIO,
    RunId,
    RunResult,
    ArtifactRef,
    Checkpointable,
    DataModule,
    ModelAdapter,
    Metric,
    MetricPoint,
    MetricSummary,
    Logger,
)

Running tests

The project uses unittest.

python -m unittest discover tests

If you use Poetry:

poetry install
poetry run python -m unittest discover -s tests -p "test*.py" -v

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

salt_ai-0.1.2.tar.gz (37.8 kB view details)

Uploaded Source

Built Distribution

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

salt_ai-0.1.2-py3-none-any.whl (53.7 kB view details)

Uploaded Python 3

File details

Details for the file salt_ai-0.1.2.tar.gz.

File metadata

  • Download URL: salt_ai-0.1.2.tar.gz
  • Upload date:
  • Size: 37.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.6 Darwin/25.2.0

File hashes

Hashes for salt_ai-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5c9b704fe5b26e12465e0be66dbd4fc3e86b6cad37ec23dd36d23b0cc76e2c9d
MD5 d39b2ea60e34170fcbc2929fd5e4810d
BLAKE2b-256 3946deae6817367d30f5713bbb87285e24602a8587cf6d70bad97943807f8c3d

See more details on using hashes here.

File details

Details for the file salt_ai-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: salt_ai-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 53.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.6 Darwin/25.2.0

File hashes

Hashes for salt_ai-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a535c19f0a2261e8738b56c6451cebdfddd82e7a68f58e53e80564362f443b83
MD5 63ae84569dab9a75f5eb3e8273a0857c
BLAKE2b-256 5c5adea80a21335636b922527cb83207cf61e16ac62b0c507db0712b41c7ce7b

See more details on using hashes here.

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