Metadata-Version: 2.5
Name: workbox
Version: 0.2.3
Summary: Workbox: SSH into your GPU boxes, log metrics and samples from training jobs, and serve what they train.
Classifier: Environment :: Console
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# workbox

The Python package for Workbox: GPU boxes with Jupyter, VS Code, a terminal
and SSH, and training jobs that keep everything they make.

```bash
pip install workbox        # or: uv tool install workbox
```

It has no dependencies, and works on Python 3.10 and later.

## SSH into your boxes

Sign in once on each computer. It opens your browser to approve the computer, makes a key for Workbox and adds
`Host *.workbox` to `~/.ssh/config`:

```bash
workbox login --url https://your-workbox
```

Then connect to a running box by its name, from the terminal or from your editor:

```bash
workbox boxes                # your boxes and their names
workbox ssh tinystories      # or: ssh tinystories.workbox
scp data.csv tinystories.workbox:~/work/
```

In VS Code or Cursor, use Remote-SSH and connect to `tinystories.workbox`. A running job's machine is
`<project>-job-<number>.workbox`, for example `workbox ssh tinystories-job-42`.

Each connection gets a certificate for that one box, valid for 12 hours, and a one-use pass through the box's HTTPS
port. No port is left open and no key stays on the box. `workbox logout` signs the computer out; you can also sign
computers out from your account in Workbox. You need OpenSSH (`ssh` and `ssh-keygen`), which macOS, Linux and
Windows 10 or later have.

## Metrics and samples from your training code

```python
import workbox

workbox.log(step=step, loss=loss, lr=lr)       # live charts on the job's page
workbox.sample(step=step, text=story)          # or image="plot.png", or a PIL image
```

Inside a Workbox job these are reported as the job runs. Anywhere else (your laptop, Colab) they do nothing, so the
same code runs everywhere. They never raise: a training run never fails over a chart.

## Describe the model

```python
workbox.describe(model, context=1024, layers=12, tokenizer="GPT-2")
```

Its parameters are counted from the model (PyTorch, Keras or JAX), and shown on the job's page with the rest.

## Serve what a job trained

```python
import workbox

def generate(prompt, max_tokens, temperature, top_p, stop):
    yield from model.stream(prompt, max_tokens, temperature, top_p)

workbox.serve(generate, context=2048, count=tokenizer.count)
```

Name the script in `workbox.yaml` (`serve: python serve.py`), and the job's **Chat** talks to the model on the same
GPU, with its conversations kept and their context managed for you.

## What else is in it

The same package runs inside every Workbox image: `workbox-runner` runs a job and reports to Workbox, and
`workbox-box` runs a box (its gateway, tools and SSH). You don't run those yourself.
