Python API 参考
Core primitive、评测契约、runner 与 runtime 工具的源码驱动签名。
与 CLI、Studio 调用的是同一套契约。各页先给选型说明,再展示从源码生成的签名。模型专属实现、vendored 上游代码与 benchmark 内部细节不在本参考范围内。
Core
共享的注意力、I/O、加载、分布式、配置与加速 primitive。
- Core API 指南
如何选择注意力、加载、I/O 与加速 API。
- 注意力
SDPA 分发、融合后端、RoPE 与 KV cache。
apply_nd_rotary_embedding, apply_rotary_embedding +40
- 配置
LazyConfig 与延迟对象图。
CheckpointConfig, Config +7
- I/O 与媒体
路径、URI、图像、视频与序列化。
checkpoint_root_path, coerce_video_frames +71
- 模型加载
Checkpoint、state dict、DiskMap 与构造。
assign_state_dict_strict, build_rename_dict +18
- 分布式
集合通信与 context-parallel 切分/聚合。
broadcast, broadcast_dtensor_model_states +18
- 推理 Runtime
进程设置、编译、计时与 realtime。
adaptive_batched_inference, autocast_context +38
- 神经网络与数学
共享张量变换与数学辅助。
attention_head_dim, causal_attention_mask +36
- 加速与内存
Cache、offload、VRAM 与 kernels。
AdaptiveResidualCache, AutoTorchModule +24
- 基础能力
Registry、通用工具与安全契约。
as_list, batched_image_features +24
评测
可序列化契约、runner、metric、编排、证据与 runtime 工具。
- 契约与 artifact
Artifact 引用与生成 request/result 形态。
ArtifactRef, enrich_artifact_ref +5
- 模型与 runner
世界模型 manifest、配置与 runner。
PipelineABC, WorldModelConfig +2
- Metric 与 task
Metric spec、task 配置与 benchmark 契约。
AggregateResult, BenchmarkSpec +5
- Run 与 benchmark
Run 请求与公开 benchmark facade。
benchmark_integration_spec, list_video_benchmarks +5
- 报告与证据
Scorecard、run manifest 与 Markdown 报告。
build_env_requirements, build_environment +7
- Runtime 与资产
环境报告、本地资产与路径展开。
expand_worldfoundry_path, load_local_assets +4
Import 约定
优先使用公开 facade,避免直接依赖私有模块:
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 惰性导出共享 primitive;评测契约在 worldfoundry.evaluation.api,编排在 worldfoundry.evaluation.public,证据构建在 worldfoundry.evaluation.reporting,路径与资产工具在 worldfoundry.runtime.*。
页面如何生成
签名、参数、方法和源码链接在文档构建时由 Python AST 重新生成(不 import Torch/CUDA)。选型说明与示例由人工编写。
cd docs/fumadocs
npm run api:generate
npm run api:check