Skip to content
Tutorials ▸

Reference

Running the PyTorch snippets

The tutorials need none of this. They run in the browser on NumPy and always will. This is only for the reference pages, where the point is the library itself.

Which one do you want?

Where Setup Cost Speed
In this page NumPy, not PyTorch. This is what every tutorial part uses. Already running Free 2.4 ms/step
Your own machine Needs Python and about 2 GB of disk. Safari cannot connect to it. pip install torch Free 0.5 ms/step
A deployed runner Works from a Chromebook, an iPad, or a locked-down work laptop. One Dockerfile ~$5/month not measured

Those two figures are measured, on one training step of the transformer the later parts build — same code, same size, both places. Your own machine wins, and it is free. If you can install Python, install Python.

The deployed row says not measured because it is not. It depends on the container you rent, and I am not going to put a number next to the option I am paid to recommend without having run it. Expect somewhere between the other two: native PyTorch, on a CPU that is probably slower than your laptop's.

Do you need a GPU?

No, and paying for one here would be worse than not. The model in these tutorials has a few thousand parameters. Moving numbers to a graphics card and back costs more time than arithmetic at that size saves, so a GPU is slower for this and bills by the hour for the privilege.

That changes the moment you train on real text at real width, which is past where this tutorial stops. Until then, a $5 CPU container is the whole of what is worth renting.

Running it on your own machine

Two commands, and nothing leaves your laptop.

curl -O https://learn.welldun.ai/runner/welldun_runner.py
pip install torch
python welldun_runner.py

It prints a URL with a token. Paste that into any reference page and the Run buttons come alive. The runner binds to 127.0.0.1, so nothing outside your machine can reach it.

Deploying one instead

Worth it if you cannot install Python where you are reading — a work machine you do not control, a Chromebook, an iPad — or if you would rather not install PyTorch at all. It is also the only option that works in Safari.

Railway builds the Dockerfile in public/runner/ straight from a fork of this repository. New Project → Deploy from GitHub repo → set the root directory to public/runner, then add one service variable before the first deploy:

WELLDUN_TOKEN=<a long random string of your own>

The runner refuses to start on a public address without it. Connect with your service's URL and ?token= plus what you chose.

What you are agreeing to

The runner executes whatever the page sends it. That is the feature, and it is worth reading the file — it is one page of standard library — before you run it.

  • Locally, it runs as you, on your files. Stop it when you are done.
  • Deployed, it is an endpoint on the public internet that runs arbitrary Python, and the token is the only thing in front of it. Anyone who gets that token can run anything on your bill — and mining or reselling compute is exactly what Railway's fair-use policy prohibits, so it would be your account that answers for it. Keep the token out of screenshots, and delete the service when you finish.

The page will not connect to anything but your own machine without asking you first, by name, and will not accept a runner address over plain http. Neither of those is paranoia: a connect URL is a thing somebody could hand you.