Lab
Your computer, ready for your lessons
Python cells run in your browser (Pyodide: NumPy, SciPy, scikit-learn, pandas, matplotlib, SymPy) or in your local lab with PyTorch and your GPU to train real networks.
Local lab
Local lab not connected“Local GPU” cells (PyTorch, CUDA, gymnasium...) require the lab to be running.
- In a terminal, in the project folder:
npm run lab - Open the connection link it prints (only the first time in each browser). It is saved in this browser.
- The “Local GPU” indicator in the header turns green.
Connect manually
Check your GPU
import torch, platform
print("Python", platform.python_version(), "| PyTorch", torch.__version__)
print("CUDA available:", torch.cuda.is_available())
if torch.cuda.is_available():
p = torch.cuda.get_device_properties(0)
print(f"GPU: {p.name} | {p.total_memory / 2**30:.1f} GB | capability {p.major}.{p.minor}")
a = torch.randn(4096, 4096, device="cuda")
torch.cuda.synchronize()
import time; t = time.time()
for _ in range(20): b = a @ a
torch.cuda.synchronize()
print(f"matmul 4096x4096: {20 * 2 * 4096**3 / (time.time() - t) / 1e12:.1f} TFLOP/s (fp32)")This cell needs the local lab (PyTorch with your GPU). Start it with
npm run lab and open the connection link.Scratchpad
Use these cells to try ideas. Code is not saved.
import numpy as np
rng = np.random.default_rng(0)
A = rng.normal(size=(3, 3))
np.linalg.svd(A, compute_uv=False)import torch
x = torch.randn(3, 3, device="cuda" if torch.cuda.is_available() else "cpu")
x @ x.TThis cell needs the local lab (PyTorch with your GPU). Start it with
npm run lab and open the connection link.