Skip to main content

Python SDK and CLI for logging InstantML training runs, metrics, artifacts, and rich objects.

Project description

InstantML Python SDK

InstantML is a training-loop observability SDK for logging runs, scalar metrics, configs, tags, notes, artifacts, checkpoints, tables, histograms, media, and source context to an InstantML API.

python -m pip install instantml
python train.py
import instantml as im

run = im.init(project="llm-7b-sft", config=cfg)
checkpoint_policy = im.CheckpointPolicy(every_steps=500)

for step, batch in enumerate(loader):
    loss = train_step(batch)
    run.log({"loss": loss}, step=step)
    if checkpoint_policy.should_save(step):
        save_model("./ckpt/model.pt")
        run.log_checkpoint_file("./ckpt/model.pt", step=step)

run.finish()

By default the SDK talks to the hosted InstantML API at https://api.instantml.ai. Set INSTANTML_API_KEY (or pass api_key=) — that's all most users need. Override the base URL for local development or self-hosted deployments via INSTANTML_API_BASE_URL (or pass base_url=):

export INSTANTML_API_BASE_URL=http://127.0.0.1:8000
run = im.init(
    project="cartpole",
    base_url="http://127.0.0.1:8000",
    api_key="instantml_...",
)

The package also installs the instantml CLI for browser-based device login:

instantml login --api-host https://api.example.com
instantml whoami
instantml logout

The core package has no required third-party runtime dependencies. Optional extras are available for richer local conversions and system metrics:

python -m pip install "instantml[media]"
python -m pip install "instantml[system]"
python -m pip install "instantml[all]"

The SDK also ships a process-isolated spool uploader:

instantml-uploader --spool-dir .instantml/spool --base-url http://127.0.0.1:8000

Shadow Weights & Biases

If you're migrating from W&B and want to compare numbers side-by-side, pass shadow_wandb=True to init. Every log, finish, and log_artifact call is mirrored to a parallel wandb.Run, using your existing WANDB_API_KEY / WANDB_ENTITY env vars. wandb.init runs on a background thread so InstantML's init stays sub-millisecond.

run = im.init(project="llm-7b-sft", config=cfg, shadow_wandb=True)

Override the W&B project or entity independently:

run = im.init(
    project="llm-7b-sft",
    shadow_wandb={"project": "llm-experiments", "entity": "my-team"},
)

Attach to an already-initialized wandb.Run:

import wandb
wb_run = wandb.init(project="llm-7b-sft")
run = im.init(project="llm-7b-sft", shadow_wandb=wb_run)

If wandb is not installed or wandb.init fails, shadow logging is disabled with a warning and InstantML logging continues unaffected.

License

Apache 2.0 — see LICENSE. The InstantML hosted backend (dashboard, API, storage) is a separate commercial offering; the SDK in this package is open source.

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

instantml-0.1.0a1.tar.gz (39.8 kB view details)

Uploaded Source

Built Distribution

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

instantml-0.1.0a1-py3-none-any.whl (36.1 kB view details)

Uploaded Python 3

File details

Details for the file instantml-0.1.0a1.tar.gz.

File metadata

  • Download URL: instantml-0.1.0a1.tar.gz
  • Upload date:
  • Size: 39.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for instantml-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 665222d883385cc401b4e42e090a2a5eed48e1ee22fc9cf1aed4eb13afe90429
MD5 35b5e8afa0a448929c22c615e3719bde
BLAKE2b-256 34a40afaaf15c57de2a32e04b187f48c22c3511efd2a3d0c76a6a199e7f0abf8

See more details on using hashes here.

Provenance

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

Publisher: python-sdk-release.yml on InstantML/monorepo

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

File details

Details for the file instantml-0.1.0a1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for instantml-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 b571f3b801dbe83a6ce409705841f8d3ea4e4c7d79ea69e1b6c30ca04c5b6916
MD5 52fa07cb43d7be8794f57f16de469cc2
BLAKE2b-256 22bee25bb77a12c77ce128cd1b93d2e8a69f322096db72af7cd8cdd33e267771

See more details on using hashes here.

Provenance

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

Publisher: python-sdk-release.yml on InstantML/monorepo

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