borch

Workbench

One call that trains on a folder of images

torch.workbench is a recipe, not a torch name — it sits one level in so that is visible. Hand it a folder: it reads the labels off the file names, trains, scores every label by how much the model doubts it, and hands back an ONNX file. The images stay in the tab. It is what the marimo notebook runs, and you can call it yourself in either notebook on this site.

Open it on your own folder → Walk through it first →

Try it on your own folder

Five steps, no Python needed for any of them. What you need is a folder of images you already know the answers to. A few hundred is enough for the frozen-backbone path, which is the default; a thousand is comfortable.

  1. Name the files so the label is in front. Everything before the first _ is the label: ok_001.jpg, ng_002.jpg, crack_017.jpg. A zip of folders works too, and then the folder name is the label. Nothing else about the names matters.
  2. Open the page and wait about ten seconds. Python and the notebook are downloading into the tab. There is nothing to install and no account to make.
  3. Drop the folder in and press run (bottom right). The images are read in the tab and stay there — nothing is uploaded, and you can watch that in your browser's network panel.
  4. Read the review table from the top. It is sorted by how much the model disagrees with the label you gave, worst first. That is where your mislabels are: on a public set with 9 % of labels wrong, the first twenty rows are about two-thirds mislabels, against nine in a hundred if you had read in a random order.
  5. Take the model. The export button writes an ONNX file, which is the format ONNX Runtime reads on a phone, a server or a PC — it does not need borch or a browser afterwards.

Start at step 2 →

Nothing above is a screenshot of an ideal run: the same five steps are pressed nightly by tests/browser/marimo_probe.py on a real GPU, and that check refuses to report at all if the tab it opened has no GPU.

The same thing, called yourself

If you would rather write it, the five steps above are four lines. They run in either notebook on this site, and in any Pyodide.

import borch_webgpu as torch
s = torch.workbench.setup(files).fit()   # train on the folder
s.suspects()                             # the labels it doubts, worst first
s.onnx()                                 # take the model away

Everything below is what those four lines let you change, and what the review order is worth. The API reference →

The call

import borch_webgpu as torch          # or borch_cpu — same spelling, no device
wb = torch.workbench

s = wb.setup(files, val=0.2)         # train, holding a fifth back
print(s.accuracy, s.held_out)        # and what it was measured on
s.suspects()                         # the labels it doubts, worst first
s.onnx()                             # take the model away

Two more calls answer the question before that one — which backbone. wb.compare(files, budget_mb=60) trains every candidate that fits the budget and prints a board; wb.pick(files, at_least=0.9) returns the smallest one that clears a bar. Both mark the rows they cannot tell apart: with a hundred held out, two backbones four points apart are one result, and wb.resolution(held_out) says how far apart they would have to be before the difference is real. A board that hides that invites a decision the data does not support.

The same names are on both doors. borch_cpu has no nn and no autograd, so the frozen-backbone path runs there and the from-scratch CNN and the ONNX export do not — the surface is asked what it can do rather than what it is called, and a caller who wants the other path is told which door to open.

What it reads, and what comes back

Does the review order hold up

Every number above is held by a check that runs nightly — tests/review_eval.py and tests/seg_eval.py for the orders, tests/test_workbench.py for the recipe's 39 invariants, and tests/browser/marimo_probe.py for the whole path through a real tab, which refuses to report at all if that tab has no GPU.