v0.1.2 — MIT License

From simulator
to trained model.

The adapter layer that bridges your physics simulator and a Dreamer-inspired world model adapter. One library. No boilerplate. One afternoon.

Open in Colab Documentation Domain Scientists →
$ pip install physlink
Versionv0.1.2
LicenseMIT
Python≥ 3.10
BackendDreamer-RSSM
ColabReady
Formatsafetensors
Architecture

One library.
Two worlds connected.

A thin but complete adapter layer. All the plumbing between the physics world and the RL world — so you focus on the science.

Six primitives

Everything you need.
Nothing you don't.

Six focused APIs that eliminate every friction point between your physics data and a validated world model.

$ physlink.doctor()
 
Python 3.11.2     ✓ OK  |  PyTorch 2.3.0   ✓ OK
CUDA 12.1        ✓ OK  |  VRAM 14.8 GB   ✓ OK
Session ~8h      ✓ OK
→ GO — world model ready · T4 GPU · ~8h remaining
Zero-friction diagnostics

One call before training — not after the crash. Scans Python, PyTorch, CUDA, VRAM, and Colab session time in parallel. Returns a Go/No-Go verdict with one actionable fix per failed check.

<15sverdict
5checks
1 fixper failure
physlink.doctor() # → GO ✓ | T4 · 14.8 GB · ~8h left
ObsSpace joint_pos × 7joint_vel × 7 dim: 14 ✓ validated ActSpace dims: 7bounds [-1, 1] validated ✓
Universal Space API

Define observation and action spaces in one line. Dimension mismatches surface at creation time, not at step 8 000. Each space exposes .explain() with normalization metadata.

ObservationSpace.from_proprioception(
  joints=7, include_velocity=True
)
1k steps ckpt ✓ 2k steps ckpt ✓ 3k steps ckpt ✓ disconnect resume
Auto-checkpoint

Safetensors checkpoint every N steps, metadata embedded. Colab session disconnects mid-run? Load the last checkpoint in one call and continue — no manual hunt for your save file.

adapter.fit(traj, steps=10_000)
# → step_1000.safetensors saved
limit PASS — 0 violations / 1000
Physical compliance

Register invariants — energy conservation, joint limits, torque bounds — as plain Python callables. Hard mode rejects invalid trajectories before they corrupt training. Structured reports per trajectory.

physlink.register_invariant(
  adapter, "energy", fn=energy_fn,
  tolerance=0.05, mode="hard"
)
Imagination Real Difference
Triptych visualization

Three-panel GIF renders inline in Colab under 10 seconds — Imagination, Real trajectory, and their Difference. Debug world-model hallucinations without leaving your notebook.

adapter.visualize(trajectories)
# → triptych.gif renders inline
DreamerV3 Adapter fitted ✓ wraps WMEL encode() plan() WMEL bench
WMEL evaluation bridge physlink[eval]

Evaluate your trained adapter against the world-model-eval-lab harness. DreamerWMELAdapter implements random-shoot MPC in latent space — plug it directly into any WMEL BenchmarkEnvironment.

from physlink.adapters.wmel_bridge import (
  DreamerWMELAdapter
)
bridge = DreamerWMELAdapter(adapter, n_candidates=100)
# → BenchmarkRunner-ready PlannerPolicy
Quick start

Six steps.
Full pipeline.

From a blank Colab session to a validated, exported adapted model.

quickstart.py
import physlink

# 1 — Verify environment (15 seconds)
physlink.doctor()

# 2 — Define robot spaces
obs = physlink.ObservationSpace.from_proprioception(
    joints=7,
    include_velocity=True,
)
act = physlink.ActionSpace.continuous(
    dims=7,
    bounds=(-1.0, 1.0),
)

# 2b — Validate trajectory quality
schema = physlink.TrajectorySchema(obs_dims=obs.dims, act_dims=act.dims)
report = batch.quality_report(schema)  # → PASS / WARN / FAIL per check

# 3 — World model adapter
adapter = physlink.DreamerV3Adapter(obs, act)
adapter.fit(trajectories, steps=10_000)

# 4 — Register invariant & validate
physlink.register_invariant(
    adapter, "energy",
    fn=lambda traj: compute_energy(traj),
    tolerance=0.05,
)
report = adapter.compliance_report()
report.plot()

# 5 — Visualize & export
adapter.visualize(trajectories)
adapter.export("./run-2026/")
physlink.doctor()
Python 3.11.2  OK  |  PyTorch 2.3 OK
CUDA 12.1    OK  |  VRAM 14.8 GB OK
Session ~8h  OK
──────────────────────────────
→ GO — world model ready · T4 GPU · ~8h remaining
adapter.fit() progress
Step 1000/10000  ETA 38m
Throughput: 12.4 step/s
checkpoint → step_1000.safetensors
report.summary()
energy: PASS
max_residual=0.031, threshold=0.05
violations=0/1000
adapter.export()
triptych.gif
config.yaml
checkpoint_final.safetensors
compliance_report.json
Time to Science

The hours you get back.

Measured time from clean environment to first validated adapted model.

TaskWithout PhysLinkWith PhysLink
Env diagnosticsDebug silent OOM at step 8 000physlink.doctor()
Validate trajectory data before trainingManual checks scattered across notebooksTrajectorySchema + batch.quality_report(schema)
Space definitionsWrite framework-specific mappings per adapterObservationSpace.from_proprioception()
Session disconnectLose 3h of T4 trainingOne-call checkpoint restore, no lost progress
Physics checkManually verify energy conservationcompliance_report()
Model diagnosisStare at loss curvesTriptych GIF — Imagination / Real / Diff
Total3–5 days1 afternoon

Start in Colab.
Free T4 GPU included.

No local CUDA setup. No conda environment. Open the notebook, select T4 runtime, run all cells.

  • 1
    Open the Colab quickstart notebook
  • 2
    Runtime → Change runtime type → T4 GPU
  • 3
    Run all — physlink.doctor() confirms readiness
  • 4
    Bring your trajectories. Adapt.
quickstart.ipynb
In [1]:
import physlink
physlink.doctor()
Out:
→ GO ✓ world model ready
T4 · 14.8 GB · ~8h remaining
In [2]:
obs = physlink.ObservationSpace.from_proprioception(joints=7)
In [3]:
adapter.fit(traj, steps=10_000)
Out:
Step 1000/10000 ETA 38m ✓ ckpt