Skip to main content

Python SDK for the Yarn sovereign AI platform

Project description

yarn-au

Python SDK and CLI for Yarn, a sovereign AI compute platform with Australian data residency.

Install

pip install yarn-au
yarn login

Training script

Yarn uses three decorators to turn a standard PyTorch script into a submittable job. The same file runs locally with no changes.

import torch.nn as nn
from torch.optim import Adam
from torch.utils.data import TensorDataset
import yarn.train as yt

@yt.model
def create_model():
    return nn.Sequential(nn.Linear(784, 256), nn.ReLU(), nn.Linear(256, 10))

@yt.dataset(batch_size=128, shuffle=True)
def load_data():
    return {"train": TensorDataset(...), "val": TensorDataset(...)}

@yt.job
def train(model, data):
    model = yt.prepare(model)
    opt = Adam(model.parameters(), lr=1e-3)
    loss_fn = nn.CrossEntropyLoss()

    for epoch in range(yt.start_epoch, 10):
        for x, y in data["train"]:
            loss_fn(model(x), y).backward()
            opt.step(); opt.zero_grad()
        yt.report(epoch=epoch)
        yt.checkpoint(model, opt, epoch=epoch)

Pre-flight check

--dry-run analyses your script without submitting:

$ yarn job submit train.py --gpu rtx-4090 --dry-run

Model          3 layers, 203,530 params
Memory         weights 0.78 MB | grads 0.78 MB | optimizer 1.55 MB | activations ~2.1 MB
Total          ~5.2 MB (RTX 4090: 24,576 MB available)
Fit            YES — 0.02% VRAM utilised
Cost           ~$0.12/hr × 10 epochs ≈ $0.03 estimated

CLI quickstart

yarn login                              # authenticate
yarn job submit train.py --gpu rtx-4090 # submit a job
yarn job submit train.py --dry-run      # analyse without submitting
yarn job logs <job-id>                  # stream logs
yarn job list                           # list all jobs

yarn session create --gpu rtx-4090      # interactive GPU session
yarn models                             # available models
yarn gpus                               # GPU types and pricing
yarn balance                            # credit balance
yarn storage upload data/ /datasets/    # upload data
yarn storage download /results/ ./      # download results
yarn storage list /datasets/            # list remote files

Both yarn and yarn-au work as CLI entry points.

Decorator API

Decorator / function Purpose
@yt.model Wraps a function returning nn.Module
@yt.dataset(batch_size, shuffle) Wraps a function returning dict[str, Dataset]
@yt.job(epochs=N) Wraps the training function; receives (model, data)
yt.prepare(model) Device placement and distributed wrapping (DDP/FSDP)
yt.data(loader) Prepare DataLoader for distributed training
yt.report(**metrics) Log metrics to Yarn
yt.checkpoint(model, opt, epoch=N) Save a resumable checkpoint
yt.load_checkpoint(model, opt) Restore from latest checkpoint
yt.start_epoch Epoch to resume from (0 if fresh)

Requirements

  • Python >= 3.10
  • Dependencies: requests, click

Documentation

Full docs at docs.yarn.prosodylabs.com.au.

License

Proprietary. Copyright 2025-2026 Prosody Labs Pty Ltd.

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

yarn_au-0.1.6.tar.gz (85.7 kB view details)

Uploaded Source

Built Distribution

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

yarn_au-0.1.6-py3-none-any.whl (49.5 kB view details)

Uploaded Python 3

File details

Details for the file yarn_au-0.1.6.tar.gz.

File metadata

  • Download URL: yarn_au-0.1.6.tar.gz
  • Upload date:
  • Size: 85.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.5

File hashes

Hashes for yarn_au-0.1.6.tar.gz
Algorithm Hash digest
SHA256 849df5a8287ccbba75c0840c984cd2db8c4a72a31ad21559e396cbcf65affd08
MD5 bdcaab92561741bd3b275820a78c701c
BLAKE2b-256 704cbb44abb19e067885eb21fa1c2bee6ad4bde37595c07935d73693c962aa58

See more details on using hashes here.

File details

Details for the file yarn_au-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: yarn_au-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 49.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.5

File hashes

Hashes for yarn_au-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5be4704d425a7f5a27155af43b29a0be2f726f955f2a67f51be5a2196d6f46da
MD5 0030535ce37490b5cba9c287de6ccded
BLAKE2b-256 5fcb30e6fb6d3613bc74580736f4fee0e0d2ccf94c6cdb3fe5714adc1bc151d4

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