trinity.floorplanis the problem: instances, data loaders, geometry, the FloorSet checker and the soft metrics, the legalizer, rendering. It knows nothing about models.- The rest of
trinityis the method: it turns an instance into conditioning, samples a layout, refines it and hands it totrinity.floorplanfor legalization and scoring. trinity_baselinesholds every baseline and is never imported bytrinity, except lazily when a training config names a baseline backbone.
Every swappable component is a class registered under a string key and built from a spec:
a key, a dotted import path, or {"name": key, **kwargs}.
from trinity.registry import SAMPLER, build
sampler = build({"name": "euler", "num_steps": 32}, SAMPLER, framing=framing)build runs once, when a script or trainer is set up; the built object is called directly
afterwards. Configs therefore select variants by name, and a new variant is a new registered
class.
| registry | keys | file |
|---|---|---|
GRAPH_PE |
none, rwpe, spectral_draw |
trinity/conditioning/graph_pe.py |
ATTENTION |
sdpa, sdpa_graph, flex_graph, ... |
trinity/models/components/attention.py |
TIME_COND |
token, adaln, adaln_shared, additive |
trinity/models/components/time_cond.py |
GRAPH_MIX |
none, mp (the info-mover residual) |
trinity/models/components/graph_mix.py |
LATENT_PARAM |
s_only |
trinity/latent_param.py |
FRAMING |
rectified_flow, ddpm_x0, ddpm_eps, ddpm_v, gvp, ... |
trinity/framing/standard.py |
TIME_SAMPLER |
uniform, logit_normal |
trinity/framing/time_sampler.py |
LOSS |
denoise, the six constraint terms, ref_* |
trinity/losses/ |
SAMPLER |
euler, heun (euler_guided in the baselines) |
trinity/sampling/ode.py |
PROJECTION |
anchor_clamp, mib_group_mean |
trinity/sampling/projection.py |
REFINER |
closed, constraint_latent |
trinity/sampling/refine_*.py |
LEGALIZER |
scale_pack |
trinity/floorplan/legalize/scale_pack.py |
SCORER |
full, full_fast, continuous, stub |
trinity/floorplan/scoring/ |
- Instance —
trinity.floorplan.types.FloorplanInstance(areas, constraint columns, netlist, pins), fromtrinity.floorplan.data. - Conditioning —
trinity.conditioning: per-block features, the anchors of fixed and preplaced blocks, the netlist adjacency (build_adjacency) and the graph PE. - Latent — per block
(cx/s, cy/s, ρ);trinity.decode.z_to_xywhturns it into boxes with exact areas. - Denoiser —
trinity.models.backbone: a set transformer over block tokens with the netlist as an attention bias (trinity/models/block.py,graph_bias.py). - Sampling —
trinity.sampling.ode: the probability-flow ODE of the framing, with the state projections (sampling.md). - Refining —
trinity.sampling.refine_closed: the hand-written gradient of the six terms (refiner.md). - Legalizing and scoring —
trinity.floorplan.legalize.legalizeandtrinity.floorplan.scoring.validate(legalizer.md).
trinity.solver.DiffusionPlacer runs steps 2–7 over a batch of instances;
trinity.hub.load_model(...).placer() builds one from a released model.
trinity.training.DiffusionTrainer (a Lightning module) draws t from the time sampler,
noises the latent with the framing, and sums the registered loss terms on the prediction
(trinity/losses/). trinity.data provides the dataset over the Lance training set, the
batching (same_n / pad_to_max) and the dev split; trinity.augment_ops the augmentation.
The training script scripts/train/diffusion.py builds both from its config
(training.md).
tests/ holds equivalence checks (the closed-form refiner against autograd, the fast scorer
against the reference checker, the batched graph PE against the per-instance one), invariance
checks (padding), and end-to-end runs of the trainers, the placers, the legalizer and the
classic solvers. Tests that need FloorSet or a PARSAC build are skipped when it is absent.