Python API Reference
Source-driven signatures for Core primitives, evaluation contracts, runners, and runtime helpers.
On this page
The same contracts the CLI and Studio call. Each page pairs a short choice guide with signatures generated from source. Model-specific code, vendored upstream trees, and benchmark internals stay out of this reference.
Core
Shared attention, I/O, loading, distributed, configuration, and acceleration primitives.
- Core API guide
How to pick attention, loading, I/O, and acceleration APIs.
- Attention
SDPA dispatch, fused backends, RoPE, and KV cache.
apply_nd_rotary_embedding, apply_rotary_embedding +40
- Configuration
LazyConfig and deferred object graphs.
CheckpointConfig, Config +7
- I/O and media
Paths, URIs, images, video, and serialization.
checkpoint_root_path, coerce_video_frames +71
- Model loading
Checkpoints, state dicts, DiskMap, and construction.
assign_state_dict_strict, build_rename_dict +18
- Distributed
Collectives and context-parallel split/gather.
broadcast, broadcast_dtensor_model_states +18
- Inference runtime
Process setup, compile, timers, and realtime.
adaptive_batched_inference, autocast_context +38
- Neural net and math
Shared tensor transforms and math helpers.
attention_head_dim, causal_attention_mask +36
- Acceleration and memory
Caches, offload, VRAM, and kernels.
AdaptiveResidualCache, AutoTorchModule +24
- Foundations
Registries, utilities, and safety contracts.
as_list, batched_image_features +24
Evaluation
Serializable contracts, runners, metrics, orchestration, evidence, and runtime helpers.
- Contracts and artifacts
Artifact refs and generation request/result shapes.
ArtifactRef, enrich_artifact_ref +5
- Models and runners
World-model manifests, configs, and runners.
PipelineABC, WorldModelConfig +2
- Metrics and tasks
Metric specs, task configs, and benchmark contracts.
AggregateResult, BenchmarkSpec +5
- Runs and benchmarks
Run requests and the public benchmark facade.
benchmark_integration_spec, list_video_benchmarks +5
- Reporting
Scorecards, run manifests, and markdown reports.
build_env_requirements, build_environment +7
- Runtime and assets
Env reports, local assets, and path expansion.
expand_worldfoundry_path, load_local_assets +4
Import policy
Prefer public facades over private modules:
from worldfoundry.evaluation.api import (
ArtifactRef,
GenerationRequest,
GenerationResult,
Metric,
WorldModelRunner,
)
from worldfoundry.evaluation.public import WorldFoundryRunRequest, run_worldfoundry
from worldfoundry.evaluation.reporting import build_scorecard
from worldfoundry.core import scaled_dot_product_attentionworldfoundry.core lazily exports shared primitives. Evaluation contracts live in worldfoundry.evaluation.api, orchestration in worldfoundry.evaluation.public, evidence builders in worldfoundry.evaluation.reporting, and path/asset helpers in worldfoundry.runtime.*.
How pages are built
Signatures, parameters, methods, and source links are regenerated from Python AST during the docs build (no Torch/CUDA import). Choice guides and examples are written by hand.
cd docs/fumadocs
npm run api:generate
npm run api:checkFor workflows beyond signatures, continue to the design guide, inference guide, or evaluation overview.