ConceptStablesince v0.4.0

Environment

The captured runtime — OS, Python, wheel versions, BLAS provider, accelerator, and seeds — as a first-class, hashable object.

Audience: All usersRead: 6 minEdit on GitHub

An Environment object records the runtime facts that materially affect numeric output. It is captured once at the top of a script or notebook, fingerprinted, and embedded in every artifact produced from that point on.

Why capture an environment

The same code on the same model can produce different activations across framework upgrades, BLAS providers, and accelerators. Capturing the environment turns that variance from an invisible source of drift into a checkable field.

What is captured

·yaml
python: 3.11.7
os: linux-6.5.0-generic-x86_64
libc: glibc-2.38
torch: 2.3.1+cu121
numpy: 1.26.4
blas: openblas-0.3.27
cuda: 12.1.1
driver: 550.90.07
device: NVIDIA A100-SXM4-40GB
seed: ns:global:2718281828

Deliberately excluded

  • Wall-clock time, hostname, and username — they do not affect numeric output.
  • Installed but unused packages — the capture only records loaded modules.
  • The current working directory — it is captured only when a config file references relative paths.

Seeds

Seeds live inside the environment. ns.Environment.current() reads the process seed and any framework-specific seeds, and re-applies them on every experiment start.

Pitfalls

  • Upgrading PyTorch across a minor version changes the environment fingerprint even if your code is identical.
  • Switching between OpenBLAS and MKL changes the environment fingerprint — matmuls are not bit-identical across BLAS backends.
  • Running under torch.compile creates a new fingerprint every time the compile cache is invalidated.
Related