Models and runners

Public model metadata, construction, execution protocols, and the shared pipeline surface.

On this page

WorldFoundry exposes two related extension boundaries. WorldModelRunner is the evaluation-facing protocol: it accepts normalized requests and returns normalized results. PipelineABC is the model-facing convenience layer: it owns loading and native inference behavior. An integration may implement both, or use an adapter between them.

WorldModelManifest

The public manifest is a compact DTO for model identity and capability. It is not the full catalog YAML and it is not runtime proof; it carries the fields that runner resolution and evaluation need after catalog loading.

class WorldModelManifest(model_id: str,name: str = '',aliases: tuple[str, ...] = (),version: str = '',provider: str = '',capabilities: tuple[str, ...] = (),supported_tasks: tuple[str, ...] = (),required_artifacts: tuple[str, ...] = (),output_artifacts: tuple[str, ...] = (),tags: tuple[str, ...] = (),metadata: Mapping[str, Any] = <dict factory>,schema_version: str = WORLD_MODEL_MANIFEST_SCHEMA_VERSION)
clsworldfoundry.evaluation.api.WorldModelManifestfrom worldfoundry.evaluation.api import WorldModelManifest
source

Overview

Compact public DTO for model identity and capabilities after catalog resolution. Not a full YAML dump and not proof that a checkpoint loaded.

Attributes

model_idstr
namestr
default: ''
aliasestuple[str, ...]
default: ()
versionstr
default: ''
providerstr
default: ''
capabilitiestuple[str, ...]
default: ()
supported_taskstuple[str, ...]
default: ()
required_artifactstuple[str, ...]
default: ()
output_artifactstuple[str, ...]
default: ()
tagstuple[str, ...]
default: ()
metadataMapping[str, Any]
default: <dict factory>
schema_versionstr
default: WORLD_MODEL_MANIFEST_SCHEMA_VERSION

Methods

cmethfrom_dict(data: Mapping[str, Any]) -> 'WorldModelManifest'source

Overview

Public classmethod on this type.

Parameters

dataMapping[str, Any]

Returns: 'WorldModelManifest'

WorldModelConfig

WorldModelConfig is the construction payload passed to a runner. Put model-native knobs in parameters, execution placement or endpoint settings in runtime, and preserve the resolved public manifest when one is available.

from worldfoundry.evaluation.api import WorldModelConfig

config = WorldModelConfig(
    model_id="matrix-game-2",
    runner="worldfoundry.evaluation.models.runners.pipeline:WorldFoundryPipelineRunner",
    variant="matrix-game-2-universal-action-validation",
    parameters={"num_output_frames": 15, "fps": 12},
    runtime={"device": "cuda:0"},
    seed=42,
)

The target above is the current Matrix-Game 2 catalog binding. Runtime bindings can evolve, so production code should still resolve the current model manifest rather than hard-coding a documentation example.

class WorldModelConfig(model_id: str,runner: str,variant: str = '',parameters: Mapping[str, Any] = <dict factory>,runtime: Mapping[str, Any] = <dict factory>,seed: int | None = None,manifest: WorldModelManifest | None = None,metadata: Mapping[str, Any] = <dict factory>,schema_version: str = WORLD_MODEL_CONFIG_SCHEMA_VERSION)
clsworldfoundry.evaluation.api.WorldModelConfigfrom worldfoundry.evaluation.api import WorldModelConfig
source

Overview

Construction payload for a runner: model id, runner target, variant, parameters, and runtime placement. Keep model-native knobs in parameters.

Attributes

model_idstr
runnerstr
variantstr
default: ''
parametersMapping[str, Any]
default: <dict factory>
runtimeMapping[str, Any]
default: <dict factory>
seedint | None
default: None
manifestWorldModelManifest | None
default: None
metadataMapping[str, Any]
default: <dict factory>
schema_versionstr
default: WORLD_MODEL_CONFIG_SCHEMA_VERSION

Methods

cmethfrom_dict(data: Mapping[str, Any]) -> 'WorldModelConfig'source

Overview

Public classmethod on this type.

Parameters

dataMapping[str, Any]

Returns: 'WorldModelConfig'

WorldModelRunner

This runtime-checkable protocol is intentionally small. A local checkpoint class, hosted API client, simulator policy, or subprocess bridge can all satisfy it without sharing an inheritance hierarchy.

from worldfoundry.evaluation.api import GenerationResult, WorldModelRunner

class ExistingArtifactRunner:
    model_id = "existing-artifact"
    capabilities = {"video_generation"}

    @classmethod
    def from_config(cls, config):
        return cls()

    def generate(self, requests):
        return [
            GenerationResult(
                sample_id=request.sample_id,
                model_id=self.model_id,
                status="failed",
                error="No generation implementation was configured.",
            )
            for request in requests
        ]

    def cleanup(self):
        pass

assert isinstance(ExistingArtifactRunner(), WorldModelRunner)

The example returns explicit failures to demonstrate the contract; a real runner must materialize artifacts and populate them in each successful result.

class WorldModelRunner(Protocol)
protworldfoundry.evaluation.api.WorldModelRunnerfrom worldfoundry.evaluation.api import WorldModelRunner
source

Overview

Minimal runtime-checkable protocol: accept GenerationRequest(s) and return GenerationResult(s). Local checkpoints, APIs, and simulators can all implement it.

Attributes

model_idstr
capabilitiesCollection[str]

Methods

cmethfrom_config(config: WorldModelConfig) -> 'WorldModelRunner'source

Overview

Public classmethod on this type.

Parameters

Returns: 'WorldModelRunner'

methgenerate(requests: Sequence[GenerationRequest]) -> Sequence[GenerationResult]source

Overview

Public method on this type.

Parameters

requestsSequence[GenerationRequest]

Returns: Sequence[GenerationResult]

methcleanup() -> Nonesource

Overview

Public method on this type.

Returns: None

PipelineABC

PipelineABC gives model integrations a shared loading and call shape while preserving native behavior. from_pretrained constructs components, process normalizes inputs, __call__ runs one inference, and stream exposes the same operation to interactive surfaces. Production pipelines may override any of these methods.

class PipelineABC(model_id: str | None = None,operators: Any = None,operator: Any = None,synthesis_model: Any = None,memory_module: Any = None,device: str = 'cuda',**kwargs: Any)
clsworldfoundry.pipelines.pipeline_utils.PipelineABCfrom worldfoundry.pipelines.pipeline_utils import PipelineABC
source

Overview

Model-facing pipeline base that owns load and native inference helpers. Pair with WorldModelRunner when evaluation needs a normalized boundary.

Source docstring

Shared, non-strict base for WorldFoundry pipelines.

The class intentionally avoids abstract methods because many existing pipelines predate this contract. Subclasses can override any method while still sharing a stable framework surface.

Parameters

model_idstr | None
default: None
operatorsAny
default: None
operatorAny
default: None
synthesis_modelAny
default: None
memory_moduleAny
default: None
devicestr
default: 'cuda'
kwargsAny

Methods

cmethfrom_pretrained(model_path: Any = None,required_components: dict[str, Any] | None = None,device: str = 'cuda',model_id: str | None = None,**kwargs: Any) -> 'PipelineABC'source

Overview

Create a pipeline with the unified loading signature.

Source docstring

Create a pipeline with the unified loading signature.

This default is a compatibility implementation for lightweight or test pipelines. Production pipelines are expected to override it when they need to load model components.

Parameters

model_pathAny
default: None
required_componentsdict[str, Any] | None
default: None
devicestr
default: 'cuda'
model_idstr | None
default: None
kwargsAny

Returns: 'PipelineABC'

methprocess(args: Any, **kwargs: Any) -> Anysource

Overview

Normalize inputs before inference.

Source docstring

Normalize inputs before inference.

Pipelines with operators should override this. The fallback preserves all caller data in a predictable shape for simple passthrough pipelines.

Parameters

argsAny
kwargsAny

Returns: Any

meth__call__(args: Any, **kwargs: Any) -> Anysource

Overview

Run the pipeline by delegating to :meth:process by default.

Parameters

argsAny
kwargsAny

Returns: Any

methstream(args: Any, **kwargs: Any) -> Anysource

Overview

Yield pipeline outputs using the same call semantics as `__call__`.

Parameters

argsAny
kwargsAny

Returns: Any

methget_operator() -> Anysource

Overview

Get operator for PipelineABC.

Returns: Any

methget_synthesis_model() -> Anysource

Overview

Get synthesis model for PipelineABC.

Returns: Any

Which boundary should an integration implement?

Implement WorldModelRunner when the goal is benchmark execution, batching normalized samples, caching, or producing evaluation ledgers. Implement or subclass PipelineABC when the goal is a reusable model-native inference object for scripts or Studio. If both are needed, keep checkpoint loading and native calls in the pipeline, then let the runner/operator translate GenerationRequest into pipeline inputs and pipeline output into GenerationResult.

For a complete repository integration, API conformance is only one step. The add a model guide also covers catalog identity, assets, runtime binding, bounded validation, and documentation.