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.8.tar.gz (103.6 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.8-py3-none-any.whl (58.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for yarn_au-0.1.8.tar.gz
Algorithm Hash digest
SHA256 ad62a038595c6901898b32e5d2c22053c6cfe4440e65e7554e9572ced40bd209
MD5 4d699bb05a73fd6eda7a4103a34ad92b
BLAKE2b-256 06d228d0054f236d5533b1df27efaef3c0716da076c18fcb32d8f87290fa8876

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for yarn_au-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 32fbaa3cbe42ae459c296a074e589d62cfb83ecb645996725605a1e61beddb24
MD5 8246c046e5f5ad46501950f94f3b7ba9
BLAKE2b-256 364608ab7820eecda1b91cf5484168364b295146b28c66a57f9e595776940f4c

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