Skip to content

Reproducibility API Reference

The kreview.reproducibility module records the provenance stamped into run artifacts — versions, seeds and environment — so a result can be traced back to the code and settings that produced it.

The one hand-maintained module

Every other module in kreview/ is generated from a notebook in nbs/. This one is edited directly; see the nbdev workflow.

For conceptual explanations, see:


kreview.reproducibility

Global reproducibility seeding for kreview.

Provides :func:seed_everything to set deterministic seeds across Python's random module and PyTorch (when available). NumPy randomness is intentionally not set globally — it flows through local random_state parameters in all kreview functions to avoid side effects on third-party libraries.

seed_everything(seed=42, deterministic=True)

Set seeds across Python and (optionally) PyTorch for reproducibility.

NumPy randomness is intentionally NOT set globally — it flows through local random_state parameters in all kreview functions to avoid side effects on third-party libraries.

Parameters:

Name Type Description Default
seed int

Integer seed value.

42
deterministic bool

If True, enable PyTorch deterministic mode (cudnn.deterministic=True, benchmark=False). Trades ~10–20 % GPU speed for bit-exact reproducibility. Default True.

True

Returns:

Type Description
int

The seed that was set (for logging/provenance).