# `code/` — the scripts, as run | file | what it does | |---|---| | `build310.py` | **The working environment builder.** Installs a real Python 3.10 (deadsnakes), builds the venv from `/usr/bin/python3.10`, installs torch 2.4.1, the repo, PyG, both CUDA extensions, DA3 and nvdiffrast, then **verifies by import**. Everything in one container. | | `ctrl_guided.py` | **The control.** Waits for the stack to be ready, then runs `guided=default` on Surflo's own real photos (`Surflo/media/sample/`). Run this *before* judging anything. | | `modal_surflo_slim.py` | The main Modal module (kept under ~15 KB — see pitfall 9). Functions: `setup`, `probe`, `fetch_weights`, `infer`, `shrink`, plus local entrypoints. | | `mksheet.py` | In-container PLY → JPEG contact-sheet shrinker. Reads a PLY, validates `declared * stride == body_bytes`, writes `small.ply` + `sheet.jpg` + `STATS.txt`. Needed because artifact transfer is ~1 KB/s. | | `render_anime_views.py` | The Blender orbit renderer that produced the 32 input views. Drives the **live Blender GUI** over the blend-ai socket (`127.0.0.1:9876`), not headless. | ## Order to run things ```bash # 1. environment (one container, one function) — this is the long one python -m modal run --detach code/build310.py # 2. THE CONTROL — never skip, never substitute python -m modal run --detach code/ctrl_guided.py # 3. your own data python -m modal run code/modal_surflo_slim.py::infer_anime \ --mode guided --preset default --n-images 32 --points 100000 --tag myrun ``` ## Notes on the scripts - `build310.py` writes its log to `/vol/build310.txt` **after every step**, so if the container dies you can still see how far it got. - `ctrl_guided.py` polls for a working stack before running, so it is safe to launch immediately after `build310.py`. - `modal_surflo_slim.py` is deliberately stripped of comments and docstrings — a `modal run` module must stay under ~15 KB or the mount fails with `StreamTerminatedError('Connection lost')`. - Every script unsets `PYTHONPATH` before running anything. Do not remove that.