Using the CLI
Every command, what it does, and when you want it.
factor --help lists everything, and every subcommand takes --help too.
This page is the tour.
Two conventions worth knowing before the list:
--jsonon any command that prints something. Machine-readable output, and it suppresses the update notice so a pipeline never sees it.- Getting a command or a flag wrong prints the correct usage, not just the error. You do not have to go and look it up.
Running work
factor sandbox train.py --gpu 24gb-class --stream # run, then suspend for the next runfactor deploy # bring up a factory that staysfactor shell fac_01M0AM… # interactive shell on a factory| Command | What it does |
|---|---|
factor sandbox <file|folder> | Uploads and runs on a rented GPU. When the script exits the machine is suspended, and the next identical run reuses it. --delete-on-finish deletes it instead; --fresh never reuses. |
factor deploy [factory.yaml] | Brings up a factory from a manifest. Stays up between runs. |
factor shell <id> | An interactive shell on a running factory. |
factor stop <id> | Suspends a factory. /workspace survives; billing for compute stops. |
factor start <id> | Resumes a suspended factory with /workspace intact, or runs a suspended sandbox's last job again. |
Anything after -- is passed to your program rather than read by the CLI:
factor sandbox train.py -- --epochs 50 --lr 3e-4Watching and collecting
factor list # what is running, and what has runfactor info fac_01M0AM… # one machine's details and public addressesfactor logs fac_01M0AM… -f # follow the outputfactor pull fac_01M0AM… # download whatever the run wrote to /factory/outfactor rm fac_01M0AM… # terminate, permanentlyfactor list hides terminated machines by default, because after a month of
work there are hundreds of those and one you care about. --all shows
everything.
Choosing hardware and where it runs
factor hardware # every GPU available, cheapest firstfactor zones # where work can runfactor sandbox train.py --gpu 24gb-class # the cheapest card with 24 GB+factor sandbox train.py --gpu 24gb-class:2 # twofactor sandbox train.py --gpu a6000 # one RTX A6000, by namefactor sandbox train.py --zone eu # keep it in EuropeAsking for a class rather than a model is usually cheaper and usually what you meant — see choosing hardware.
Choosing an image
factor images # every published image, and its sizePass the NAME column to -i. It works the same on sandbox and on deploy,
where it overrides whatever the manifest says:
factor sandbox train.py -i python # 103 MB, and it runs GPU workfactor sandbox serve.py -i server # FastAPI and uvicorn includedfactor deploy -i pytorch # override the manifest for one deployfactor sandbox train.py -i ghcr.io/you/your-image:v1You do not need a CUDA image to use a GPU: PyTorch and JAX ship their CUDA
libraries inside their own wheels. Naming nothing gets you python.
Which image, and why.
Secrets
printf '%s' "$HF_TOKEN" | factor secret set HF_TOKENfactor secret listfactor sandbox train.py --secret HF_TOKENThe value is read from stdin, never from an argument. An argument is visible in your shell history and in the process list to every other user on the machine. More on secrets.
Money
factor billing plan # plan, limits, and how long credit lastsfactor billing verify # verify a card — nothing is chargedfactor billing topup 25 # add credit (minimum $10)factor billing balance # balance, and what this period has costfactor billing transactions # every charge and paymentfactor billing spend-cap 200 # stop everything past $200 this monthfactor billing upgrade pro # a paid plan; --yearly for two months freefactor billing manage # change or cancel a plan, and get invoicesfactor stats # what you spent, and how reliably it ranA card has to be verified before the first machine starts. Nothing is charged for it, and it adds $5 of compute. Credit is prepaid, so a machine is only started when the balance covers at least half an hour of it — and when the balance reaches zero, factories are suspended with their disks kept rather than destroyed. How billing works.
Teams and access
factor team list # the teams you belong tofactor team use acme # sign in again, for a different teamfactor tokens create --name ci # a token for a build serverfactor tokens listfactor tokens revoke tok_…Everything you run belongs to the team you are signed in for, and is billed to
it. factor auth status says which one that is.
When something is wrong
factor logs <id> # what the run actually printedfactor list --all --json # exact states, for a script or a bug reportA failed run keeps its logs and its exit code. Terminating it with
factor rm throws both away, so read them first.
Defaults
factor config stores defaults in ~/.factor/config.json. A flag always
wins over a default.
factor config set delete-on-finish on # delete sandboxes when they finishfactor config get delete-on-finishfactor config unset delete-on-finish # back to suspending themfactor config list| Setting | Values | Default |
|---|---|---|
delete-on-finish | on, off | off: a finished sandbox is suspended for the next run |