Factordocs

Quick start

From nothing to a finished GPU run, in about five minutes.

Five steps. At the end you will have run a script on a real GPU and pulled the result back to your machine.

Install the CLI

brew install --cask feweir/tap/factor

Not on macOS, or no Homebrew? See installing the CLI for the script, Scoop and the direct downloads.

Sign in

factor auth login

Your browser opens, you approve, and the token is written to ~/.factor/credentials. The token never travels through the URL bar — the page hands it back to a listener on your own machine, because anything in a query string ends up in browser history and proxy logs.

Check it worked:

factor auth status

Write something to run

Anything that runs on Linux. A single file is enough.

train.py
import torch print("device:", torch.cuda.get_device_name(0)) x = torch.randn(8192, 8192, device="cuda")for step in range(5):  x = x @ x.T / 1e4  print(f"step {step}: {x.mean().item():.6f}", flush=True) with open("/factory/out/result.txt", "w") as f:  f.write("done\n")

Two things worth knowing now, because they are the two questions everybody has on their first run:

  • Print as you go. Output is streamed back live. flush=True in Python, or -u, or you will see nothing until the process exits.
  • Write results to /factory/out. Anything left there is collected when the run ends. Anything written elsewhere is gone by the next run.

Run it

factor sandbox train.py --gpu 24gb-class --stream

The folder is uploaded, a machine is rented, your script runs, and the output comes back to your terminal. --stream keeps the terminal attached until it finishes; without it you get an id back straight away and can follow along with factor logs.

Take the results

factor pull fac_01M0AM8702EJN8VV2QPQGQ55SJ

Everything the run wrote to /factory/out lands in your current directory.

What just happened

The machine is already gone. A sandbox exists for exactly as long as your script does, so billing stopped when the script exited — there is nothing to remember to shut down, which is the entire point of the shape.

factor list          # what has run, and what is running nowfactor billing balance   # what it cost

Next